asquarezone/DevOpsClassRoom

Jenkins Installation Issue

Closed this issue · 4 comments

Hello,

I have the below error when trying to install Jenkins using both the Jenkins website steps or using the stable version from apt-cache output. Could it be that running Java 10 is causing the Jenkins service not to start (I did include the correct java version in /etc/enviornment):

root@ip-172-31-37-237:~# service jenkins status
● jenkins.service - LSB: Start Jenkins at boot time
Loaded: loaded (/etc/init.d/jenkins; generated)
Active: failed (Result: exit-code) since Thu 2019-04-25 04:33:49 UTC; 44s ago
Docs: man:systemd-sysv-generator(8)

Apr 25 04:33:49 ip-172-31-37-237 systemd[1]: Starting LSB: Start Jenkins at boot time...
Apr 25 04:33:49 ip-172-31-37-237 jenkins[2287]: Found an incorrect Java version
Apr 25 04:33:49 ip-172-31-37-237 jenkins[2287]: Java version found:
Apr 25 04:33:49 ip-172-31-37-237 jenkins[2287]: openjdk version "11.0.2" 2019-01-15
Apr 25 04:33:49 ip-172-31-37-237 jenkins[2287]: OpenJDK Runtime Environment (build 11.0.2+9-Ubuntu-3ubuntu118
Apr 25 04:33:49 ip-172-31-37-237 jenkins[2287]: OpenJDK 64-Bit Server VM (build 11.0.2+9-Ubuntu-3ubuntu118.04
Apr 25 04:33:49 ip-172-31-37-237 jenkins[2287]: Aborting
Apr 25 04:33:49 ip-172-31-37-237 systemd[1]: jenkins.service: Control process exited, code=exited status=1
Apr 25 04:33:49 ip-172-31-37-237 systemd[1]: jenkins.service: Failed with result 'exit-code'.
Apr 25 04:33:49 ip-172-31-37-237 systemd[1]: Failed to start LSB: Start Jenkins at boot time.
root@ip-172-31-37-237:# service jenkins restart
Job for jenkins.service failed because the control process exited with error code.
See "systemctl status jenkins.service" and "journalctl -xe" for details.
root@ip-172-31-37-237:
# apt-get install jenkins
Reading package lists... Done
Building dependency tree
Reading state information... Done
The following packages were automatically installed and are no longer required:
libopts25 sntp
Use 'apt autoremove' to remove them.
The following packages will be upgraded:
jenkins
1 upgraded, 0 newly installed, 0 to remove and 60 not upgraded.
1 not fully installed or removed.
Need to get 0 B/76.7 MB of archives.
After this operation, 1597 kB of additional disk space will be used.
(Reading database ... 134085 files and directories currently installed.)
Preparing to unpack .../jenkins_2.164.2_all.deb ...
Unpacking jenkins (2.164.2) over (2.138.3) ...
Setting up jenkins (2.164.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 2019-04-25 04:34:58 UTC; 8ms ago
Docs: man:systemd-sysv-generator(8)
Process: 2650 ExecStart=/etc/init.d/jenkins start (code=exited, status=1/FAILURE)

Apr 25 04:34:58 ip-172-31-37-237 systemd[1]: Starting LSB: Start Jenkins at boot time...
Apr 25 04:34:58 ip-172-31-37-237 jenkins[2650]: Found an incorrect Java version
Apr 25 04:34:58 ip-172-31-37-237 jenkins[2650]: Java version found:
Apr 25 04:34:58 ip-172-31-37-237 jenkins[2650]: openjdk version "11.0.2" 2019-01-15
Apr 25 04:34:58 ip-172-31-37-237 jenkins[2650]: OpenJDK Runtime Environment (build 11.0.2+9-Ubuntu-3ubuntu118.04.3)
Apr 25 04:34:58 ip-172-31-37-237 jenkins[2650]: OpenJDK 64-Bit Server VM (build 11.0.2+9-Ubuntu-3ubuntu118.04.3, mixed mode, sharing)
Apr 25 04:34:58 ip-172-31-37-237 jenkins[2650]: Aborting
Apr 25 04:34:58 ip-172-31-37-237 systemd[1]: jenkins.service: Control process exited, code=exited status=1
Apr 25 04:34:58 ip-172-31-37-237 systemd[1]: jenkins.service: Failed with result 'exit-code'.
Apr 25 04:34:58 ip-172-31-37-237 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
Processing triggers for ureadahead (0.100.0-20) ...
Processing triggers for systemd (237-3ubuntu10.19) ...
Errors were encountered while processing:
jenkins
E: Sub-process /usr/bin/dpkg returned an error code (1)
root@ip-172-31-37-237:# echo $JAVA_HOME
/usr/lib/jvm/java-11-openjdk-amd64/bin/
root@ip-172-31-37-237:
#

Regards,

i think you have installed openjdk-default (11) instead of openjdk -8
if possible try out with following commands , first install java-8

sudo apt-get update
sudo apt install openjdk-8-jdk -y
sudo vi /etc/environment (and following line in it)
JAVA_HOME="/usr/lib/jvm/java-8-openjdk-amd64/" (save this and exit from editor)
source /etc/environment

now install jenkins

sudo wget -q -O - https://pkg.jenkins.io/debian/jenkins-ci.org.key | sudo apt-key add -
sudo sh -c 'echo deb http://pkg.jenkins.io/debian-stable binary/ > /etc/apt/sources.list.d/jenkins.list'
sudo apt-get update
sudo apt-get install jenkins=2.138.3 -y

later open the web portal (make sure that you have enabled port 8080 as jenkins works in this port) and in url type "ip_address(public ip address of your environment ):8080 and
paste the authenticated code there from the location that it has mentioned and then select standard plugin and finally create your credentials

from next time please raise your issue in following link click here
this is not the right place to raise your issues
thanks