4

Jenkins was running all fine on a RedHat Linux machine (a clean EC2 machine on AWS), until I decided to change the JENKINS_HOME. I simply moved the Jenkins directory from /var/lib/jenkins to /home/ec2-user/jenkins and then created a symlink. (I followed the first answer to this question: Change JENKINS_HOME on Red Hat Linux?).

However when I restart Jenkins I get the error:

Unable to create the home directory ‘/var/lib/jenkins’. This is most likely a permission problem. To change the home directory, use JENKINS_HOME environment variable or set the JENKINS_HOME system property.

I tried changing JENKINS_HOME in /etc/sysconfig/jenkins, setting it to the new folder (which I suppose defeats the point of a symlink?) and I still get the same error

Unable to create the home directory ‘/home/ec2-user/jenkins’.

It is for backup purposes, so that I have all Jenkins data in a mounted external data storage (AWS Elastic File System).

4

3 回答 3

2

我已经想通了。此错误一直存在,因为用户“jenkins”需要访问 /jenkins/ 文件夹才能运行进程,但它无法访问该文件夹,因为它属于特定的登录用户。我将安装更改为 /var/ jenkins 可以作为全局进程访问的位置,它解决了问题。

于 2017-01-26T12:55:20.097 回答
1

我遇到了同样的问题,所以在这里分享我的解决方案:
用户jenkins无权访问文件夹 home/ec2-user/jenkins。您可以通过将用户jenkins更改或添加到 owner来修改文件夹 home/ec2-user/home 的访问权限

sudo chown jenkins /home/ec2-user/jenkins
sudo chmod u+w /home/ec2-user/jenkins

要验证新所有权,您可以执行以下操作:

ls -ld /home/ec2-user/jenkins
于 2018-07-20T13:56:36.817 回答
0

错误似乎很明显:“这很可能是权限问题。

我假设/home/jenkins不存在,并且用户jenkins/home. 如果您将 Jenkins 搬家,那么您可能是以 root 身份进行的,只是忘记更新所有者权限。

您需要创建家,如下所示:

sudo service jenkins stop
# make the changes in /etc/sysconfig/jenkins
sudo mkdir --parents /home/jenkins  # or mv, in your case
sudo chown --recursive jenkins /home/jenkins
sudo service jenkins start
于 2017-01-20T20:53:02.613 回答