Systemd is failing to launch Jenkins with error message
jenkins.service: Job jenkins.service/start failed with result 'dependency'.
I tried launching jenkins with jenkins username, also tried a different username defining its name in override.conf but I am still getting same error. Please suggest.
Jenkins setup:
$ grep -vE '^$|^#' /etc/default/jenkins
NAME=jenkins
JAVA_ARGS="-Djava.awt.headless=true"
PIDFILE=/var/run/$NAME/$NAME.pid
JENKINS_USER=$NAME
JENKINS_GROUP=$NAME
JENKINS_WAR=/usr/share/java/$NAME.war
JENKINS_HOME=/var/lib/$NAME
RUN_STANDALONE=true
JENKINS_LOG=/var/log/$NAME/$NAME.log
JENKINS_ENABLE_ACCESS_LOG="no"
MAXOPENFILES=8192
HTTP_PORT=8080
PREFIX=/$NAME
JENKINS_ARGS="--webroot=/var/cache/$NAME/war --httpPort=$HTTP_PORT"
$ sudo systemctl status jenkins.service
â—Ź 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: inactive (dead)
Nov 21 08:01:54 ppe-jenkins-worker01 systemd[1]: Dependency failed for Jenkins Continuous Integration Server.
Nov 21 08:01:54 ppe-jenkins-worker01 systemd[1]: jenkins.service: Job jenkins.service/start failed with result 'dependency'.
Nov 21 08:11:12 ppe-jenkins-worker01 systemd[1]: Dependency failed for Jenkins Continuous Integration Server.
Nov 21 08:11:12 ppe-jenkins-worker01 systemd[1]: jenkins.service: Job jenkins.service/start failed with result 'dependency'.
Nov 21 08:19:04 ppe-jenkins-worker01 systemd[1]: Dependency failed for Jenkins Continuous Integration Server.
Nov 21 08:19:04 ppe-jenkins-worker01 systemd[1]: jenkins.service: Job jenkins.service/start failed with result 'dependency'.
Nov 21 16:36:48 ppe-jenkins-worker01 systemd[1]: Dependency failed for Jenkins Continuous Integration Server.
Nov 21 16:36:48 ppe-jenkins-worker01 systemd[1]: jenkins.service: Job jenkins.service/start failed with result 'dependency'.
Nov 21 16:47:08 ppe-jenkins-worker01 systemd[1]: Dependency failed for Jenkins Continuous Integration Server.
Nov 21 16:47:08 ppe-jenkins-worker01 systemd[1]: jenkins.service: Job jenkins.service/start failed with result 'dependency'.
$ ls -ld /var/lib/jenkins/
drwxr-xr-x 2 jenkins jenkins 4096 Oct 2 11:43 /var/lib/jenkins/
$ ls -ld /var/log/jenkins/
drwxr-xr-x 2 jenkins jenkins 4096 Oct 2 11:43 /var/log/jenkins/
$ ls -ld /var/cache/jenkins
drwxr-x--- 2 jenkins jenkins 4096 Oct 2 11:43 /var/cache/jenkins
Packages:
$ dpkg -l | grep jenkins
ii jenkins 2.462.3 all Jenkins is the leading open source automation server supported by a large and growing community of developers, testers, designers and other people interested in continuous integration, continuous delivery and modern software delivery practices. Built on the Java Virtual Machine (JVM), it provides more than 1,800 plugins that extend Jenkins to automate with practically any technology software delivery teams use. In 2022, Jenkins reached 300,000 known installations making it the most widely deployed automation server.
$ dpkg -l | grep java
ii ca-certificates-java 20190405ubuntu1.1 all Common CA certificates (JKS keystore)
ii java-common 0.72 all Base package for Java runtimes
ii libatk-wrapper-java 0.37.1-1 all ATK implementation for Java using JNI
ii libatk-wrapper-java-jni:amd64 0.37.1-1 amd64 ATK implementation for Java using JNI (JNI bindings)
$ dpkg -l | grep jdk
ii openjdk-17-jre:amd64 17.0.13+11-2ubuntu1~20.04 amd64 OpenJDK Java runtime, using Hotspot JIT
ii openjdk-17-jre-headless:amd64 17.0.13+11-2ubuntu1~20.04 amd64 OpenJDK Java runtime, using Hotspot JIT (headless)
Only peripherally related to your question, but comments provided in case they help.
Jenkins does not use /etc/default/jenkins when installed with a Linux package manager. The systemd overrides are used to customize options.
Jenkins support for Ubuntu 20.04 will end in less than 6 months when Ubuntu ends their public support of Ubuntu 20.04. Use Ubuntu 22.04 or Ubuntu 24.04 for a longer operating system life and a longer time running on an operating system that Jenkins supports.
Thanks for looking. Unfortunately, I do not see any useful longlines other than these, initially I thought something systemd is depending on is failing but I am not sure what is it, network connection is good, can ping the gateway, can reach internet.
$ ping 8.8.8.8 -c 4
PING 8.8.8.8 (8.8.8.8) 56(84) bytes of data.
64 bytes from 8.8.8.8: icmp_seq=1 ttl=55 time=1.78 ms
64 bytes from 8.8.8.8: icmp_seq=2 ttl=55 time=1.84 ms
64 bytes from 8.8.8.8: icmp_seq=3 ttl=55 time=1.83 ms
64 bytes from 8.8.8.8: icmp_seq=4 ttl=55 time=1.88 ms
--- 8.8.8.8 ping statistics ---
4 packets transmitted, 4 received, 0% packet loss, time 3005ms
rtt min/avg/max/mdev = 1.778/1.832/1.876/0.035 ms
journalctl -u jenkins provides these below
Nov 21 07:42:20 ppe-jenkins-worker01 systemd[1]: Dependency failed for Jenkins Continuous Integration Server.
Nov 21 07:42:20 ppe-jenkins-worker01 systemd[1]: jenkins.service: Job jenkins.service/start failed with result 'dependency'.
Nov 21 07:43:53 ppe-jenkins-worker01 systemd[1]: Dependency failed for Jenkins Continuous Integration Server.
Nov 21 07:43:53 ppe-jenkins-worker01 systemd[1]: jenkins.service: Job jenkins.service/start failed with result 'dependency'.
-- Reboot --
Nov 21 08:01:54 ppe-jenkins-worker01 systemd[1]: Dependency failed for Jenkins Continuous Integration Server.
Nov 21 08:01:54 ppe-jenkins-worker01 systemd[1]: jenkins.service: Job jenkins.service/start failed with result 'dependency'.
Nov 21 08:11:12 ppe-jenkins-worker01 systemd[1]: Dependency failed for Jenkins Continuous Integration Server.
Nov 21 08:11:12 ppe-jenkins-worker01 systemd[1]: jenkins.service: Job jenkins.service/start failed with result 'dependency'.
Nov 21 08:19:04 ppe-jenkins-worker01 systemd[1]: Dependency failed for Jenkins Continuous Integration Server.
Nov 21 08:19:04 ppe-jenkins-worker01 systemd[1]: jenkins.service: Job jenkins.service/start failed with result 'dependency'.
Nov 21 16:36:48 ppe-jenkins-worker01 systemd[1]: Dependency failed for Jenkins Continuous Integration Server.
Nov 21 16:36:48 ppe-jenkins-worker01 systemd[1]: jenkins.service: Job jenkins.service/start failed with result 'dependency'.
Nov 21 16:47:08 ppe-jenkins-worker01 systemd[1]: Dependency failed for Jenkins Continuous Integration Server.
Nov 21 16:47:08 ppe-jenkins-worker01 systemd[1]: jenkins.service: Job jenkins.service/start failed with result 'dependency'.
-- Reboot --
Nov 21 17:01:10 ppe-jenkins-worker01 systemd[1]: Dependency failed for Jenkins Continuous Integration Server.
Nov 21 17:01:10 ppe-jenkins-worker01 systemd[1]: jenkins.service: Job jenkins.service/start failed with result 'dependency'.
Thanks for your response. I am able to reach the gateway and internet, so should not be network related, I could ssh to this jenkins box from a remote system in same network.
$ ping -c 4 pkg.jenkins.io
PING dualstack.d.sni.global.fastly.net (199.232.46.133) 56(84) bytes of data.
64 bytes from 199.232.46.133 (199.232.46.133): icmp_seq=1 ttl=51 time=36.7 ms
64 bytes from 199.232.46.133 (199.232.46.133): icmp_seq=2 ttl=51 time=37.0 ms
64 bytes from 199.232.46.133 (199.232.46.133): icmp_seq=3 ttl=51 time=37.0 ms
64 bytes from 199.232.46.133 (199.232.46.133): icmp_seq=4 ttl=51 time=37.0 ms
--- dualstack.d.sni.global.fastly.net ping statistics ---
4 packets transmitted, 4 received, 0% packet loss, time 3003ms
rtt min/avg/max/mdev = 36.691/36.901/36.998/0.122 ms
I made changes to the order in which I was trying to install the packages, and launch the jenkins service with a different username other than jenkins, it’s ansible in this case.
After removing override.conf, purging packages and re-installing openjdk-11, jenkins, plugins, jenkins service came up running with jenkins user.
I then created the override.conf file with necessary changes.
chown’d the /var/lib/jenkins /var/log/jenkins /var/cache/jenkins directories to provide access to ansible user.
Restarted the jenkins service, and it came back running with ansible user as intended.