18

I've got a jenkins CI installed from a debian package (1.424.6 version, Debian/Ubuntu distribution, running on ubuntu 12.04). I read on the web that jenkins provides an automatic upgrade button, just like in this link. But I don't have such thing on my jenkins. I tried to find answers on google and in jenkins config, but failed. Maybe it's impossible for debian/ubuntu installed package?

GG.
  • 21,083
  • 14
  • 84
  • 130
ducin
  • 25,621
  • 41
  • 157
  • 256

5 Answers5

26

It's a permissions problem, If you trust in your Jenkins security configuration just run:

$ chown -R jenkins /usr/share/jenkins

Then restart jenkins and the upgrade button should be shown, and you can upgrade to last version, otherwise you have to use debian package system whose Jenkins version is not the latest.

alcala
  • 1,153
  • 2
  • 10
  • 14
  • For OSX users, do: `sudo chown -R jenkins /Applications/Jenkins` – johnboiles Dec 29 '15 at 22:44
  • 5
    In my case (hopefully default case), it was `chown -R jenkins:jenkins /usr/lib/jenkins/` – m_drinks_coffee Jul 19 '16 at 12:29
  • 1
    Please don't do this! Jenkins packages installed from a Linux package manager should be upgraded from the Linux package manager. The Linux package manager upgrade scripts are not run when the war file is replaced. The transition from System V init to systemd that happened in 2.332.1 won't be run unless you use the package manager to upgrade. – Mark Waite Apr 21 '22 at 04:53
12

as it states in the https://wiki.jenkins-ci.org/display/JENKINS/Automated+Upgrade "Using the Upgrade-Button from within Jenkins (available since 1.318) will not work if Jenkins was installed from a Debian package (results in permission denied errors when trying to download the new WAR file)!"

so even if you find the button it will fail.

but it also says that

aptitude update && aptitude install jenkins

will update the jenkins to the newest version, give it a try :)

konstructor
  • 453
  • 8
  • 17
  • 3
    Nothing happened. Still having the same version. $ sudo aptitude install jenkins No packages will be installed, upgraded, or removed. 0 packages upgraded, 0 newly installed, 0 to remove and 54 not upgraded. Need to get 0 B of archives. After unpacking 0 B will be used. – ducin Feb 07 '13 at 13:06
  • Thanks. You need to be root in order to run the commands. `sudo -i && aptitude update && aptitude install jenkins` – Dele Jan 19 '18 at 07:42
11

Change the ownership (to jenkins UID and GID) of the directory where the jenkins.war resides and the WAR file itself. For example, the following works for RHEL:

chown jenkins:jenkins /usr/lib/jenkins
chown jenkins:jenkins /usr/lib/jenkins/jenkins.war
Jesse
  • 1,603
  • 19
  • 20
  • This did the trick in making Jenkins pick up the new **.war** file which I downloaded. Thanks! – IgorGanapolsky Nov 20 '16 at 23:56
  • This restored the visibility of the "Upgrade Automatically" button for me in the web app. It went missing after downloading and reverting to a previous version of Jenkins using `root`. – JDQ Dec 31 '20 at 02:48
6

https://wiki.jenkins-ci.org/display/JENKINS/Automated+Upgrade

If you've installed via the OS X installer, the 'jenkins' running the process does not own the .war file. To get auto-upgrade working, just fix the permissions so the jenkins user can write the WAR (in /Applications/Jenkins).

run the command to find the location of jenkins.war

ps -aux | grep jenkins

output like this: jenkins 27765 172 11.0 3528188 432288 ? Ssl 12:23 4:16 /etc/alternatives/java -Djava.awt.headless=true -DJENKINS_HOME=/var/lib/jenkins -jar /usr/lib/jenkins/jenkins.war --logfile=/var/log/jenkins/jenkins.log --webroot=/var/cache/jenkins/war --httpPort=8080 --ajp13Port=8009 --debug=5 --handlerCountMax=100 --handlerCountMaxIdle=20

location of jenkins.war is: /usr/lib/jenkins/jenkins.war

run command to fix /usr/lib/jenkins/jenkins.war permissions. for example:

chmod 777 /usr/lib/jenkins/jenkins.war

then refresh manage page. and you will see the button.

rhinoceros.xn
  • 803
  • 9
  • 12
0

In my case, I had installed jenkins with snap. I brought everything down with docker-compose. Then I copied the downloaded jenkins.war to the snap directory. Next, brought things up with docker-compose, then latest version appeared in the jenkins ui.

igcu2
  • 1