![apt-get update:签名验证时发生错误](https://linux22.com/image/1600012/apt-get%20update%EF%BC%9A%E7%AD%BE%E5%90%8D%E9%AA%8C%E8%AF%81%E6%97%B6%E5%8F%91%E7%94%9F%E9%94%99%E8%AF%AF.png)
Hit:1 http:/ubuntu.melbourneitmirror.net/archive bionic InRelease
Hit:2 http:/ubuntu.melbourneitmirror.net/archive bionic-updates InRelease
Hit:3 http:/ubuntu.melbourneitmirror.net/archive bionic-backports
InRelease
Hit:4 http:/ubuntu.melbourneitmirror.net/archive bionic-security InRelease
Ign:5 http:/dl.google.com/linux/chrome/deb stable InRelease
Hit:7 http:/dl.google.com/linux/chrome/deb stable Release
Get:6 http:/repo.ros2.org/ubuntu/main bionic InRelease [3,209 B]
Err:6 http:/repo.ros2.org/ubuntu/main bionic InRelease
The following signatures couldn't be verified because the public key is not available: NO_PUBKEY F42ED6FBAB17C654
Get:9 http:/packages.ros.org/ros/ubuntu bionic InRelease [4,669 B]
Err:9 http:/packages.ros.org/ros/ubuntu bionic InRelease
The following signatures couldn't be verified because the public key is not available: NO_PUBKEY F42ED6FBAB17C654
Fetched 7,878 B in 1s (6,188 B/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: http:/repo.ros2.org/ubuntu/main bionic InRelease: The following signatures couldn't be verified because the public key is not available: NO_PUBKEY F42ED6FBAB17C654
W: An error occurred during the signature verification. The repository is not updated and the previous index files will be used. GPG error: http:/packages.ros.org/ros/ubuntu bionic InRelease: The following signatures couldn't be verified because the public key is not available: NO_PUBKEY F42ED6FBAB17C654
W: Failed to fetch http:/packages.ros.org/ros/ubuntu/dists/bionic/InRelease The following signatures couldn't be verified because the public key is not available: NO_PUBKEY F42ED6FBAB17C654
W: Failed to fetch http:/repo.ros2.org/ubuntu/main/dists/bionic/InRelease The following signatures couldn't be verified because the public key is not available: NO_PUBKEY F42ED6FBAB17C654
W: Some index files failed to download. They have been ignored, or old ones used instead.
我该如何解决这个问题?请注意,我对 Linux 还很陌生。
感谢您的时间
答案1
您缺少 ros2 存储库的 GPG 签名密钥。
您可以使用以下命令添加它:
curl http://repo.ros2.org/repos.key | sudo apt-key add -
之后再次运行以下命令:
apt-get update
您已准备好出发了。
答案2
如果有人发现此页面试图解决以下问题,类似于 OP:
Get:5 https://packages.cloud.google.com/apt kubernetes-xenial InRelease [8993 B]
Err:5 https://packages.cloud.google.com/apt kubernetes-xenial InRelease
The following signatures couldn't be verified because the public key is not available: NO_PUBKEY B53DC80D13EDEF05
原因似乎是google.comURL 不再托管密钥。根据k8s.io git repo 中的此评论该密钥可从以下 URL“暂时”获取:
因此,可以使用以下方法更新公钥:
sudo curl -fsSLo /usr/share/keyrings/kubernetes-archive-keyring.gpg https://dl.k8s.io/apt/doc/apt-key.gpg