-
Bug
-
Resolution: Unresolved
-
Minor
-
None
-
Ubuntu 12.04
First off, doing big "chown -R" or "chmod -R" in a package post install script is just bad form. Setting permissions on files you install with the package is OK, but descending into a whole tree is a bit sketchy.
Specifically the chown/chmod in the postinst script causes problems where the jenkins home dir (/var/lib/jenkins) is not local (is NFS) and root squash is in effect. The chown and chmod on lines 41 and 51 respectively fail in this case.
https://github.com/jenkinsci/jenkins/blob/8ef4df922e47e1e002271562c2c458e764c36b89/debian/debian/jenkins.postinst#L49
https://github.com/jenkinsci/jenkins/blob/8ef4df922e47e1e002271562c2c458e764c36b89/debian/debian/jenkins.postinst#L51
Also, it's unclear why this chown/chmod is done. Maybe the intent was that this be included only in the "upgrading from hudson" case? I don't see any reason to do this, especially not on every minor upgrade. (Also, this doesn't respect JENKINS_HOME, but assumes /var/lib/jenkins.)
Notice the history of bugs related to this: JENKINS-4047, JENKINS-5969, JENKINS-8502, JENKINS-5908, JENKINS-5112
Workaround 1 (tested):
apt-get install jenkins # fails
perl -pi -e 's/^set -e/#set -e/' /var/lib/dpkg/info/jenkins.postinst
dpkg --configure jenkins
Workaround 2 (untested):
Change JENKINS_HOME (in /etc/default/jenkins) to somewhere other than /var/lib/jenkins, and let the package do whatever it wants with the un-used/empty /var/lib/jenkins.
Possible solutions:
1. Remove the chown/chmods
2. Move them inside the upgrading from Hudson case
3. Add "|| true" to the end so failure is non-fatal
4. Find the root cause for why they were added and fix that instead.