Not able to install jenkins on VM ubuntu 22.04

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 Thu 2023-06-22 02:57:10 EDT; 47ms ago
Process: 65218 ExecStart=/usr/bin/jenkins (code=exited, status=1/FAILURE)
Main PID: 65218 (code=exited, status=1/FAILURE)
CPU: 7.934s

Jun 22 02:57:11 osboxes systemd[1]: jenkins.service: Scheduled restart job, restart counter is at 1.
Jun 22 02:57:11 osboxes systemd[1]: Stopped Jenkins Continuous Integration Server.
Jun 22 02:57:11 osboxes systemd[1]: jenkins.service: Consumed 7.934s CPU time.
Jun 22 02:57:11 osboxes systemd[1]: Starting Jenkins Continuous Integration Server…
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)

Hi @prashant1991yadav, !

How did you install Jenkins ??

I followed below steps to install jenkins

  1. sudo apt update
  2. sudo apt install openjdk-11-jdk -y
  3. curl -fsSL https://pkg.jenkins.io/debian-stable/jenkins.io.key | sudo tee /usr/share/keyrings/jenkins-keyring.asc > /dev/null
  4. echo deb [signed-by=/usr/share/keyrings/jenkins-keyring.asc] Debian Jenkins Packages binary/ | sudo tee /etc/apt/sources.list.d/jenkins.list > /dev/null
  5. sudo apt update
  6. sudo apt install jenkins -y

Hey, there was a change beginning March 28, 2023. Jenkins use new repository signing keys for the Linux installation packages.

Please refer to Jenkins 2.397 and 2.387.2: New Linux Repository Signing Keys
And try again.

Using below also not solving problem

curl -fsSL https://pkg.jenkins.io/debian-stable/jenkins.io-2023.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-stable binary/ | sudo tee \
  /etc/apt/sources.list.d/jenkins.list > /dev/null

Still getting below errors

● jenkins.service - Jenkins Continuous Integration Server
Loaded: loaded (/lib/systemd/system/jenkins.service; enabled; vendor preset: enabled)
Active: activating (auto-restart) (Result: timeout) since Thu 2023-06-22 23:13:27 EDT; 520ms ago
Process: 10824 ExecStart=/usr/bin/jenkins (code=exited, status=143)
Main PID: 10824 (code=exited, status=143)
CPU: 32.213s

Jun 22 23:13:27 osboxes systemd[1]: Failed to start Jenkins Continuous Integration Server.
Jun 22 23:13:27 osboxes systemd[1]: jenkins.service: Consumed 32.213s CPU time.
Jun 22 23:13:27 osboxes systemd[1]: jenkins.service: Scheduled restart job, restart counter is at 1.
Jun 22 23:13:27 osboxes systemd[1]: Stopped Jenkins Continuous Integration Server.
Jun 22 23:13:27 osboxes systemd[1]: jenkins.service: Consumed 32.213s CPU time.
Jun 22 23:13:27 osboxes systemd[1]: Starting 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.10.2-1) …
Errors were encountered while processing:
jenkins
E: Sub-process /usr/bin/dpkg returned an error code (1)

Hi @prashant1991yadav,
Can you please uninstall the jenkins and install back?

I already did it many times