skip to Main Content

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


  1. 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"

    Login or Signup to reply.
  2. 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/

    Login or Signup to reply.
  3. 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:

    $ sudo apt-get install openjdk-11-jdk-headless
    $ curl -fsSL https://pkg.jenkins.io/debian/jenkins.io.key | sudo tee /usr/share/keyrings/jenkins-keyring.asc > /dev/null
    $ echo deb [signed-by=/usr/share/keyrings/jenkins-keyring.asc] https://pkg.jenkins.io/debian binary/ | sudo tee /etc/apt/sources.list.d/jenkins.list > /dev/null
    $ sudo apt-get update
    $ sudo apt-get install jenkins
    

    Then it failed with:

    ...
    ● jenkins.service - Jenkins Continuous Integration Server
         Loaded: loaded (/lib/systemd/system/jenkins.service; enabled; preset: enabled)
         Active: activating (auto-restart) (Result: exit-code) since Wed 2023-01-25 21:37:10 AEDT; 6ms ago
        Process: 11589 ExecStart=/usr/bin/jenkins (code=exited, status=1/FAILURE)
       Main PID: 11589 (code=exited, status=1/FAILURE)
            CPU: 3.818s
    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)
    behai@HP-Pavilion-15:~$
    

    Googling did not give me any answer. So willy-nilly, I tried:

    /usr/bin/jenkins
    

    The output was long, I just repost the relevant ones:

    ...
    java.io.IOException: Failed to start Jetty
    ...
    Caused by: java.io.IOException: Failed to bind to 0.0.0.0/0.0.0.0:8080
    Caused by: java.net.BindException: Address already in use
    ...
    java.net.BindException: Address already in use
    ...
    Caused: java.io.IOException: Failed to bind to 0.0.0.0/0.0.0.0:8080
    Caused: java.io.IOException: Failed to start Jetty
    ...
    

    I had forgotten that I have set port 8080 for Apache2. I just stopped and disabled Apache2, and start Jenkins with:

    $ systemctl start jenkins.service
    

    It is now running. I hope this helps a little, although it might not be your case.

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search