Installing on Ubuntu, getting Service fails with result "timeout" on apt install

When installing on Ubuntu via directions provided by Install directions I am getting the service and install to fail.

> apt install jenkins
...
Do you want to continue? [Y/n] y
(Reading database ... 144296 files and directories currently installed.)
Removing jenkins (2.375.1) ...
(Reading database ... 144287 files and directories currently installed.)
Purging configuration files for jenkins (2.375.1) ...
failed to remove jenkins system user
Scanning processes...
Scanning processor microcode...
Scanning linux images...

Running kernel seems to be up-to-date.

Failed to check for processor microcode upgrades.

Selecting previously unselected package jenkins.
(Reading database ... 144282 files and directories currently installed.)
Preparing to unpack .../jenkins_2.375.1_all.deb ...
Unpacking jenkins (2.375.1) ...
Setting up jenkins (2.375.1) ...
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 -xeu jenkins.service" 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)
    Drop-In: /etc/systemd/system/jenkins.service.d
             └─override.conf
     Active: activating (auto-restart) (Result: timeout) since Fri 2022-12-09 10:27:08 UTC; 23ms ago
    Process: 28644 ExecStart=/usr/bin/jenkins (code=exited, status=143)
   Main PID: 28644 (code=exited, status=143)
     Status: "Jenkins stopped"
        CPU: 4min 30.555s
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)
1 Like

Here are the journalctl lines

> journalctl -u jenkins -f
Dec 09 10:17:45 fat-boi systemd[1]: Starting Jenkins Continuous Integration Server...
Dec 09 10:17:47 fat-boi jenkins[27383]: Running from: /usr/share/java/jenkins.war
Dec 09 10:17:48 fat-boi jenkins[27383]: 2022-12-09 10:17:48.016+0000 [id=1]        INFO        winstone.Logger#logInternal: Beginning extraction from war file
Dec 09 10:17:48 fat-boi jenkins[27383]: 2022-12-09 10:17:48.190+0000 [id=1]        WARNING        o.e.j.s.handler.ContextHandler#setContextPath: Empty contextPath
Dec 09 10:17:48 fat-boi jenkins[27383]: 2022-12-09 10:17:48.484+0000 [id=1]        INFO        org.eclipse.jetty.server.Server#doStart: jetty-10.0.12; built: 2022-09-14T01:54:40.076Z; git: 408d0139887e27a57b54ed52e2d92a36731a7e88; jvm 11.0.17+8-post-Ubuntu-1ubuntu222.04
Dec 09 10:17:49 fat-boi jenkins[27383]: 2022-12-09 10:17:49.984+0000 [id=1]        INFO        o.e.j.w.StandardDescriptorProcessor#visitServlet: NO JSP Support for /, did not find org.eclipse.jetty.jsp.JettyJspServlet
Dec 09 10:17:50 fat-boi jenkins[27383]: 2022-12-09 10:17:50.344+0000 [id=1]        INFO        o.e.j.s.s.DefaultSessionIdManager#doStart: Session workerName=node0
Dec 09 10:17:53 fat-boi jenkins[27383]: 2022-12-09 10:17:53.123+0000 [id=1]        INFO        hudson.WebAppMain#contextInitialized: Jenkins home directory: /var/lib/jenkins found at: EnvVars.masterEnvVars.get("JENKINS_HOME")
Dec 09 10:17:54 fat-boi jenkins[27383]: 2022-12-09 10:17:54.137+0000 [id=1]        INFO        o.e.j.s.handler.ContextHandler#doStart: Started w.@4642b71d{Jenkins v2.375.1,/,file:///var/cache/jenkins/war/,AVAILABLE}{/var/cache/jenkins/war}
Dec 09 10:17:54 fat-boi jenkins[27383]: 2022-12-09 10:17:54.199+0000 [id=1]        INFO        o.e.j.server.AbstractConnector#doStart: Started ServerConnector@707194ba{HTTP/1.1, (http/1.1)}{0.0.0.0:8989}
Dec 09 10:17:54 fat-boi jenkins[27383]: 2022-12-09 10:17:54.285+0000 [id=1]        INFO        org.eclipse.jetty.server.Server#doStart: Started Server@50caa560{STARTING}[10.0.12,sto=0] @8336ms
Dec 09 10:17:54 fat-boi jenkins[27383]: 2022-12-09 10:17:54.295+0000 [id=24]        INFO        winstone.Logger#logInternal: Winstone Servlet Engine running: controlPort=disabled
Dec 09 10:17:55 fat-boi jenkins[27383]: 2022-12-09 10:17:55.564+0000 [id=31]        INFO        jenkins.InitReactorRunner$1#onAttained: Started initialization
Dec 09 10:17:55 fat-boi jenkins[27383]: 2022-12-09 10:17:55.603+0000 [id=30]        INFO        jenkins.InitReactorRunner$1#onAttained: Listed all plugins
Dec 09 10:17:59 fat-boi jenkins[27383]: 2022-12-09 10:17:59.408+0000 [id=32]        INFO        jenkins.InitReactorRunner$1#onAttained: Prepared all plugins
Dec 09 10:17:59 fat-boi jenkins[27383]: 2022-12-09 10:17:59.441+0000 [id=35]        INFO        jenkins.InitReactorRunner$1#onAttained: Started all plugins
Dec 09 10:17:59 fat-boi jenkins[27383]: 2022-12-09 10:17:59.512+0000 [id=32]        INFO        jenkins.InitReactorRunner$1#onAttained: Augmented all extensions
Dec 09 10:18:00 fat-boi jenkins[27383]: 2022-12-09 10:18:00.798+0000 [id=37]        INFO        jenkins.InitReactorRunner$1#onAttained: System config loaded
Dec 09 10:18:00 fat-boi jenkins[27383]: 2022-12-09 10:18:00.806+0000 [id=29]        INFO        jenkins.InitReactorRunner$1#onAttained: System config adapted
Dec 09 10:18:00 fat-boi jenkins[27383]: 2022-12-09 10:18:00.812+0000 [id=29]        INFO        jenkins.InitReactorRunner$1#onAttained: Loaded all jobs
Dec 09 10:18:00 fat-boi jenkins[27383]: 2022-12-09 10:18:00.821+0000 [id=37]        INFO        jenkins.InitReactorRunner$1#onAttained: Configuration for all jobs updated
Dec 09 10:18:01 fat-boi jenkins[27383]: 2022-12-09 10:18:01.035+0000 [id=51]        INFO        hudson.util.Retrier#start: Attempt #1 to do the action check updates server
Dec 09 10:18:01 fat-boi jenkins[27383]: WARNING: An illegal reflective access operation has occurred
Dec 09 10:18:01 fat-boi jenkins[27383]: WARNING: Illegal reflective access by org.codehaus.groovy.vmplugin.v7.Java7$1 (file:/var/cache/jenkins/war/WEB-INF/lib/groovy-all-2.4.21.jar) to constructor java.lang.invoke.MethodHandles$Lookup(java.lang.Class,int)
Dec 09 10:18:01 fat-boi jenkins[27383]: WARNING: Please consider reporting this to the maintainers of org.codehaus.groovy.vmplugin.v7.Java7$1
Dec 09 10:18:01 fat-boi jenkins[27383]: WARNING: Use --illegal-access=warn to enable warnings of further illegal reflective access operations
Dec 09 10:18:01 fat-boi jenkins[27383]: WARNING: All illegal access operations will be denied in a future release
Dec 09 10:18:01 fat-boi jenkins[27383]: 2022-12-09 10:18:01.994+0000 [id=32]        INFO        jenkins.install.SetupWizard#init:
Dec 09 10:18:01 fat-boi jenkins[27383]: *************************************************************
Dec 09 10:18:01 fat-boi jenkins[27383]: *************************************************************
Dec 09 10:18:01 fat-boi jenkins[27383]: *************************************************************
Dec 09 10:18:01 fat-boi jenkins[27383]: Jenkins initial setup is required. An admin user has been created and a password generated.
Dec 09 10:18:01 fat-boi jenkins[27383]: Please use the following password to proceed to installation:
Dec 09 10:18:01 fat-boi jenkins[27383]: hooplah
Dec 09 10:18:01 fat-boi jenkins[27383]: This may also be found at: /var/lib/jenkins/secrets/initialAdminPassword
Dec 09 10:18:01 fat-boi jenkins[27383]: *************************************************************
Dec 09 10:18:01 fat-boi jenkins[27383]: *************************************************************
Dec 09 10:18:01 fat-boi jenkins[27383]: *************************************************************
Dec 09 10:19:15 fat-boi systemd[1]: jenkins.service: start operation timed out. Terminating.
Dec 09 10:19:15 fat-boi jenkins[27383]: 2022-12-09 10:19:15.936+0000 [id=25]        INFO        winstone.Logger#logInternal: JVM is terminating. Shutting down Jetty
Dec 09 10:19:15 fat-boi jenkins[27383]: 2022-12-09 10:19:15.941+0000 [id=25]        INFO        org.eclipse.jetty.server.Server#doStop: Stopped Server@50caa560{STOPPING}[10.0.12,sto=0]
Dec 09 10:19:16 fat-boi systemd[1]: jenkins.service: Failed with result 'timeout'.
Dec 09 10:19:16 fat-boi systemd[1]: Failed to start Jenkins Continuous Integration Server.
Dec 09 10:19:16 fat-boi systemd[1]: jenkins.service: Consumed 4min 37.771s CPU time.
Dec 09 10:19:16 fat-boi systemd[1]: jenkins.service: Scheduled restart job, restart counter is at 3
Dec 09 10:23:50 fat-boi systemd[1]: Starting Jenkins Continuous Integration Server...
Dec 09 10:23:52 fat-boi jenkins[27850]: Running from: /usr/share/java/jenkins.war
...
1 Like

Same problem here but with a Raspberry Pi 3b with openjdk version “11.0.16” 2022-07-19
I followed the instructions for linux systems.
(On my Debian PC it works fine.)

I know having it once working on a RPi maybe a year ago and I can’t remember it not being straight forward.

Could you solve the problem by now?

A Raspberry Pi 3b single board computer with 1 GB of physical memory and an SD card file system probably needs to have the systemd timeout value increased.

That page says:

If Jenkins does not signal startup completion within a configured time, the service will be considered failed and will be shut down again. As each initialization milestone (i.e., “Started initialization”, “Listed all plugins”, “Prepared all plugins”, “Started all plugins”, “Augmented all extensions”, “System config loaded”, “System config adapted”, “Loaded all jobs”, “Configuration for all jobs updated”, and “Completed initialization”) is attained, the timeout is extended by the value of the jenkins.model.Jenkins.extendTimeoutSeconds system property (by default, 15 seconds). The timeout can be configured with the TimeoutStartSec directive in the service unit.

A nicely detailed description of editing systemd timeout values is also available from stackoverflow as

This helped. Thank you.
I thought I tried this out already without success but this time it worked.