Jenkins upgrade Issue in Centos 7 INC

I have recently upgraded Jenkins from 2.164.0 to 11.0.16 version and Java open Jdk 11.0.16
But facing issue when restarting, can you help us to find the cause and fix it.

[root@ip-172-31-91-129 ~]# sudo systemctl status jenkins
● jenkins.service - LSB: Jenkins Automation Server
Loaded: loaded (/etc/rc.d/init.d/jenkins; bad; vendor preset: disabled)
Active: failed (Result: exit-code) since Wed 2022-09-21 14:51:36 EDT; 31min ago
Docs: man:systemd-sysv-generator(8)
Process: 14646 ExecStart=/etc/rc.d/init.d/jenkins start (code=exited, status=1/FAILURE)
Memory: 542.6M
CGroup: /system.slice/jenkins.service
├─22694 runuser -s /bin/bash centos -c ulimit -S -c 0 >/dev/null 2>&1 ; /etc/alternatives/java -Djava.awt.headless=true -DJENKI…
├─22695 bash -c ulimit -S -c 0 >/dev/null 2>&1 ; /etc/alternatives/java -Djava.awt.headless=true -DJENKINS_HOME=/home/centos/je…
└─22696 /etc/alternatives/java -Djava.awt.headless=true -DJENKINS_HOME=/home/centos/jenkins_home -jar /usr/lib/jenkins/jenkins…

Sep 21 14:51:35 ip-172-31-91-129.ec2.internal systemd[1]: Starting LSB: Jenkins Automation Server…
Sep 21 14:51:35 ip-172-31-91-129.ec2.internal runuser[14651]: pam_unix(runuser:session): session opened for user centos by (uid=0)
Sep 21 14:51:36 ip-172-31-91-129.ec2.internal jenkins[14646]: Starting Jenkins [FAILED]
Sep 21 14:51:36 ip-172-31-91-129.ec2.internal systemd[1]: jenkins.service: control process exited, code=exited status=1
Sep 21 14:51:36 ip-172-31-91-129.ec2.internal systemd[1]: Failed to start LSB: Jenkins Automation Server.
Sep 21 14:51:36 ip-172-31-91-129.ec2.internal systemd[1]: Unit jenkins.service entered failed state.
Sep 21 14:51:36 ip-172-31-91-129.ec2.internal systemd[1]: jenkins.service failed.

1 Like

It seems this topic has come up quite often recently, both here, google groups, gitter, and S/O.

Thinking out loud (as I don’t have it installed via package), is there a way Jenkins can know it has been installed via package manager, then based on that either disable the upgrade automatically button and/or throw up a warning, “It appears Jenkins was installed via a package manager. We recommend you update via the package manager rather than the UI or direct war replacement.” ?

In a perfect world, clicking upgrade in the UI would trigger the package manager to perform a package update and restart the service, but that is probably impractical, unrealistic and potentially consequential.

At least throwing up warning, guiding them to the best practice, or disabling, plus guidance could go a long way to reducing the support load.

I’m sure it’s doable with effort. You could query apt or rpm databases on startup and write a monitor. But it’s kinda too late for that. You want to display the warning before they do the upgrade, but you need the upgrade to get the warning. Potentially could check to see if the version running is the same as the package installed and spit out something to the startup log. I’m not sure anyone would want to spend the dev effort though. People tend to spend effort in areas that affect them

I’m pretty sure the problem isn’t people clicking upgrade in the UI. I’m pretty sure that’s only available if you can overwrite the war file, and I think the default packages all run as non root.

The problem so far is that people manually download new versions using curl/wget and override the war. We even had people doing this inside of docker images.

I’m not sure where these suggestions are coming from, but I should guess probably back in the days when releases were really unstable.

Thanks for Quick Respond !
The steps has followed to upgraded the version.

  1. Downloaded latest version 2.361.1 LTS
  2. Kept at path where existing was presented.
  3. Rename old one as a backup.
  4. Install open jdk 11.0 which was recommended for Latest Jenkins version.
  5. Pointed to Latest Java open Jdk 11.
  6. Java open jdk and Jenkins GUI lavel are upgraded.
  7. all above has done with stop the jenkins
  8. While restarting the Jenkins getting an issue.
    #sudo systemctl restart jenkins
    [centos@ip-172-31-91-129 ~]$ sudo systemctl status jenkins
    ● jenkins.service - LSB: Jenkins Automation Server
    Loaded: loaded (/etc/rc.d/init.d/jenkins; bad; vendor preset: disabled)
    Active: failed (Result: exit-code) since Mon 2022-09-26 02:10:08 EDT; 1 day 8h ago
    Docs: man:systemd-sysv-generator(8)
    Process: 9868 ExecStart=/etc/rc.d/init.d/jenkins start (code=exited, status=1/FAILURE)


That message says that you are running a new Jenkins war file but using the service management system that was provided by an old Jenkins RPM installer. That usually means the upgrade was performed incorrectly.

When Jenkins is installed with rpm (or apt), it needs to be upgraded with rpm (or apt). Do not upgrade Jenkins by replacing the war file. That bypasses the rpm (or apt) upgrade process.

# yum upgrade jenkins

Details are included in the answer that was linked earlier in this thread