Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Jenkins fails when running "service start jenkins"

Tags:

jenkins

I installed jenkins on Centos 7 using the following:

sudo wget -O /etc/yum.repos.d/jenkins.repo http://pkg.jenkins.io/redhat-stable/jenkins.repo sudo rpm --import http://pkg.jenkins.io/redhat-stable/jenkins.io.key yum install jenkins 

as described on the official documentation

However when I run:

service start jenkins 

I get the following error message:

Starting jenkins (via systemctl):  Job for jenkins.service failed because the control process exited with error code. See "systemctl status jenkins.service" and "journalctl -xe" for details.                                                            [FAILED] 

Running systemctl status jenkins.service gives me this:

● jenkins.service - LSB: Jenkins Continuous Integration Server    Loaded: loaded (/etc/rc.d/init.d/jenkins)    Active: failed (Result: exit-code) since Wed 2016-09-21 16:45:28 BST; 3min 59s ago      Docs: man:systemd-sysv-generator(8)   Process: 2818 ExecStart=/etc/rc.d/init.d/jenkins start (code=exited, status=1/FAILURE)  Sep 21 16:45:28 webstack.local.caplib jenkins[2818]: at com.sun.akuma.JavaVMArguments.of(JavaVMArguments...04) Sep 21 16:45:28 webstack.local.caplib jenkins[2818]: at com.sun.akuma.JavaVMArguments.current(JavaVMArgu...92) Sep 21 16:45:28 webstack.local.caplib jenkins[2818]: at com.sun.akuma.Daemon.daemonize(Daemon.java:106) Sep 21 16:45:28 webstack.local.caplib jenkins[2818]: at com.sun.akuma.Daemon.all(Daemon.java:88) Sep 21 16:45:28 webstack.local.caplib jenkins[2818]: ... 6 more Sep 21 16:45:28 webstack.local.caplib systemd[1]: jenkins.service: control process exited, code=exited s...s=1 Sep 21 16:45:28 webstack.local.caplib systemd[1]: Failed to start LSB: Jenkins Continuous Integration Server. Sep 21 16:45:28 webstack.local.caplib systemd[1]: Unit jenkins.service entered failed state. Sep 21 16:45:28 webstack.local.caplib systemd[1]: jenkins.service failed. Sep 21 16:45:28 webstack.local.caplib jenkins[2818]: [FAILED] Hint: Some lines were ellipsized, use -l to show in full. 

and running journalctl -xe gives me this:

Sep 21 16:45:28 webstack.local.caplib jenkins[2818]: at com.sun.akuma.JavaVMArguments.of(JavaVMArguments.java: Sep 21 16:45:28 webstack.local.caplib jenkins[2818]: at com.sun.akuma.JavaVMArguments.current(JavaVMArguments. Sep 21 16:45:28 webstack.local.caplib jenkins[2818]: at com.sun.akuma.Daemon.daemonize(Daemon.java:106) Sep 21 16:45:28 webstack.local.caplib jenkins[2818]: at com.sun.akuma.Daemon.all(Daemon.java:88) Sep 21 16:45:28 webstack.local.caplib jenkins[2818]: ... 6 more Sep 21 16:45:28 webstack.local.caplib runuser[2819]: pam_unix(runuser:session): session closed for user jenkin Sep 21 16:45:28 webstack.local.caplib systemd[1]: jenkins.service: control process exited, code=exited status= Sep 21 16:45:28 webstack.local.caplib systemd[1]: Failed to start LSB: Jenkins Continuous Integration Server. -- Subject: Unit jenkins.service has failed -- Defined-By: systemd -- Support: http://lists.freedesktop.org/mailman/listinfo/systemd-devel -- -- Unit jenkins.service has failed. -- -- The result is failed. Sep 21 16:45:28 webstack.local.caplib systemd[1]: Unit jenkins.service entered failed state. Sep 21 16:45:28 webstack.local.caplib systemd[1]: jenkins.service failed. Sep 21 16:45:28 webstack.local.caplib jenkins[2818]: [FAILED] Sep 21 16:45:28 webstack.local.caplib polkitd[1392]: Unregistered Authentication Agent for unix-process:2813:8 Sep 21 16:45:28 webstack.local.caplib dhclient[1390]: DHCPREQUEST on eno16777984 to 192.168.15.254 port 67 (xi Sep 21 16:45:28 webstack.local.caplib dhclient[1390]: DHCPACK from 192.168.15.254 (xid=0x2ab6e6bc) Sep 21 16:45:30 webstack.local.caplib dhclient[1390]: bound to 192.168.15.120 -- renewal in 865 seconds. Sep 21 16:45:36 webstack.local.caplib systemd[1]: Starting Cleanup of Temporary Directories... -- Subject: Unit systemd-tmpfiles-clean.service has begun start-up -- Defined-By: systemd -- Support: http://lists.freedesktop.org/mailman/listinfo/systemd-devel -- -- Unit systemd-tmpfiles-clean.service has begun starting up. Sep 21 16:45:36 webstack.local.caplib systemd[1]: Started Cleanup of Temporary Directories. -- Subject: Unit systemd-tmpfiles-clean.service has finished start-up -- Defined-By: systemd -- Support: http://lists.freedesktop.org/mailman/listinfo/systemd-devel -- -- Unit systemd-tmpfiles-clean.service has finished starting up. -- -- The start-up result is done. 

Both of which is really unhelpful. How do I fix this issue?

like image 702
Yahya Uddin Avatar asked Sep 21 '16 15:09

Yahya Uddin


People also ask

How do I fix active exited Jenkins?

Check the status of the firewall by using the below command. It will show the firewall status as enable and active. Now allow access to port 8080 by using below command. Now restart your Jenkins server and check the status.

How do I start Jenkins from command prompt?

Open up a terminal/command prompt window to the download directory. Run the command java -jar jenkins. war . Browse to http://localhost:8080 and wait until the Unlock Jenkins page appears.


1 Answers

Similar problem on Ubuntu 16.04.

Setting up jenkins (2.72) ... Job for jenkins.service failed because the control process exited with error code. See "systemctl status jenkins.service" and "journalctl -xe" for details. invoke-rc.d: initscript jenkins, action "start" failed. ● jenkins.service - LSB: Start Jenkins at boot time Loaded: loaded (/etc/init.d/jenkins; bad; vendor preset: enabled) Active: failed (Result: exit-code) since Tue 2017-08-01 05:39:06 UTC; 7ms ago Docs: man:systemd-sysv-generator(8) Process: 3700 ExecStart=/etc/init.d/jenkins start (code=exited, status=1/FAILURE)  Aug 01 05:39:06 ip-0 systemd[1]: Starting LSB: Start Jenkins .... Aug 01 05:39:06 ip-0 jenkins[3700]: ERROR: No Java executable ... Aug 01 05:39:06 ip-0 jenkins[3700]: If you actually have java ... Aug 01 05:39:06 ip-0 systemd[1]: jenkins.service: Control pro...1 Aug 01 05:39:06 ip-0 systemd[1]: Failed to start LSB: Start J.... Aug 01 05:39:06 ip-0 systemd[1]: jenkins.service: Unit entere.... Aug 01 05:39:06 ip-0 systemd[1]: jenkins.service: Failed with.... 

To fix the issue manually install Java Runtime Environment:

JDK version 9:

sudo apt install openjdk-9-jre 

JDK version 8:

sudo apt install openjdk-8-jre 

Open Jenkins configuration file:

sudo vi /etc/init.d/jenkins 

Finally, append path to the new java executable (line 16):

PATH=/bin:/usr/bin:/sbin:/usr/sbin:/usr/lib/jvm/java-8-openjdk-amd64/bin/ 
like image 53
Andrew Strycharz Avatar answered Sep 24 '22 08:09

Andrew Strycharz