Installing Jenkins Failed on Ubuntu Jammy

I followed the steps here: Linux

Issue looks to be with :
The repository ‘Debian Jenkins Packages binary/ Release’ is not signed.
This is what my output looks like :

--2024-07-16 09:21:15--  https://pkg.jenkins.io/debian-stable/jenkins.io-2023.key
Resolving pkg.jenkins.io (pkg.jenkins.io)... 146.75.34.133, 2a04:4e42:78::645
Connecting to pkg.jenkins.io (pkg.jenkins.io)|146.75.34.133|:443... connected.
HTTP request sent, awaiting response... 200 OK
Length: 3175 (3.1K) [application/pgp-keys]
Saving to: ‘/usr/share/keyrings/jenkins-keyring.asc’

/usr/share/keyrings/jenkins-keyring.asc                   100%[====================================================================================================================================>]   3.10K  --.-KB/s    in 0s

2024-07-16 09:21:15 (34.5 MB/s) - ‘/usr/share/keyrings/jenkins-keyring.asc’ saved [3175/3175]

Hit:1 https://ubuntu-dev.corp.akamai.com/ubuntu/prod jammy InRelease
Hit:2 https://ubuntu-dev.corp.akamai.com/ubuntu/prod jammy-updates InRelease
Hit:3 https://ubuntu-dev.corp.akamai.com/ubuntu/prod jammy-security InRelease
Hit:4 https://ubuntu-dev.corp.akamai.com/akamai/prod jammy InRelease
Hit:5 https://ubuntu-dev.corp.akamai.com/canonical/esm/ubuntu jammy-apps-updates InRelease
Hit:6 https://ubuntu-dev.corp.akamai.com/canonical/esm/ubuntu jammy-apps-security InRelease
Ign:7 https://pkg.jenkins.io/debian-stable binary/ InRelease
Get:8 https://pkg.jenkins.io/debian-stable binary/ Release [2,044 B]
Get:9 https://pkg.jenkins.io/debian-stable binary/ Release.gpg [833 B]
Ign:9 https://pkg.jenkins.io/debian-stable binary/ Release.gpg
Reading package lists... Done
W: https://ubuntu-dev.corp.akamai.com/ubuntu/prod/dists/jammy/InRelease: Key is stored in legacy trusted.gpg keyring (/etc/apt/trusted.gpg), see the DEPRECATION section in apt-key(8) for details.
W: https://ubuntu-dev.corp.akamai.com/ubuntu/prod/dists/jammy-updates/InRelease: Key is stored in legacy trusted.gpg keyring (/etc/apt/trusted.gpg), see the DEPRECATION section in apt-key(8) for details.
W: https://ubuntu-dev.corp.akamai.com/ubuntu/prod/dists/jammy-security/InRelease: Key is stored in legacy trusted.gpg keyring (/etc/apt/trusted.gpg), see the DEPRECATION section in apt-key(8) for details.
W: https://ubuntu-dev.corp.akamai.com/akamai/prod/dists/jammy/InRelease: Key is stored in legacy trusted.gpg keyring (/etc/apt/trusted.gpg), see the DEPRECATION section in apt-key(8) for details.
W: https://ubuntu-dev.corp.akamai.com/canonical/esm/ubuntu/dists/jammy-apps-updates/InRelease: Key is stored in legacy trusted.gpg keyring (/etc/apt/trusted.gpg), see the DEPRECATION section in apt-key(8) for details.
W: https://ubuntu-dev.corp.akamai.com/canonical/esm/ubuntu/dists/jammy-apps-security/InRelease: Key is stored in legacy trusted.gpg keyring (/etc/apt/trusted.gpg), see the DEPRECATION section in apt-key(8) for details.
W: GPG error: https://pkg.jenkins.io/debian-stable binary/ Release: Unknown error executing apt-key
E: The repository 'https://pkg.jenkins.io/debian-stable binary/ Release' is not signed.
N: Updating from such a repository can't be done securely, and is therefore disabled by default.
N: See apt-secure(8) manpage for repository creation and user configuration details.
Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
Package jenkins is not available, but is referred to by another package.
This may mean that the package is missing, has been obsoleted, or
is only available from another source

E: Package 'jenkins' has no installation candidate

The packages in that repository are signed correctly. I suspect something is outdated or incorrect on your local installation.

I’m unable to duplicate the failure. I used Google Cloud to install a fresh copy of Ubuntu 22.04, installed OpenJDK 17 with the command apt install openjdk-17-jre-headless and then pasted the instructions from the install page. The installation worked as expected.

The Ubuntu 22.04 that I’m running on Google Cloud includes the following in /etc/os-release:

PRETTY_NAME="Ubuntu 22.04.4 LTS"
NAME="Ubuntu"
VERSION_ID="22.04"
VERSION="22.04.4 LTS (Jammy Jellyfish)"
VERSION_CODENAME=jammy
ID=ubuntu

Maybe the Ubuntu 22.04 that you are running has not been updated to the most recent patch release (22.04.4)? You may be able to perform that update with the commands:

# apt-get update
# apt-get dist-upgrade

Thanks Mark, for the prompt response. I figured that out.
The host is using old legacy trusted.gpg keyring (/etc/apt/trusted.gpg) instead of /usr/share/keyring

I moved jenkins-keyring.asc from /usr/share/keyrings/jenkins-keyring.asc’ to /etc/apt/trusted.gpg.d.

Along with this I also update the jenkins.list to use the path to trusted gpg

This might not be the best solution but did the trick for me

I think that you should document that workaround very carefully on that computer. Others will be surprised that you used a non-standard technique to make the installation work.

I think that workaround is a mistake because it may surprise others when they attempt to update. Much better to update the operating system to use current packages.