Ubuntu 20.04 Initial Jenkins startup failure

Just installed to Ubuntu 20.04LTS and the service fails to start:

$ sudo systemctl start jenkins.service
Job for jenkins.service failed because the control process exited with error code.
See “systemctl status jenkins.service” and “journalctl -xe” for details.

I added an echo of the command line to the init.d script and get:

$ sudo systemctl status jenkins.service
● jenkins.service - LSB: Start Jenkins at boot time
Loaded: loaded (/etc/init.d/jenkins; generated)
Active: failed (Result: exit-code) since Thu 2022-02-03 11:43:18 EST; 1min 19s ago
Docs: man:systemd-sysv-generator(8)
Process: 9970 ExecStart=/etc/init.d/jenkins start (code=exited, status=7)

Feb 03 11:43:16 david-ThinkPad-W541 jenkins[9970]: Correct java version found
Feb 03 11:43:16 david-ThinkPad-W541 jenkins[9970]: * Starting Jenkins Automation Server jenkins
Feb 03 11:43:16 david-ThinkPad-W541 jenkins[9970]: /bin/su -l jenkins --shell=/bin/bash -c /usr/bin/daemon --name=jenkins --inherit --env=JENKINS_HOME=/var/lib/jenkins --output=/var/log/jenkins/jenkins.log --pidfile=/var/run/jenkins/jenkins.pid – /usr/bin/java -Djava.awt.headless=true -jar /usr/share/jenkins/jenkins.war --webroot=/var/cache/jenkins/war --httpPort=8080
Feb 03 11:43:16 david-ThinkPad-W541 su[10024]: (to jenkins) root on none
Feb 03 11:43:16 david-ThinkPad-W541 su[10024]: pam_unix(su-l:session): session opened for user jenkins by (uid=0)
Feb 03 11:43:17 david-ThinkPad-W541 su[10024]: pam_unix(su-l:session): session closed for user jenkins
Feb 03 11:43:18 david-ThinkPad-W541 jenkins[9970]: …fail!
Feb 03 11:43:18 david-ThinkPad-W541 systemd[1]: jenkins.service: Control process exited, code=exited, status=7/NOTRUNNING
Feb 03 11:43:18 david-ThinkPad-W541 systemd[1]: jenkins.service: Failed with result ‘exit-code’.
Feb 03 11:43:18 david-ThinkPad-W541 systemd[1]: Failed to start LSB: Start Jenkins at boot time.

When I try the traced command from the command line I get:

/bin/su: unrecognized option ‘–name=jenkins’

Any thoughts are welcome

I just installed Jenkins 2.333 (latest weekly) on a Ubuntu 20.04 that was freshly installed and updated to most recent operating system patches. Steps that I took included:

Install Java 11 - required because Jenkins intentionally does not declare a Java dependency but requires Java

$ sudo apt-get install openjdk-11-jdk-headless

Follow the steps from Linux install instructions for Debian/Ubuntu or from the Debian Jenkins Packages install instructions

$ curl -fsSL https://pkg.jenkins.io/debian/jenkins.io.key | sudo tee \
    /usr/share/keyrings/jenkins-keyring.asc > /dev/null
$ echo deb [signed-by=/usr/share/keyrings/jenkins-keyring.asc] \
    https://pkg.jenkins.io/debian binary/ | sudo tee \
    /etc/apt/sources.list.d/jenkins.list > /dev/null
$ sudo apt-get update
$ sudo apt-get install jenkins

After doing that, systemctl status jenkins reports that the process is running.

How did you perform your installation?

2 Likes

I was using apt-get in similar fashion.
Finally got installed moments ago by removing a tomcat install I had and installing via the snap.

snap install jenkins --classic
1 Like

If the tomcat was running on port 8080, then Jenkins would not be able to start because it defaults to port 8080. There is a configuration setting in the /etc/default/jenkins file that will change the port number.

I’ve never used snap to install Jenkins. I’m glad it works. That’s great.

I have met the same problem, thank you very much for your answer, my problem was solved.
I used Ubuntu20.04, I installed openJK-11-JDK and OpenJK-11-JRE, the problem still exists, until the openJK-11-JK-headless problem in your answer is fixed, Jenkins is now running properly.