Score:0

jenkins.service: Failed with result 'exit-code'

im flag

I'm trying to install Jenkins using this tutorial:

https://phoenixnap.com/kb/install-jenkins-ubuntu

but I get:

root@server:~# sudo apt install jenkins
Reading package lists... Done
Building dependency tree
Reading state information... Done
jenkins is already the newest version (2.319.2).
0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.
1 not fully installed or removed.
After this operation, 0 B of additional disk space will be used.
Do you want to continue? [Y/n]
Setting up jenkins (2.319.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 Sun 2022-01-30 16:41:35 UTC; 16ms ago
       Docs: man:systemd-sysv-generator(8)
    Process: 1457069 ExecStart=/etc/init.d/jenkins start (code=exited, status=1/FAILURE)

Jan 30 16:41:35 datalis systemd[1]: Starting LSB: Start Jenkins at boot time...
Jan 30 16:41:35 datalis jenkins[1457069]: Found an incorrect Java version
Jan 30 16:41:35 datalis jenkins[1457069]: Java version found:
Jan 30 16:41:35 datalis jenkins[1457091]: java version "17.0.1" 2021-10-19 LTS
Jan 30 16:41:35 datalis jenkins[1457091]: Java(TM) SE Runtime Environment (build 17.0.1+12-LTS-39)
Jan 30 16:41:35 datalis jenkins[1457091]: Java HotSpot(TM) 64-Bit Server VM (build 17.0.1+12-LTS-39, mixed mode, sharing)
Jan 30 16:41:35 datalis jenkins[1457069]: Aborting
Jan 30 16:41:35 datalis systemd[1]: jenkins.service: Control process exited, code=exited, status=1/FAILURE
Jan 30 16:41:35 datalis systemd[1]: jenkins.service: Failed with result 'exit-code'.
Jan 30 16:41:35 datalis 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
Errors were encountered while processing:
 jenkins
E: Sub-process /usr/bin/dpkg returned an error code (1)
root@server:~# ^C
root@server:~#

Do you know how I can fix this?

mchid avatar
bo flag
What method did you use to install java and what does `java --version` return?
mchid avatar
bo flag
On a side note, you shouldn't be running as root. You're using `sudo` so you don't need to be root. If you don't like typing your password, after you enter your password the first time, it shouldn't ask you again and you should be able to run `sudo` without a password until it times out. Running as root is just bad practice and there's really no need, that's what `sudo` is for.
Score:0
es flag
  1. Purge/ Remove your jenkins completely in your system using below commands:

sudo apt-get remove jenkins

sudo apt-get remove --auto-remove jenkins

  1. Check if you have java installed in your machine using this command:

java --version

  1. If java is not installed kindly check your system version and install the necessary java package for example for my Ubuntu 22.04 LTS, I installed using:

sudo apt install openjdk-11-jre-headless

  1. Now you can proceed and re-install your jenkins:

sudo apt install jenkins

mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.