Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Launchd is not starting Jenkins server on OS X Yosemite

Under OS X 10.9 Jenkins CI was being automatically started by launchd. After update to 10.10, it is no longer being started.

Jenkins was installed using the OS X installer from jenkins-ci.org. I was running v1.584. After this problem surfaced I reinstalled using v1.585 to no avail.

There is no output in the log file specified in org.jenkins-ci.plist. Syslog has several messages indicating that the org.jenkins-ci service "could not initialize: 14A389: xpcproxy + 14045 [1344][1016C726-9ACF-3A24-9C51-A279F5C6B167]: 0xd".

What's changed in Yosemite that broke jenkins?

Is the "0xd" at the end of the log message an error code?

I tried manually loading and starting via launchctl. No errors were output to the console but jenkins is still not running.

The problem is not unique to Jenkins. I have another launchd item that also fails since the update to 10.10: TrendMicro anti-virus.

like image 645
msc Avatar asked Oct 21 '14 09:10

msc


People also ask

Where is org Jenkins CI plist?

The launch daemon picks up the command line options from a standard preferences file, /Library/Preferences/org. jenkins-ci. plist . If the file does not exist, built-in defaults are used.


1 Answers

Here is the definitive answer.

  1. Ensure you have Java installed. The 10.10 installer, at least in my case, removed Apple's Java 6. The installed java must satisfy the /usr/bin/java* links. These point to /System/Library/Frameworks/JavaVM.framework/Versions/Current/Commands. When installing Oracle Java you need the JDK not the JRE to meet this requirement.

  2. chown jenkins /var/log/jenkins/jenkins.log

  3. Make sure /var/log/jenkins is owned by jenkins and searchable by anyone (mode 755). It will likely already be in this state.

  4. Edit the file /etc/newsyslog.d/jenkins.conf, changing

    /var/log/jenkins/jenkins.log 644 3 * $D0 J

    to

    /var/log/jenkins/jenkins.log jenkins:jenkins 644 3 * $D0 J

    This ensures that new log files created during nightly log rotation are owned by jenkins. If you do not do this, you will need to repeat step 2 every day.

Step 4 of @kjones answer is likely unnecessary as launchd attempts to start jenkins every 10 seconds.

The '0xd' at the end of the log message I posted is indeed the error code: Permission Denied.

What changed in launchd? /var/log/jenkins/jenkins.log is specified as the Standard{Error,Out}Path in org.jenkins-ci.plist. My theory is that prior to Yosemite launchd opened the file and set up STDOUT & STDERR before changing the process owner to "jenkins" and running jenkins-runner.sh. In Yosemite, it seems launchd does not open the file until after it has changed the process ownership, hence "permission denied" when the file is owned by root.

like image 164
msc Avatar answered Oct 06 '22 00:10

msc