Uploaded image for project: 'Jenkins'
  1. Jenkins
  2. JENKINS-68384

Jenkins not starting on clean Ubuntu 22.04 and 20.04 installs

    • Icon: Bug Bug
    • Resolution: Duplicate
    • Icon: Major Major
    • core
    • None
    • Ubuntu Server 20.04 and Ubuntu Server 22.04

      I installed a clean Ubuntu Server 22.04 and followed the instructions to install Jenkins, and I see the following:

       

      ```

      hackeron@tetherjenkins:~$ curl -fsSL https://pkg.jenkins.io/debian-stable/jenkins.io.key | sudo tee \
      >   /usr/share/keyrings/jenkins-keyring.asc > /dev/null
      [sudo] password for hackeron:
      hackeron@tetherjenkins:~$ echo deb [signed-by=/usr/share/keyrings/jenkins-keyring.asc] \
      >   https://pkg.jenkins.io/debian-stable binary/ | sudo tee \
      >   /etc/apt/sources.list.d/jenkins.list > /dev/null
      hackeron@tetherjenkins:~$ sudo apt-get update
      Hit:1 http://gb.archive.ubuntu.com/ubuntu focal InRelease
      Get:2 http://gb.archive.ubuntu.com/ubuntu focal-updates InRelease [114 kB]
      Ign:3 https://pkg.jenkins.io/debian-stable binary/ InRelease
      Get:4 https://pkg.jenkins.io/debian-stable binary/ Release [2,044 B]
      Get:5 https://pkg.jenkins.io/debian-stable binary/ Release.gpg [833 B]
      Get:6 http://gb.archive.ubuntu.com/ubuntu focal-backports InRelease [108 kB]
      Get:7 http://gb.archive.ubuntu.com/ubuntu focal-security InRelease [114 kB]
      Get:8 http://gb.archive.ubuntu.com/ubuntu focal/main Translation-en_GB [485 kB]
      Get:9 http://gb.archive.ubuntu.com/ubuntu focal/restricted Translation-en_GB [3,860 B]
      Get:10 http://gb.archive.ubuntu.com/ubuntu focal/universe Translation-en_GB [319 kB]
      Get:11 http://gb.archive.ubuntu.com/ubuntu focal/multiverse Translation-en_GB [105 kB]
      0% [8 Translation-en_GB store 0 B]
      Get:12 http://gb.archive.ubuntu.com/ubuntu focal-updates/main amd64 Packages [1,750 kB]
      Get:13 http://gb.archive.ubuntu.com/ubuntu focal-updates/universe amd64 Packages [920 kB]
      Get:14 https://pkg.jenkins.io/debian-stable binary/ Packages [21.8 kB]
      Get:15 http://gb.archive.ubuntu.com/ubuntu focal-security/main amd64 Packages [1,422 kB]
      Get:16 http://gb.archive.ubuntu.com/ubuntu focal-security/universe amd64 Packages [700 kB]
      Fetched 6,065 kB in 1s (5,299 kB/s)
      Reading package lists... Done
      hackeron@tetherjenkins:~$
      hackeron@tetherjenkins:~$ sudo apt-get install jenkins
      Reading package lists... Done
      Building dependency tree
      Reading state information... Done

      The following additional packages will be installed:
        net-tools
      The following NEW packages will be installed:
        jenkins net-tools
      0 upgraded, 2 newly installed, 0 to remove and 28 not upgraded.
      Need to get 91.5 MB of archives.
      After this operation, 95.9 MB of additional disk space will be used.
      Get:1 http://gb.archive.ubuntu.com/ubuntu focal/main amd64 net-tools amd64 1.60+git20180626.aebd88e-1ubuntu1 [196 kB]
      Get:2 https://pkg.jenkins.io/debian-stable binary/ jenkins 2.332.2 [91.4 MB]
      Fetched 91.5 MB in 5s (20.2 MB/s)
      Selecting previously unselected package net-tools.
      (Reading database ... 71807 files and directories currently installed.)
      Preparing to unpack .../net-tools_1.60+git20180626.aebd88e-1ubuntu1_amd64.deb ...
      Unpacking net-tools (1.60+git20180626.aebd88e-1ubuntu1) ...
      Selecting previously unselected package jenkins.
      Preparing to unpack .../jenkins_2.332.2_all.deb ...
      Unpacking jenkins (2.332.2) ...
      Setting up net-tools (1.60+git20180626.aebd88e-1ubuntu1) ...
      Setting up jenkins (2.332.2) ...
      Created symlink /etc/systemd/system/multi-user.target.wants/jenkins.service → /lib/systemd/system/jenkins.service.
      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 - Jenkins Continuous Integration Server
           Loaded: loaded (/lib/systemd/system/jenkins.service; enabled; vendor preset: enabled)
           Active: activating (auto-restart) (Result: exit-code) since Mon 2022-05-02 18:46:47 UTC; 4ms ago
          Process: 2398 ExecStart=/usr/bin/jenkins (code=exited, status=1/FAILURE)
         Main PID: 2398 (code=exited, status=1/FAILURE)

      May 02 18:46:47 tetherjenkins systemd[1]: jenkins.service: Main process exited, code=exited, status=1/FAILURE
      May 02 18:46:47 tetherjenkins systemd[1]: jenkins.service: Failed with result 'exit-code'.
      May 02 18:46:47 tetherjenkins systemd[1]: Failed to start Jenkins Continuous Integration Server.
      dpkg: error processing package jenkins (--configure):
       installed jenkins package post-installation script subprocess returned error exit status 1
      Processing triggers for man-db (2.9.1-1) ...
      Processing triggers for systemd (245.4-4ubuntu3.15) ...
      Errors were encountered while processing:
       jenkins
      E: Sub-process /usr/bin/dpkg returned an error code (1)

      ```

       

      I tried also installing 20.04 and got the same results.

       

      There are no useful logs in journalctl or in /var/log/jenkins:

       

      ```

      hackeron@tetherjenkins:~$ journalctl -u jenkins -f
      – Logs begin at Mon 2022-05-02 18:45:52 UTC. –
      May 02 18:46:49 tetherjenkins systemd[1]: Starting Jenkins Continuous Integration Server...
      May 02 18:46:49 tetherjenkins jenkins[2822]: jenkins: failed to find a valid Java installation
      May 02 18:46:49 tetherjenkins systemd[1]: jenkins.service: Main process exited, code=exited, status=1/FAILURE
      May 02 18:46:49 tetherjenkins systemd[1]: jenkins.service: Failed with result 'exit-code'.
      May 02 18:46:49 tetherjenkins systemd[1]: Failed to start Jenkins Continuous Integration Server.
      May 02 18:46:49 tetherjenkins systemd[1]: jenkins.service: Scheduled restart job, restart counter is at 8.
      May 02 18:46:49 tetherjenkins systemd[1]: Stopped Jenkins Continuous Integration Server.
      May 02 18:46:49 tetherjenkins systemd[1]: jenkins.service: Start request repeated too quickly.
      May 02 18:46:49 tetherjenkins systemd[1]: jenkins.service: Failed with result 'exit-code'.
      May 02 18:46:49 tetherjenkins systemd[1]: Failed to start Jenkins Continuous Integration Server.

      hackeron@tetherjenkins:~$ ls /var/log/jenkins/
      hackeron@tetherjenkins:~$

      ```

      Expected result would be for Jenkins to start on a clean Ubuntu Server install or to at least get some log information for next steps.

          [JENKINS-68384] Jenkins not starting on clean Ubuntu 22.04 and 20.04 installs

          Roman Gaufman created issue -

          Markus Winter added a comment -

           

          May 02 18:46:49 tetherjenkins jenkins[2822]: jenkins: failed to find a valid Java installation

           

          Is java installed?

          If yes maybe /usr/bin/java is missing?

           

          Markus Winter added a comment -   May 02 18:46:49 tetherjenkins jenkins[2822]: jenkins: failed to find a valid Java installation   Is java installed? If yes maybe /usr/bin/java is missing?  

          Mark Waite added a comment - - edited

          I think that mawinter69 has described it correctly. You'll need to install Java and assure it is available in the path for the Jenkins service unit.

          The installation guide for Linux notes that the user must install Java themselves.

          Jenkins requires Java in order to run, yet certain distributions don’t include this by default and some Java versions are incompatible with Jenkins.

          This is done so that users can choose their preferred Java installation. The Jenkins project uses Eclipse Temurin in our Docker images. We know that there are Jenkins users running Amazon Corretto, others running the OpenJDK distribution that is available with Red Hat Enterprise Linux and its derivatives, and still others running the OpenJDK distribution available with Ubuntu and with Debian.

          Mark Waite added a comment - - edited I think that mawinter69 has described it correctly. You'll need to install Java and assure it is available in the path for the Jenkins service unit. The installation guide for Linux notes that the user must install Java themselves. Jenkins requires Java in order to run, yet certain distributions don’t include this by default and some Java versions are incompatible with Jenkins. This is done so that users can choose their preferred Java installation. The Jenkins project uses Eclipse Temurin in our Docker images. We know that there are Jenkins users running Amazon Corretto, others running the OpenJDK distribution that is available with Red Hat Enterprise Linux and its derivatives, and still others running the OpenJDK distribution available with Ubuntu and with Debian.

          Roman Gaufman added a comment - - edited

          Ah, it seems the package should depend on Java, but it doesn’t? Isn’t this a bug? Shouldn’t it show something, somewhere? Also in the installation guide?

          I ultimately ended up using GitHub Self Hosted Workers but it would be nice to fix/improve this for a better experience for new users, just my 2 cents.

          Roman Gaufman added a comment - - edited Ah, it seems the package should depend on Java, but it doesn’t? Isn’t this a bug? Shouldn’t it show something, somewhere? Also in the installation guide? I ultimately ended up using GitHub Self Hosted Workers but it would be nice to fix/improve this for a better experience for new users, just my 2 cents.

          Mark Waite added a comment -

          Thanks for the feedback. The installation guide for Linux says that Java is required. The service output says that Java was not found.

          The original reason for no operating system level dependency on Java was related to packaging issues on older Linux operating systems. I don't know that anyone has done the checks on newer operating system versions and packages to decide if it would help to declare a Java dependency. I suspect that there are many users that prefer to install their own preferred Java (Eclipse Temurin, Azul Systems Zulu, Amazon Corretto, etc.) and they might prefer to not need to also install an operating system provided Java package just to satisfy the dependency.

          Mark Waite added a comment - Thanks for the feedback. The installation guide for Linux says that Java is required. The service output says that Java was not found. The original reason for no operating system level dependency on Java was related to packaging issues on older Linux operating systems. I don't know that anyone has done the checks on newer operating system versions and packages to decide if it would help to declare a Java dependency. I suspect that there are many users that prefer to install their own preferred Java (Eclipse Temurin, Azul Systems Zulu, Amazon Corretto, etc.) and they might prefer to not need to also install an operating system provided Java package just to satisfy the dependency.

          Basil Crow added a comment -

          Duplicates JENKINS-52583.

          Basil Crow added a comment - Duplicates JENKINS-52583 .
          Basil Crow made changes -
          Link New: This issue duplicates JENKINS-52583 [ JENKINS-52583 ]
          Basil Crow made changes -
          Resolution New: Duplicate [ 3 ]
          Status Original: Open [ 1 ] New: Closed [ 6 ]

            Unassigned Unassigned
            hackeron Roman Gaufman
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

              Created:
              Updated:
              Resolved: