Jenkins service will not start after update

Hi, we installed Jenkins 2.346.3 on Ubuntu using the package manager. We set it to authenticate using Active Directory and it worked ok.

Our IT admin then tried to update Jenkins using the package manager. He says that “the jenkins service stop/start functions worked before the update with package manager, but jenkins service will not start after it. Looks like file locations or permissions are incorrect.”

We have Java 11 installed:

$ java -version
openjdk version “11.0.16” 2022-07-19

Any thoughts about why this failed please?

what does the logs say?

journalctl -u jenkins.service

$ sudo apt upgrade jenkins
Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
Calculating upgrade... Done
The following held packages will be changed:
  jenkins
The following packages will be upgraded:
  jenkins
1 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.
Need to get 90.7 MB of archives.
After this operation, 2,308 kB of additional disk space will be used.
Do you want to continue? [Y/n]
Get:1 https://pkg.jenkins.io/debian-stable binary/ jenkins 2.361.2 [90.7 MB]
Ign:1 https://pkg.jenkins.io/debian-stable binary/ jenkins 2.361.2
Get:1 https://pkg.jenkins.io/debian-stable binary/ jenkins 2.361.2 [90.7 MB]
Fetched 1,021 kB in 50s (20.6 kB/s)
(Reading database ... 118936 files and directories currently installed.)
Preparing to unpack .../jenkins_2.361.2_all.deb ...
Unpacking jenkins (2.361.2) over (2.346.3) ...
Setting up jenkins (2.361.2) ...
Installing new version of config file /etc/init.d/jenkins ...
Job for jenkins.service failed because the control process exited with error code.
See "systemctl status jenkins.service" and "journalctl -xeu jenkins.service" for details.
invoke-rc.d: initscript jenkins, action "restart" failed.
● jenkins.service - Jenkins Continuous Integration Server
     Loaded: loaded (/lib/systemd/system/jenkins.service; enabled; vendor preset: enabled)
    Drop-In: /etc/systemd/system/jenkins.service.d
             └─override.conf
     Active: activating (auto-restart) (Result: exit-code) since Thu 2022-10-13 17:13:58 BST; 5ms ago
    Process: 13979 ExecStart=/usr/bin/jenkins (code=exited, status=1/FAILURE)
   Main PID: 13979 (code=exited, status=1/FAILURE)
        CPU: 425ms

Oct 13 17:13:58 jenkins-hw systemd[1]: Failed to start Jenkins Continuous Integration Server.
dpkg: error processing package jenkins (--configure):
installed jenkins package post-installation script subprocess returned error exit status 1
Errors were encountered while processing:
jenkins
needrestart is being skipped since dpkg has failed
E: Sub-process /usr/bin/dpkg returned an error code (1)
░░
░░ Automatic restarting of the unit jenkins.service has been scheduled, as the result for
░░ the configured Restart= setting for the unit.
Oct 13 17:14:00 jenkins-hw systemd[1]: Stopped Jenkins Continuous Integration Server.
░░ Subject: A stop job for unit jenkins.service has finished
░░ Defined-By: systemd
░░ Support: http://www.ubuntu.com/support
░░
░░ A stop job for unit jenkins.service has finished.
░░
░░ The job identifier is 2182 and the job result is done.
Oct 13 17:14:00 jenkins-hw systemd[1]: Starting Jenkins Continuous Integration Server...
░░ Subject: A start job for unit jenkins.service has begun execution
░░ Defined-By: systemd
░░ Support: http://www.ubuntu.com/support
░░
░░ A start job for unit jenkins.service has begun execution.
░░
░░ The job identifier is 2182.
Oct 13 17:14:00 jenkins-hw jenkins[14271]: Exception in thread "main" java.io.UncheckedIOException: java.io.FileNotFoundException: /va>
Oct 13 17:14:00 jenkins-hw jenkins[14271]:         at executable.Main.createLogFileStream(Main.java:357)
Oct 13 17:14:00 jenkins-hw jenkins[14271]:         at executable.Main._main(Main.java:206)
Oct 13 17:14:00 jenkins-hw jenkins[14271]:         at executable.Main.main(Main.java:116)
Oct 13 17:14:00 jenkins-hw jenkins[14271]: Caused by: java.io.FileNotFoundException: /var/log/hwjenkins/hwjenkins.log (No such file or>
Oct 13 17:14:00 jenkins-hw jenkins[14271]:         at java.base/java.io.FileOutputStream.open0(Native Method)
Oct 13 17:14:00 jenkins-hw jenkins[14271]:         at java.base/java.io.FileOutputStream.open(FileOutputStream.java:298)
Oct 13 17:14:00 jenkins-hw jenkins[14271]:         at java.base/java.io.FileOutputStream.<init>(FileOutputStream.java:237)
Oct 13 17:14:00 jenkins-hw jenkins[14271]:         at executable.LogFileOutputStream.<init>(LogFileOutputStream.java:60)
Oct 13 17:14:00 jenkins-hw jenkins[14271]:         at executable.Main.createLogFileStream(Main.java:355)
Oct 13 17:14:00 jenkins-hw jenkins[14271]:         ... 2 more
Oct 13 17:14:00 jenkins-hw systemd[1]: jenkins.service: Main process exited, code=exited, status=1/FAILURE
░░ Subject: Unit process exited
░░ Defined-By: systemd
░░ Support: http://www.ubuntu.com/support
░░
░░ An ExecStart= process belonging to unit jenkins.service has exited.
░░
░░ The process' exit code is 'exited' and its exit status is 1.
Oct 13 17:14:00 jenkins-hw systemd[1]: jenkins.service: Failed with result 'exit-code'.
░░ Subject: Unit failed
░░ Defined-By: systemd
░░ Support: http://www.ubuntu.com/support
░░
░░ The unit jenkins.service has entered the 'failed' state with result 'exit-code'.
Oct 13 17:14:00 jenkins-hw systemd[1]: Failed to start Jenkins Continuous Integration Server.
░░ Subject: A start job for unit jenkins.service has failed
░░ Defined-By: systemd
░░ Support: http://www.ubuntu.com/support
░░
░░ A start job for unit jenkins.service has finished with a failure.
░░
░░ The job identifier is 2182 and the job result is failed.
Oct 13 17:14:01 jenkins-hw systemd[1]: jenkins.service: Scheduled restart job, restart counter is at 5.
░░ Subject: Automatic restarting of a unit has been scheduled
░░ Defined-By: systemd
░░ Support: http://www.ubuntu.com/support
░░
░░ Automatic restarting of the unit jenkins.service has been scheduled, as the result for
░░ the configured Restart= setting for the unit.
Oct 13 17:14:01 jenkins-hw systemd[1]: Stopped Jenkins Continuous Integration Server.
░░ Subject: A stop job for unit jenkins.service has finished
░░ Defined-By: systemd
░░ Support: http://www.ubuntu.com/support
░░
░░ A stop job for unit jenkins.service has finished.
░░
░░ The job identifier is 2274 and the job result is done.
Oct 13 17:14:01 jenkins-hw systemd[1]: jenkins.service: Start request repeated too quickly.
Oct 13 17:14:01 jenkins-hw systemd[1]: jenkins.service: Failed with result 'exit-code'.
░░ Subject: Unit failed
░░ Defined-By: systemd
░░ Support: http://www.ubuntu.com/support
░░
░░ The unit jenkins.service has entered the 'failed' state with result 'exit-code'.
Oct 13 17:14:01 jenkins-hw systemd[1]: Failed to start Jenkins Continuous Integration Server.
░░ Subject: A start job for unit jenkins.service has failed
░░ Defined-By: systemd
░░ Support: http://www.ubuntu.com/support
░░
░░ A start job for unit jenkins.service has finished with a failure.
░░
░░ The job identifier is 2274 and the job result is failed.

any idea where this comes from? Sounds like /var/log/hwjenkins doesnt exist or locked down permissions, so it can’t write to it

looks like you have some overrides. Maybe something in there.

Sorry, I’m in the middle here, so can’t give very clear explanation, but our IT guy wrote:

I changed the configuration of jenkins to run as user ‘hwjenkins’ rather than ‘jenkins’ and enabled some logging so I think that is why that line is added.

Should we look in override.conf ?

It won’t start up due to the error, how you handle the error (create the directory, revert the change, etc) is up to you.

1 Like