サイトアイコン TakeNotes.JP

JenkinsのアップデートでAn error occurred during the signature verificationが出た

ウチのUbuntu 22.04のサーバで以下のエラーメッセージが出ました。

An error occurred during the signature verification. The repository is not updated and the previous index files will be used. GPG error: https://pkg.jenkins.io/debian-stable binary/ Release: The following signatures couldn't be verified because the public key is not available: NO_PUBKEY 5BA31D57EF5975CA

具体的には以下の通り。

$ sudo apt-get update -y && sudo apt-get upgrade -y
Hit:1 https://aquasecurity.github.io/trivy-repo/deb jammy InRelease
Hit:2 https://download.docker.com/linux/ubuntu jammy InRelease
Ign:3 https://pkg.jenkins.io/debian-stable binary/ InRelease
Get:4 https://pkg.jenkins.io/debian-stable binary/ Release [2044 B]
Get:5 https://pkg.jenkins.io/debian-stable binary/ Release.gpg [833 B]
Hit:6 https://packages.cloud.google.com/apt cloud-sdk InRelease
Err:5 https://pkg.jenkins.io/debian-stable binary/ Release.gpg
  The following signatures couldn't be verified because the public key is not available: NO_PUBKEY 5BA31D57EF5975CA
Hit:7 https://packages.cloud.google.com/apt kubernetes-xenial InRelease            
Hit:8 http://jp.archive.ubuntu.com/ubuntu jammy InRelease
Get:9 http://jp.archive.ubuntu.com/ubuntu jammy-updates InRelease [119 kB]
Get:10 http://jp.archive.ubuntu.com/ubuntu jammy-backports InRelease [108 kB]
Get:11 http://jp.archive.ubuntu.com/ubuntu jammy-security InRelease [110 kB]
Fetched 338 kB in 3s (121 kB/s)   
Reading package lists... Done
W: An error occurred during the signature verification. The repository is not updated and the previous index files will be used. GPG error: https://pkg.jenkins.io/debian-stable binary/ Release: The following signatures couldn't be verified because the public key is not available: NO_PUBKEY 5BA31D57EF5975CA
W: Failed to fetch https://pkg.jenkins.io/debian-stable/binary/Release.gpg  The following signatures couldn't be verified because the public key is not available: NO_PUBKEY 5BA31D57EF5975CA
W: Some index files failed to download. They have been ignored, or old ones used instead.
Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
Calculating upgrade... Done
The following packages have been kept back:
  cloud-init docker-ce-cli libgl1-mesa-dri libglapi-mesa libglx-mesa0 mesa-vulkan-drivers
0 upgraded, 0 newly installed, 0 to remove and 6 not upgraded.

Jenkins Debian Packagesにもリンクが貼られているJenkins 2.397 and 2.387.2: New Linux Repository Signing Keysに詳細が書かれています。

最新のリポジトリの署名鍵を更新すれば解決できました。

$ 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

 

モバイルバージョンを終了