# Ubuntu apt-get出错记录
# 解决Ubuntu的apt-get的update子命令提示没有可用的公钥
2016.07.08
# 问题
apt-get update 或者aptitude update出现以下错误:以下ID的密钥没有可用的公钥
如图:
# 解决方法
1,从任何一个key server获得缺失的公钥1397BC53640DB551。
gpg --keyserver keyserver.ubuntu.com --recv-keys 1397BC53640DB551
1
2,导入公钥1397BC53640DB551 。
gpg -a --export 1397BC53640DB551 | sudo apt-key add -
1
注意:keyserver,官方地址为subkeys.pgp.net,但是国内访问不了
# 国内可用key server列表
keyserver.ubuntu.com pgp.mit.edu subkeys.pgp.net www.gpg-keyserver.de
# linux 更换软件源后 apt-get GPG错误
今天特别郁闷,更换了 debian squeeze 6 的源之后,一直 update 出 gpg 错误,从来没遇到啊。 源地址:
deb http://ftp.debian.org/debian/ squeeze main contrib non-free
1
执行 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
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
经过几经周折,修复方法如下:
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
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
总算雨过天晴。
总结,要点 gpg –keyserver subkeys.pgp.net –recv-key XXXXXXXX 执行非常非常慢,需要耐心等待,我就是以为执行不过去,所以折腾半天。
参考链接 http://blog.sina.com.cn/s/blog_4c451e0e0100gce2.html