Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Jenkins installation - Unable to create the home directory despite its existence and writeability

I'm trying to install Jenkins on a Tomcat 7 container.

When I try to open the Jenkins web app I get following error:

Unable to create the home directory '/home/myuser/jenkins/work'. This is most 
likely a permission problem.

To change the home directory, use JENKINS_HOME environment variable or set 
the JENKINS_HOME system property. See Container-specific documentation for 
more details of how to do this.

Before starting Tomcat, I did chmod uog+rwx /home/myuser/jenkins. So, I suppose that Jenkins should be able to create a subdirectory there.

But obviously it can't.

How can I fix this problem?

Update 1:

lt -lt returns

drwxrwxrwx 2 root ec2-user 4096 Jun 23 10:25 jenkins

for /home/myuser/jenkins. /home/myuser/jenkins/work doesn't exist because Jenkins is supposed to create it.

Update 2: Just tried to create the work directory and to run chmod uog+rwx on it. It didn't help.

Update 3: Additional information:

  1. I need Jenkins in order to
    1. run lengthy tests in the night (fast unit tests are run before every mvn install, slow tests are executed every night) and
    2. save software quality metrics (checkstyle, PMD, FindBugs, unit test coverage etc.) over time.
  2. I have only one machine available for that and there is a Tomcat7 container installed there already.
  3. At the moment, I don't want to invest additional money into buying new machines.
  4. The machine with the Tomcat7 container (and where I want Jenkins to be installed) is an Amazon EC2 microinstance (OS version is given below).

    $ cat /etc/*-release LSB_VERSION=base-4.0-amd64:base-4.0-noarch:core-4.0-amd64:core-4.0-noarch:printing-4.0-amd64:printing-4.0-noarch Amazon Linux AMI release 2013.03

Update 4 (29.06.2013 13:34 MSK): The output of yum list does not contain any Jenkins/Hudson package.

like image 456
Dmitrii Pisarenko Avatar asked Jun 23 '13 10:06

Dmitrii Pisarenko


1 Answers

If Tomcat is running as a separate user you will need to give execute permission to your home directory to that user - either by giving it to all or by creating a group especially for you and the tomcat user.

(UPDATE) More specifically: You say you already did chmod uog+rwx /home/myuser/jenkins, if Tomcat is not running asl 'myuser' it also needs execute permission on /home and on /home/myuser to be able to open /home/myuser/jenkins. If you are not picky about other users on the system opening your homedir you could allow this by: chmod a+x /home/myuser. (I'm assuming here the permissions for /home are already ok)

If you are running tomcat as 'myuser' the filsystem permissions look fine, but Tomcat's own permission system might be the problem as webapps are not allowed to touch the filesystem if the default settings of the security manager are on.

See: https://wiki.jenkins-ci.org/display/JENKINS/Tomcat

You don't specify more about your exact Tomcat/OS setup so I can't give exact details, but the fast way to find out if it's a security manager issue is to give AllPermission to you webapp. If you don't run in a safe environment it is advisable to only use that as a test, and setup only the really needed permissions later.

like image 138
Simon Groenewolt Avatar answered Oct 22 '22 12:10

Simon Groenewolt