如何修复更新程序中的GPG问题

我之前问过这个问题,但是被关闭了,说是“重复”。我可以向您保证,我的情况是独特的,因为它不涉及第三方PPA。我在系统更新中遇到了GPG问题。它显示没有可用的公钥,并且我还收到了更新信息已过时的警告。以下是终端文本:
W: A error occurred during the signature verification.
The repository is not updated and the previous index files will be used. GPG error:http://extras.ubuntu.com quantal Release: 
The following signatures couldn't be verified because the public key is not available: NO_PUBKEY 16126D3A3E5C1192

W: GPG error: http:// archive.canonical.com quantal Release: The following signatures couldn't be verified because the public key is not available: NO_PUBKEY 40976EAF437D05B5 NO_PUBKEY 3B4FE6ACC0B21F32
W: GPG error: http:// us.archive.ubuntu.com quantal Release: The following signatures couldn't be verified because the public key is not available: NO_PUBKEY 40976EAF437D05B5 NO_PUBKEY 3B4FE6ACC0B21F32
W: GPG error: http:// us.archive.ubuntu.com quantal-updates Release: The following signatures couldn't be verified because the public key is not available: NO_PUBKEY 40976EAF437D05B5 NO_PUBKEY 3B4FE6ACC0B21F32
W: GPG error: http:// us.archive.ubuntu.com quantal-backports Release: The following signatures couldn't be verified because the public key is not available: NO_PUBKEY 40976EAF437D05B5 NO_PUBKEY 3B4FE6ACC0B21F32
W: GPG error: http:// us.archive.ubuntu.com quantal-security Release: The following signatures couldn't be verified because the public key is not available: NO_PUBKEY 40976EAF437D05B5 NO_PUBKEY 3B4FE6ACC0B21F32
W: Failed to fetch http:// extras.ubuntu.com/ubuntu/dists/quantal/Release

W: Some index files failed to download. They have been ignored, or old ones used instead.

我在URL中加入了空格,因为新用户每个问题只允许有两个超链接。
请不要将此关闭为重复问题。它并不涉及第三方PPA,而是指Canonical发布的标准更新包。

你可以查看这个SO thread来找到解决方案。还有一个相关网站的链接。 - Aniket Thakur
1个回答

在终端中运行以下命令:
sudo apt-key adv --recv-keys --keyserver keyserver.ubuntu.com 40976EAF437D05B5
sudo apt-key adv --recv-keys --keyserver keyserver.ubuntu.com 3B4FE6ACC0B21F32

这将从Ubuntu GPG密钥服务器下载缺失的GPG密钥(如原始错误消息中所提到的)。

5您还可以使用单个命令添加多个密钥:apt-key adv --recv-keys --keyserver keyserver.ubuntu.com 3B4FE6ACC0B21F32 40976EAF437D05B5 - panticz
不支持使用HTTP连接代理,请查看https://serverfault.com/a/888715/304842。 - uav