Common Problems During Jenkins Installation and How to Resolve Them

Common Problems During Jenkins Installation and How to Resolve Them

Running sudo systemctl status jenkins shows:

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

This often happens when the port Jenkins is configured to use (default: 8080) is already in use.

  1. Check which process is using the port:

     sudo lsof -i :8080
    
  2. If another application is using the port, either stop that application:

     sudo kill -9 <PID>
    

    Or change Jenkins’ port in the configuration file:

     sudo nano /etc/default/jenkins
    

    Modify the line:

     HTTP_PORT=8081
    

    Then restart Jenkins:

     sudo systemctl restart jenkins
    

Logs show errors like:

java.io.IOException: Unsupported major.minor version

Jenkins requires Java 8 or 11, but an unsupported version might be installed.

  1. Check the Java version:

     java -version
    
  2. If it's unsupported, install OpenJDK 11:

     sudo apt install openjdk-11-jdk -y
    
  3. Update the default Java version:

     sudo update-alternatives --config java
    

You see the following message when accessing Jenkins in the browser:

Authentication required

Jenkins requires an admin password for initial setup.

Retrieve the password from the file:

sudo cat /var/lib/jenkins/secrets/initialAdminPassword

Use this password on the web interface.


Jenkins fails to start, or journalctl logs show conflicting configurations.

Jenkins was installed multiple times, leading to duplicate services or port conflicts.

  1. Identify the installed Jenkins packages:

     sudo apt list --installed | grep jenkins
    
  2. Remove unnecessary installations:

     sudo apt remove --purge jenkins
    
  3. Ensure only one Jenkins service is running:

     ps aux | grep jenkins
    

    Kill any redundant processes:

     sudo kill -9 <PID>
    

Plugins fail to install, or Jenkins crashes during plugin installation.

Network issues or insufficient permissions.

  1. Restart Jenkins:

     sudo systemctl restart jenkins
    
  2. Install plugins manually via the Jenkins web interface:

    • Go to Manage Jenkins > Plugin Manager > Available.

    • Select and install required plugins.