Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Jenkins 1.609 native package installer fails on OSX Yosemite

I'm trying to install Jenkins using the native package installer on OSX. The installer wizard fails with the following message:

The Installer encountered an error that caused the installation to fail.

There is quite a bit in /var/log/install.log but I think this is the most relevant:

Apr 19 21:38:10 computername installd[3906]: PackageKit: Executing script "./postinstall" in /private/tmp/PKInstallSandbox.lyWpmk/Scripts/org.jenkins-ci.launchd-jenkins.pkg.dnGIoF
Apr 19 21:38:10 computername installd[3906]: ./postinstall: <dscl_cmd> DS Error: -14009 (eDSUnknownNodeName)
Apr 19 21:38:10 computername installd[3906]: ./postinstall: list: Invalid Path
Apr 19 21:38:10 computername installd[3906]: ./postinstall: No jenkins user found, creating jenkins user and group
Apr 19 21:38:10 computername installd[3906]: ./postinstall: ERROR: All system uids are in use!
Apr 19 21:38:10 computername install_monitor[6300]: Re-included: /Applications, /Library, /System, /bin, /private, /sbin, /usr
Apr 19 21:38:10 computername installd[3906]: PackageKit: releasing backupd
Apr 19 21:38:10 computername installd[3906]: PackageKit: allow user idle system sleep
Apr 19 21:38:10 computername installd[3906]: PackageKit: Install Failed: Error Domain=PKInstallErrorDomain Code=112 "An error occurred while running scripts from the package “jenkins-1.609.pkg”." UserInfo=0x7f8ff1c4f5b0 {NSFilePath=./postinstall, NSURL=file://localhost/Users/username/Downloads/jenkins-1.609.pkg#orgjenkinsci-1.pkg, PKInstallPackageIdentifier=org.jenkins-ci.launchd-jenkins.pkg, NSLocalizedDescription=An error occurred while running scripts from the package “jenkins-1.609.pkg”.} {
        NSFilePath = "./postinstall";
        NSLocalizedDescription = "An error occurred while running scripts from the package \U201cjenkins-1.609.pkg\U201d.";
        NSURL = "file://localhost/Users/username/Downloads/jenkins-1.609.pkg#orgjenkinsci-1.pkg";
        PKInstallPackageIdentifier = "org.jenkins-ci.launchd-jenkins.pkg";
    }

Environment:

OSX: 10.10.3
Jenkins: jenkins-1.609.pkg
Java: 1.8.0_31

Any suggestions?

like image 943
Justin Avatar asked Apr 19 '15 19:04

Justin


1 Answers

Edit: Although the solution below seems to have helped people overcome the problem with the native installer, I would recommend avoiding the problem altogether by using homebrew for the installation of Jenkins. Back when I was using the native installer I had many other headaches while trying to configure Jenkins, but after switching to installation via homebrew, it's much more of a plug and play scenario.

Original answer:

The problem is that you have a user on your system with the uid 499. You can see this by running

$ dscl . -list /Users uid | sort -nrk 2

There is a postinstall script in the jenkins package installer that assumes that all system uid's are in use if uid 499 is in use. Therefore you have two options to fix this:

  • Fix the jenkins package installer

or

  • Change the uid for the user with uid 499

Changing the uid of a user is not so simple, but take a look at this.

I prefer to fix the jenkins package installer. Below is a guide for that:

  1. Download the jenkins installer
  2. Unpack the installer somewhere

    $ pkgutil --expand ~/Downloads/jenkins-1.610.pkg ~/Downloads/jenkins-1.610.unpkg

  3. Navigate to the postinstall script (this may change and there are several postinstall scripts in the package, so if the path below is wrong, look for the postinstall script with the commented line '# Find free uid under 500')

    $ cd ~/Downloads/jenkins-1.610.unpkg/orgjenkinsci-1.pkg/Scripts

  4. Open postinstall for editing and find the offending line of code (this is the line that starts with uid=, after the '# Find free uid under 500' line)

  5. Replace everything after the '=' with the uid you wish to use.

  6. Save the file

  7. Navigate to the (still unpacked) package root

    $ cd ~/Downloads/jenkins-1.610.unpkg

  8. Repack the package

    $ pkgutil --flatten ~/Downloads/jenkins-1.610.unpkg ~/Desktop/jenkins-1.610.pkg

  9. Run the fixed installer (that will be on the desktop if you used this guide). Maybe the system will warn you that you cannot install from untrusted sources, which may be because we modified the installer, or simply because you are not installing from the App store. Either way, you can go into 'System Preferences'->'Security and Privacy' to enable installs from untrusted sources.

like image 143
Marmoy Avatar answered Sep 20 '22 01:09

Marmoy