Just installed Jenkins 2.452.3 LTS for my Ubuntu 22 but encountered some issue like service failed to start

Using Ubuntu 22 LTS

  1. Installed Jenkins Using Documentations
  2. Installed Java JDK for Jenkins
  3. Error message:
    sudo systemctl start 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.

Thanks, in advance:)
Atharv

It’s hard to help when all you write that it failed without providing any details. Have you checked the output of journalctl -u jenkins?
It will most likely tell you what is wrong

Jul 18 22:50:12 venom-linux systemd[1]: jenkins.service: Start request repeated too quickly.
Jul 18 22:50:12 venom-linux systemd[1]: jenkins.service: Failed with result ‘exit-code’.
░░ Subject: Unit failed
░░ Defined-By: systemd
░░ Support: Enterprise open source support | Ubuntu
░░
░░ The unit jenkins.service has entered the ‘failed’ state with result ‘exit-code’.
Jul 18 22:50:12 venom-linux systemd[1]: Failed to start Jenkins Continuous Integration Server.
░░ Subject: A start job for unit jenkins.service has failed
░░ Defined-By: systemd
░░ Support: Enterprise open source support | Ubuntu
░░
░░ A start job for unit jenkins.service has finished with a failure.
░░
░░ The job identifier is 17915 and the job result is failed.

Jul 18 21:35:25 venom-linux systemd[1]: jenkins.service: Failed with result ‘exit-code’.
Jul 18 21:35:25 venom-linux systemd[1]: Failed to start Jenkins Continuous Integration Server.
Jul 18 21:35:25 venom-linux systemd[1]: jenkins.service: Scheduled restart job, restart counter is at 3.
Jul 18 21:35:25 venom-linux systemd[1]: Stopped Jenkins Continuous Integration Server.
Jul 18 21:35:25 venom-linux systemd[1]: Starting Jenkins Continuous Integration Server…
Jul 18 21:35:26 venom-linux jenkins[16622]: Running with Java 22 from /usr/lib/jvm/jdk-22-oracle-x64, which is not yet ful>
Jul 18 21:35:26 venom-linux jenkins[16622]: Run the command again with the --enable-future-java flag to enable preview sup>
Jul 18 21:35:26 venom-linux jenkins[16622]: Supported Java versions are: [11, 17, 21]
Jul 18 21:35:26 venom-linux jenkins[16622]: See https://jenkins.io/redirect/java-support/ for more information.
Jul 18 21:35:26 venom-linux systemd[1]: jenkins.service: Main process exited, code=exited, status=1/FAILURE

Jenkins does not support Java 22. Install a supported Java version, either Java 17 or Java 21.

I already installed java 11 and java 17 but still showing same error

Probably you have java22 still in the path so that it is found first.

Could you please let me know how to change path for the same.

The simplest method is probably to remove the Java 22 package from the operating system package manager. That should change the operating system to use one of the other Java versions that you have installed.

The more explicit method is to define the path to Java in the systemd configuration. The managing systemd services page provides more details.

On my Ubuntu 22.04, computer, when I run systemctl edit jenkins, it includes the following comments as hints of changes you might need:

# # The Java home directory. When left empty, JENKINS_JAVA_CMD and PATH are consulted.
# #Environment="JAVA_HOME=/usr/lib/jvm/java-11-openjdk-amd64"
#
# # The Java executable. When left empty, JAVA_HOME and PATH are consulted.
# #Environment="JENKINS_JAVA_CMD=/etc/alternatives/java"

The video from Darin Pope may also help you:

The final resolution involved changing the Java JDK version:

Change Java JDK version:

Use the following command to select the appropriate Java version:

sudo update-alternatives --config java

Select the desired Java version from the list.

Restart Jenkins service:

sudo systemctl start jenkins

Finally, the issue is solved.

Thanks to @MarkEWaite and @mawinter69 for support :slight_smile: