在OSX Yosemite上,Jenkins 1.609本机程序包安装程序失败

Jus*_*tin 7 macos bash jenkins

我正在尝试使用OSX上的本机程序包安装程序安装Jenkins.安装程序向导失败,并显示以下消息:

安装程序遇到导致安装失败的错误.

有很多,/var/log/install.log但我认为这是最相关的:

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";
    }
Run Code Online (Sandbox Code Playgroud)

环境:

OSX: 10.10.3
Jenkins: jenkins-1.609.pkg
Java: 1.8.0_31
Run Code Online (Sandbox Code Playgroud)

有什么建议?

Mar*_*moy 19

编辑:虽然下面的解决方案似乎帮助人们克服了本机安装程序的问题,但我建议通过使用自制程序安装Jenkins来完全避免这个问题.回到我使用本机安装程序时,我在尝试配置Jenkins时遇到了许多其他麻烦,但在通过自制程序切换到安装后,它更像是一个即插即用的场景.

原始答案:

问题是你的系统上有一个用户使用uid 499.你可以通过运行看到这个

$ dscl . -list /Users uid | sort -nrk 2
Run Code Online (Sandbox Code Playgroud)

jenkins软件包安装程序中有一个postinstall脚本,假定在使用uid 499时正在使用所有系统uid.因此,您有两种方法可以解决此问题:

  • 修复jenkins软件包安装程序

要么

  • 使用uid 499更改用户的uid

更改用户的UID是不是那么简单,但看看这个.

我更喜欢修复jenkins包安装程序.以下是指南:

  1. 下载jenkins安装程序
  2. 在某处解压缩安装程序

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

  3. 导航到postinstall脚本(这可能会更改,并且包中有几个postinstall脚本,因此如果下面的路径错误,请查找带有注释行'#Find free uid 500以下'的postinstall脚本)

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

  4. 打开postinstall进行编辑,找到有问题的代码行(这是以uid开头的行,在'#Find free uid under 500'行之后)

  5. 使用您要使用的uid替换'='后的所有内容.

  6. 保存文件

  7. 导航到(仍未解压缩的)程序包根目录

    $ cd~/Downloads/jenkins-1.610.unpkg

  8. 重新包装

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

  9. 运行固定安装程序(如果您使用本指南,将在桌面上).也许系统会警告您无法从不受信任的来源安装,这可能是因为我们修改了安装程序,或者仅仅是因为您没有从App商店进行安装.无论哪种方式,您都可以进入"系统偏好设置" - >"安全和隐私",以启用不受信任来源的安装.