I was trying to install Jenkins
in my server Ubuntu 20.04
with the following commands
wget -q -O - http://pkg.jenkins-ci.org/debian/jenkins-ci.org.key | sudo apt-key add -
sudo sh -c 'echo deb http://pkg.jenkins-ci.org/debian-stable binary/ > /etc/apt/sources.list.d/jenkins.list'
sudo apt update
sudo apt install jenkins
But installation fails with dpkg: error processing package jenkins (--configure):
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 2021-01-24 20:09:16 UTC; 13ms ago
Docs: man:systemd-sysv-generator(8)
Process: 1620107 ExecStart=/etc/init.d/jenkins start (code=exited, status=1/FAILURE)
Jan 24 20:09:16 ubuntu-s-1vcpu-1gb-nyc3-01 systemd[1]: Starting LSB: Start Jenkins at boot time...
Jan 24 20:09:16 ubuntu-s-1vcpu-1gb-nyc3-01 jenkins[1620107]: ERROR: No Java executable found in current PATH: /bin:/usr/bin:/sbin:/usr/sbin
Jan 24 20:09:16 ubuntu-s-1vcpu-1gb-nyc3-01 jenkins[1620107]: If you actually have java installed on the system make sure the executable is in the aforementioned path and that 'type -p java' returns the java executable path
Jan 24 20:09:16 ubuntu-s-1vcpu-1gb-nyc3-01 systemd[1]: jenkins.service: Control process exited, code=exited, status=1/FAILURE
Jan 24 20:09:16 ubuntu-s-1vcpu-1gb-nyc3-01 systemd[1]: jenkins.service: Failed with result 'exit-code'.
Jan 24 20:09:16 ubuntu-s-1vcpu-1gb-nyc3-01 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)
I've tried this, removing and again installation, changing the content of /etc/securetty
here but none of them is working. I'm only facing this problem when I try to install Jenkins
in server, while I tried to install my own laptop having Ubuntu 20.04
it works fine.
Using Java 8
sudo apt remove jenkins
sudo apt install openjdk-8-jdk
sudo apt install jenkins
Using Java 11
sudo apt remove jenkins
sudo apt install openjdk-11-jdk
sudo apt install jenkins