linux 更换软件源后 apt-get GPG错误

【此篇发表于2015/8/11】

今天特别郁闷,更换了 debian squeeze 6 的源之后,一直 update 出 gpg 错误,从来没遇到啊。
源地址:
deb http://ftp.debian.org/debian/ squeeze main contrib non-free

执行 apt-get update
root@vps:/etc/apt# apt-get update
Get:1 http://ftp.debian.org squeeze Release.gpg [1655 B]
Ign http://ftp.debian.org/debian/ squeeze/contrib Translation-en
Ign http://ftp.debian.org/debian/ squeeze/main Translation-en
Ign http://ftp.debian.org/debian/ squeeze/non-free Translation-en
Get:2 http://ftp.debian.org squeeze Release [96.0 kB]
Ign http://ftp.debian.org squeeze Release
Ign http://ftp.debian.org squeeze/main amd64 Packages/DiffIndex
Ign http://ftp.debian.org squeeze/contrib amd64 Packages/DiffIndex
Ign http://ftp.debian.org squeeze/non-free amd64 Packages/DiffIndex
Hit http://ftp.debian.org squeeze/main amd64 Packages
Hit http://ftp.debian.org squeeze/contrib amd64 Packages
Hit http://ftp.debian.org squeeze/non-free amd64 Packages
Fetched 1656 B in 1s (1297 B/s)
Reading package lists... Done
W: GPG error: http://ftp.debian.org squeeze Release: The following signatures couldn't be verified because the public key is not available: NO_PUBKEY AED4B06F473041FA NO_PUBKEY 64481591B98321F9

经过几经周折,修复方法如下:
root@vps:/etc/apt# gpg --keyserver subkeys.pgp.net --recv-key 64481591B98321F9
gpg: requesting key B98321F9 from hkp server subkeys.pgp.net
gpg: /root/.gnupg/trustdb.gpg: trustdb created
gpg: key B98321F9: public key "Squeeze Stable Release Key <debian-release@lists.debian.org>" imported
gpg: no ultimately trusted keys found
gpg: Total number processed: 1
gpg: imported: 1 (RSA: 1)
root@vps:/etc/apt# gpg --export --armor B98321F9 | sudo apt-key add -
OK
root@vps:/etc/apt# gpg --keyserver subkeys.pgp.net --recv-key AED4B06F473041FA
gpg: requesting key 473041FA from hkp server subkeys.pgp.net
gpg: key 473041FA: public key "Debian Archive Automatic Signing Key (6.0/squeeze) <ftpmaster@debian.org>" imported
gpg: no ultimately trusted keys found
gpg: Total number processed: 1
gpg: imported: 1 (RSA: 1)
root@vps:/etc/apt# gpg --export --armor 473041FA | sudo apt-key add -
OK

总算雨过天晴。

总结,要点:gpg –keyserver subkeys.pgp.net –recv-key XXXXXXXX 执行非常非常慢,需要耐心等待,我就是以为执行不过去,所以折腾半天。

参考链接 http://blog.sina.com.cn/s/blog_4c451e0e0100gce2.html

发表评论

电子邮件地址不会被公开。 必填项已用*标注