Job for jenkins.service failed because a timeout was exceeded

I have installed OpenJDK-11-JRE

root@admincp:~# java -version
openjdk version "11.0.15" 2022-04-19
OpenJDK Runtime Environment (build 11.0.15+10-Ubuntu-0ubuntu0.20.04.1)
OpenJDK 64-Bit Server VM (build 11.0.15+10-Ubuntu-0ubuntu0.20.04.1, mixed mode, sharing)

The following error occurred in installing Jenkins

root@admincp:~# apt install -y jenkins
Reading package lists... Done
Building dependency tree       
Reading state information... Done
The following packages were automatically installed and are no longer required:
  liblockfile-bin liblockfile1 lockfile-progs sendmail-base sensible-mda
Use 'apt autoremove' to remove them.
The following NEW packages will be installed:
  jenkins
0 upgraded, 1 newly installed, 0 to remove and 107 not upgraded.
Need to get 0 B/91.4 MB of archives.
After this operation, 95.0 MB of additional disk space will be used.
Selecting previously unselected package jenkins.
(Reading database ... 290346 files and directories currently installed.)
Preparing to unpack .../jenkins_2.332.3_all.deb ...
Unpacking jenkins (2.332.3) ...
Setting up jenkins (2.332.3) ...
Created symlink /etc/systemd/system/multi-user.target.wants/jenkins.service → /lib/systemd/system/jenkins.service.
Job for jenkins.service failed because a timeout was exceeded.
See "systemctl status jenkins.service" and "journalctl -xe" for details.
invoke-rc.d: initscript jenkins, action "start" failed.
● jenkins.service - Jenkins Continuous Integration Server
     Loaded: loaded (/lib/systemd/system/jenkins.service; enabled; vendor preset: enabled)
     Active: activating (auto-restart) (Result: timeout) since Tue 2022-05-17 15:31:19 CST; 9ms ago
    Process: 105107 ExecStart=/usr/bin/jenkins (code=exited, status=143)
   Main PID: 105107 (code=exited, status=143)
     Status: "Jenkins stopped"
dpkg: error processing package jenkins (--configure):
 installed jenkins package post-installation script subprocess returned error exit status 1
Processing triggers for systemd (245.4-4ubuntu3.15) ...
Errors were encountered while processing:
 jenkins
E: Sub-process /usr/bin/dpkg returned an error code (1)

root@admincp:~# systemctl status jenkins.service
● jenkins.service - Jenkins Continuous Integration Server
     Loaded: loaded (/lib/systemd/system/jenkins.service; enabled; vendor preset: enabled)
     Active: activating (start) since Tue 2022-05-17 15:32:50 CST; 25s ago
   Main PID: 106321 (java)
      Tasks: 119 (limit: 76486)
     Memory: 355.7M
     CGroup: /system.slice/jenkins.service
             └─106321 /usr/bin/java -Djava.awt.headless=true -jar /usr/share/java/jenkins.war --webroot=/var/cache/jenkins/war --httpPort=8080

5月 17 15:32:53 admincp jenkins[106321]: *************************************************************
5月 17 15:32:53 admincp jenkins[106321]: *************************************************************
5月 17 15:32:53 admincp jenkins[106321]: *************************************************************
5月 17 15:32:53 admincp jenkins[106321]: Jenkins initial setup is required. An admin user has been created and a password generated.
5月 17 15:32:53 admincp jenkins[106321]: Please use the following password to proceed to installation:
5月 17 15:32:53 admincp jenkins[106321]: b6c6ff7cfcbb498293d4646b732cd51a
5月 17 15:32:53 admincp jenkins[106321]: This may also be found at: /var/lib/jenkins/secrets/initialAdminPassword
5月 17 15:32:53 admincp jenkins[106321]: *************************************************************
5月 17 15:32:53 admincp jenkins[106321]: *************************************************************
5月 17 15:32:53 admincp jenkins[106321]: *************************************************************
root@admincp:~# journalctl -xe
-- Defined-By: systemd
-- Support: http://www.ubuntu.com/support
-- 
-- A start job for unit jenkins.service has begun execution.
-- 
-- The job identifier is 24920.
5月 17 15:32:50 admincp jenkins[106321]: Running from: /usr/share/java/jenkins.war
5月 17 15:32:50 admincp jenkins[106321]: 2022-05-17 07:32:50.838+0000 [id=1]        INFO        org.eclipse.jetty.util.log.Log#initialized: Logging initialized @315ms to org.eclipse.jetty.util.log.JavaUtilLog
5月 17 15:32:50 admincp jenkins[106321]: 2022-05-17 07:32:50.907+0000 [id=1]        INFO        winstone.Logger#logInternal: Beginning extraction from war file
5月 17 15:32:50 admincp jenkins[106321]: 2022-05-17 07:32:50.927+0000 [id=1]        WARNING        o.e.j.s.handler.ContextHandler#setContextPath: Empty contextPath
5月 17 15:32:50 admincp jenkins[106321]: 2022-05-17 07:32:50.980+0000 [id=1]        INFO        org.eclipse.jetty.server.Server#doStart: jetty-9.4.43.v20210629; built: 2021-06-30T11:07:22.254Z; git: 526006ecfa3af7f1a27ef3a288e2bef7ea9dd7>
5月 17 15:32:51 admincp jenkins[106321]: 2022-05-17 07:32:51.233+0000 [id=1]        INFO        o.e.j.w.StandardDescriptorProcessor#visitServlet: NO JSP Support for /, did not find org.eclipse.jetty.jsp.JettyJspServlet
5月 17 15:32:51 admincp jenkins[106321]: 2022-05-17 07:32:51.265+0000 [id=1]        INFO        o.e.j.s.s.DefaultSessionIdManager#doStart: DefaultSessionIdManager workerName=node0
5月 17 15:32:51 admincp jenkins[106321]: 2022-05-17 07:32:51.265+0000 [id=1]        INFO        o.e.j.s.s.DefaultSessionIdManager#doStart: No SessionScavenger set, using defaults
5月 17 15:32:51 admincp jenkins[106321]: 2022-05-17 07:32:51.266+0000 [id=1]        INFO        o.e.j.server.session.HouseKeeper#startScavenging: node0 Scavenging every 660000ms
5月 17 15:32:51 admincp jenkins[106321]: 2022-05-17 07:32:51.616+0000 [id=1]        INFO        hudson.WebAppMain#contextInitialized: Jenkins home directory: /var/lib/jenkins found at: EnvVars.masterEnvVars.get("JENKINS_HOME")
5月 17 15:32:51 admincp jenkins[106321]: 2022-05-17 07:32:51.770+0000 [id=1]        INFO        o.e.j.s.handler.ContextHandler#doStart: Started w.@2b62442c{Jenkins v2.332.3,/,file:///var/cache/jenkins/war/,AVAILABLE}{/var/cache/jenkins/w>
5月 17 15:32:51 admincp jenkins[106321]: 2022-05-17 07:32:51.789+0000 [id=1]        INFO        o.e.j.server.AbstractConnector#doStart: Started ServerConnector@75881071{HTTP/1.1, (http/1.1)}{0.0.0.0:8080}
5月 17 15:32:51 admincp jenkins[106321]: 2022-05-17 07:32:51.789+0000 [id=1]        INFO        org.eclipse.jetty.server.Server#doStart: Started @1267ms
5月 17 15:32:51 admincp jenkins[106321]: 2022-05-17 07:32:51.790+0000 [id=40]        INFO        winstone.Logger#logInternal: Winstone Servlet Engine running: controlPort=disabled
5月 17 15:32:52 admincp jenkins[106321]: 2022-05-17 07:32:52.033+0000 [id=47]        INFO        jenkins.InitReactorRunner$1#onAttained: Started initialization
5月 17 15:32:52 admincp jenkins[106321]: 2022-05-17 07:32:52.039+0000 [id=68]        INFO        jenkins.InitReactorRunner$1#onAttained: Listed all plugins
5月 17 15:32:52 admincp jenkins[106321]: 2022-05-17 07:32:52.708+0000 [id=76]        INFO        jenkins.InitReactorRunner$1#onAttained: Prepared all plugins
5月 17 15:32:52 admincp jenkins[106321]: 2022-05-17 07:32:52.716+0000 [id=85]        INFO        jenkins.InitReactorRunner$1#onAttained: Started all plugins
5月 17 15:32:52 admincp jenkins[106321]: 2022-05-17 07:32:52.723+0000 [id=93]        INFO        jenkins.InitReactorRunner$1#onAttained: Augmented all extensions
5月 17 15:32:52 admincp jenkins[106321]: 2022-05-17 07:32:52.902+0000 [id=56]        INFO        jenkins.InitReactorRunner$1#onAttained: System config loaded
5月 17 15:32:52 admincp jenkins[106321]: 2022-05-17 07:32:52.903+0000 [id=56]        INFO        jenkins.InitReactorRunner$1#onAttained: System config adapted
5月 17 15:32:52 admincp jenkins[106321]: 2022-05-17 07:32:52.904+0000 [id=56]        INFO        jenkins.InitReactorRunner$1#onAttained: Loaded all jobs
5月 17 15:32:52 admincp jenkins[106321]: 2022-05-17 07:32:52.906+0000 [id=70]        INFO        jenkins.InitReactorRunner$1#onAttained: Configuration for all jobs updated
5月 17 15:32:52 admincp jenkins[106321]: 2022-05-17 07:32:52.923+0000 [id=106]        INFO        hudson.model.AsyncPeriodicWork#lambda$doRun$1: Started Download metadata
5月 17 15:32:52 admincp jenkins[106321]: 2022-05-17 07:32:52.929+0000 [id=106]        INFO        hudson.util.Retrier#start: Attempt #1 to do the action check updates server
5月 17 15:32:52 admincp jenkins[106321]: WARNING: An illegal reflective access operation has occurred
5月 17 15:32:52 admincp jenkins[106321]: WARNING: Illegal reflective access by org.codehaus.groovy.reflection.CachedClass (file:/var/cache/jenkins/war/WEB-INF/lib/groovy-all-2.4.21.jar) to method java.lang.Object.finalize()
5月 17 15:32:52 admincp jenkins[106321]: WARNING: Please consider reporting this to the maintainers of org.codehaus.groovy.reflection.CachedClass
5月 17 15:32:52 admincp jenkins[106321]: WARNING: Use --illegal-access=warn to enable warnings of further illegal reflective access operations
5月 17 15:32:52 admincp jenkins[106321]: WARNING: All illegal access operations will be denied in a future release
5月 17 15:32:53 admincp jenkins[106321]: 2022-05-17 07:32:53.010+0000 [id=83]        INFO        jenkins.install.SetupWizard#init:
5月 17 15:32:53 admincp jenkins[106321]: *************************************************************
5月 17 15:32:53 admincp jenkins[106321]: *************************************************************
5月 17 15:32:53 admincp jenkins[106321]: *************************************************************
5月 17 15:32:53 admincp jenkins[106321]: Jenkins initial setup is required. An admin user has been created and a password generated.
5月 17 15:32:53 admincp jenkins[106321]: Please use the following password to proceed to installation:
5月 17 15:32:53 admincp jenkins[106321]: b6c6ff7cfcbb498293d4646b732cd51a
5月 17 15:32:53 admincp jenkins[106321]: This may also be found at: /var/lib/jenkins/secrets/initialAdminPassword
5月 17 15:32:53 admincp jenkins[106321]: *************************************************************
5月 17 15:32:53 admincp jenkins[106321]: *************************************************************
5月 17 15:32:53 admincp jenkins[106321]: *************************************************************
5月 17 15:32:53 admincp systemd[1]: Reloading.
5月 17 15:32:53 admincp systemd-sysv-generator[106697]: Overwriting existing symlink /run/systemd/generator.late/bt.service with real service.
5月 17 15:32:53 admincp systemd[1]: Configuration file /etc/systemd/system/runsunloginclient.service is marked executable. Please remove executable permission bits. Proceeding anyway.
5月 17 15:32:53 admincp systemd[1]: Reloading.
5月 17 15:32:53 admincp systemd-sysv-generator[106724]: Overwriting existing symlink /run/systemd/generator.late/bt.service with real service.
5月 17 15:32:53 admincp systemd[1]: Configuration file /etc/systemd/system/runsunloginclient.service is marked executable. Please remove executable permission bits. Proceeding anyway.
5月 17 15:32:56 admincp kernel: [UFW BLOCK] IN=eno1 OUT= MAC=2c:ea:7f:e7:7c:88:68:4a:ae:00:45:98:08:00 SRC=183.136.225.14 DST=218.83.234.148 LEN=44 TOS=0x00 PREC=0x20 TTL=117 ID=51846 PROTO=TCP SPT=25603 DPT=1027 WINDOW=29200 RES=0x00 SY>
5月 17 15:33:10 admincp kernel: [UFW BLOCK] IN=eno1 OUT= MAC=2c:ea:7f:e7:7c:88:68:4a:ae:00:45:98:08:00 SRC=52.202.51.185 DST=218.83.234.148 LEN=1452 TOS=0x00 PREC=0x20 TTL=44 ID=22619 DF PROTO=TCP SPT=443 DPT=52256 WINDOW=482 RES=0x00 AC

Dear friends, have you ever met the same problem? How should I deal with this mistake?

You are not alone. I have the same exact same openjdk version and error! It is frustrating!

I am going crazy. The installation of my cloud servers on Ali Cloud and Jingdong Cloud is normal without any problems. Both systems were Ubuntu20.04, I installed a brand new Ubuntu20.04.3 with OpenJDK-11-JRE installed, Jenkins just couldn’t install properly.

Please refer to the instructions in this blog post that describe how to report an issue with the Linux installers. Much more information is needed than you have provided. The necessary information is listed in the blog post along with the location to report the issue.

I just confirmed that the instructions from

work as expected on Ubuntu 20.04 as installed on Google Cloud Platform. The steps I took were:

  1. Install Ubuntu Linux 20.04 on Google Cloud Platform with 8 GB RAM
  2. Run the curl command in the LTS install instructions
  3. Run the echo command in the LTS install instructions
  4. Run the apt-get update command in the LTS install instructions
  5. Install Java 11 with apt install openjdk-11-jre as described in the install instructions
  6. Run the apt-get install jenkins command in the LTS install instructions
  7. Confirm that Jenkins is running with the command systemctl status jenkins

We has similar issue on jenkins start. But after few restarts it works. I think it is depending of hoe many nodes you use. But I am 100% sure

Anyone figure out the solution? following the steps as linked by @MarkEWaite did not solve the problem. This is for Ubuntu 22.04

The systemd service unit option that controls the timeout is TimeoutStartSec:

# Configures the time to wait for start-up. If Jenkins does not signal start-up
# completion within the configured time, the service will be considered failed
# and will be shut down again. Takes a unit-less value in seconds, or a time span
# value such as "5min 20s". Pass "infinity" to disable the timeout logic.
#TimeoutStartSec=90

6 posts were split to a new topic: Service failed to startup due to timeout