Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Install Jenkins in Ubuntu 18.04 LTS failed (Failed to start LSB: Start Jenkins at boot time.)

Tags:

jenkins

ubuntu

[Symptoms]

  • Install Jenkins by using official steps, but failed with error message Failed to start LSB: Start Jenkins at boot time.
  • Reproduce Steps

    wget -q -O - https://pkg.jenkins.io/debian-stable/jenkins.io.key | sudo apt-key add - sudo apt-add-repository "deb https://pkg.jenkins.io/debian-stable binary/" sudo apt install jenkins 
  • Console log

    gaspar@jenkins:~$ sudo apt install jenkins ... Setting up default-jre-headless (2:1.9-62ubuntu2) ... Setting up jenkins (2.107.2) ... 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; generated)    Active: failed (Result: exit-code) since Thu 2018-04-19 10:03:05 UTC; 9ms ago      Docs: man:systemd-sysv-generator(8)   Process: 27282 ExecStart=/etc/init.d/jenkins start (code=exited, status=7) Apr 19 10:03:03 evt-jenkins systemd[1]: Starting LSB: Start Jenkins at boot time... Apr 19 10:03:03 evt-jenkins jenkins[27282]:  * Starting Jenkins Automation Server jenkins Apr 19 10:03:03 evt-jenkins su[27313]: Successful su for jenkins by root Apr 19 10:03:03 evt-jenkins su[27313]: + ??? root:jenkins Apr 19 10:03:03 evt-jenkins su[27313]: pam_unix(su:session): session opened for user jenkins by (uid=0) Apr 19 10:03:03 evt-jenkins su[27313]: pam_unix(su:session): session closed for user jenkins Apr 19 10:03:05 evt-jenkins jenkins[27282]:    ...fail! Apr 19 10:03:05 evt-jenkins systemd[1]: jenkins.service: Control process exited, code=exited status=7 Apr 19 10:03:05 evt-jenkins systemd[1]: jenkins.service: Failed with result 'exit-code'. Apr 19 10:03:05 evt-jenkins systemd[1]: Failed to start LSB: Start Jenkins at boot time. dpkg: error processing package jenkins (--configure):  installed jenkins package post-installation script subprocess returned error exit status 1 ... 

[Environment]

  • Ubuntu 18.04 LTS Beta2
  • Jenkins 2.107.2
like image 360
Gaspar Cheng Avatar asked Apr 20 '18 08:04

Gaspar Cheng


People also ask

Which command is used to install Jenkins on Ubuntu?

Step 1 — Installing Jenkins wget -q -O - https://pkg.jenkins.io/debian-stable/jenkins.io.key |sudo gpg --dearmor -o /usr/share/keyrings/jenkins. gpg. The gpg --dearmor command is used to convert the key into a format that apt recognizes. Next, let's append the Debian package repository address to the server's sources.

Can we install Jenkins in Linux?

Prerequisites for installing Jenkins Please review the latest documentation on installing Java for your distribution of Linux. Java needs to be installed and configured on the server on which you want to configure Jenkins. OpenJDK is preferred with Jenkins, but you can also use any other version of Java.


2 Answers

[Root cause]

  • Ubuntu 18.04 LTS use Java 9 as default java
  • Jenkins 2.107.2 still use Java 8

[Solution]

  • Install Java 8 before install Jenkins

    sudo add-apt-repository ppa:webupd8team/java sudo apt install oracle-java8-installer wget -q -O - https://pkg.jenkins.io/debian-stable/jenkins.io.key | sudo apt-key add - sudo apt-add-repository "deb https://pkg.jenkins.io/debian-stable binary/" sudo apt-get update sudo apt install jenkins 
like image 50
Gaspar Cheng Avatar answered Sep 19 '22 21:09

Gaspar Cheng


  1. Install java 8
sudo apt install openjdk-8-jre 
  1. Set default java version as java 8
sudo update-alternatives --config java 
  1. Add the key
wget -q -O - https://pkg.jenkins.io/debian-stable/jenkins.io.key | sudo apt-key add - 
  1. Add repository
sudo apt-add-repository "deb https://pkg.jenkins.io/debian-stable binary/" 
  1. Install jenkins
sudo apt install jenkins 
like image 31
Iftekhar Uddin Ahmed Avatar answered Sep 20 '22 21:09

Iftekhar Uddin Ahmed