I am attempting to start and getting the following error
root@ip-172-31-80-112 ~]# systemctl start jenkins
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-80-112 ~]# systemctl status jenkins
● jenkins.service - Jenkins Continuous Integration Server
Loaded: loaded (/usr/lib/systemd/system/jenkins.service; enabled; vendor preset: disabled)
Active: failed (Result: start-limit) since Mon 2022-10-03 10:51:06 UTC; 31s ago
Process: 21705 ExecStart=/usr/bin/jenkins (code=exited, status=1/FAILURE)
Main PID: 21705 (code=exited, status=1/FAILURE)
Oct 03 10:51:05 ip-172-31-80-112.ec2.internal systemd[1]: jenkins.service: main process exited, code=exited, status=1/FAILURE
Oct 03 10:51:05 ip-172-31-80-112.ec2.internal systemd[1]: Failed to start Jenkins Continuous Integration Server.
Oct 03 10:51:05 ip-172-31-80-112.ec2.internal systemd[1]: Unit jenkins.service entered failed state.
Oct 03 10:51:05 ip-172-31-80-112.ec2.internal systemd[1]: jenkins.service failed.
Oct 03 10:51:06 ip-172-31-80-112.ec2.internal systemd[1]: jenkins.service holdoff time over, scheduling restart.
Oct 03 10:51:06 ip-172-31-80-112.ec2.internal systemd[1]: Stopped Jenkins Continuous Integration Server.
Oct 03 10:51:06 ip-172-31-80-112.ec2.internal systemd[1]: start request repeated too quickly for jenkins.service
Oct 03 10:51:06 ip-172-31-80-112.ec2.internal systemd[1]: Failed to start Jenkins Continuous Integration Server.
Oct 03 10:51:06 ip-172-31-80-112.ec2.internal systemd[1]: Unit jenkins.service entered failed state.
Oct 03 10:51:06 ip-172-31-80-112.ec2.internal systemd[1]: jenkins.service failed.
[root@ip-172-31-80-112 ~]#
this is in my /etc/init.d/jenkins
# Search usable Java as /usr/bin/java might not point to minimal version required by Jenkins.
# see http://www.nabble.com/guinea-pigs-wanted-----Hudson-RPM-for-RedHat-Linux-td25673707.html
candidates="
/etc/alternatives/java
/usr/lib/jvm/java-1.8.0/bin/java
/usr/lib/jvm/jre-1.8.0/bin/java
/usr/lib/jvm/java-11.0/bin/java
/usr/lib/jvm/jre-11.0/bin/java
/usr/lib/jvm/java-11-openjdk-amd64
/usr/bin/java
/usr/lib/jvm/java-1.8.0-openjdk-1.8.0.342.b07-1.amzn2.0.1.x86_64
I have java installed as can be seen from the java version below
[root@ip-172-31-80-112 ~]# java -version
openjdk version "1.8.0_342"
enter code hereenter code here`OpenJDK Runtime Environment (build 1.8.0_342-b07)
OpenJDK 64-Bit Server VM (build 25.342-b07, mixed mode)
below is my bash profile showing my JAVA_HOME variable
[root@ip-172-31-80-112 ~]# cat .bash_profile
# .bash_profile
# Get the aliases and functions
if [ -f ~/.bashrc ]; then
. ~/.bashrc
fi
# User specific environment and startup programs
JAVA_HOME=/usr/lib/jvm/java-1.8.0-openjdk-1.8.0.342.b07-1.amzn2.0.1.x86_64
MAVEN_HOME=/opt/apache-maven-3.8.6
M2=/opt/apache-maven-3.8.6
PATH=$PATH:$HOME/bin:$JAVA_HOME:MAVEN_HOME:$M2
can anyone help me with this issue. Thank you in advance. It looks to be some issue with Jenkins not being able to find my java version on my server, possibly some link pointing to the wrong location
3
Answers
It seems like you have multiple java versions available on your machine. Can you update correct version by simply running sudo update-alternatives –config java to avoid jenkins and java version mismatch?
See also: Jenkins fails when running "service start jenkins"
The error is not super clear depending on Jenkins version but make sure Jenkins>=2.357 is using the Java 11 install, not the Java 8 install.
https://www.jenkins.io/blog/2022/06/28/require-java-11/
I have just solved mine, which was similar to the question of this post.
Just a bit of background story: I tried installing Jenkins on my Ubuntu 22.10 three (3) times, all went smoothly. But all failed to start.
The last installation instruction I have used is from this link: https://community.jenkins.io/t/ubuntu-20-04-initial-jenkins-startup-failure/1419
— The answer by Mr. Mark Waite — Jenkins Governance Board.
Basically:
Then it failed with:
Googling did not give me any answer. So willy-nilly, I tried:
The output was long, I just repost the relevant ones:
I had forgotten that I have set port 8080 for Apache2. I just stopped and disabled Apache2, and start Jenkins with:
It is now running. I hope this helps a little, although it might not be your case.