gpg:[不知道]:无效数据包(ctb=2d)

gpg:[不知道]:无效数据包(ctb=2d)

尝试修复 Ubuntu Trusty 上我的密钥问题:

$ apt-key list >/dev/null
gpg: [don't know]: invalid packet (ctb=2d)
gpg: keydb_search_next failed: invalid packet

因此,我已将我的密钥从 PPA 存储库备份到/etc/apt/trusted.gpg.d.BACKUP/

$ sudo mv /etc/apt/trusted.gpg.d /etc/apt/trusted.gpg.d.BACKUP
$ apt-key list | grep gpg$
/etc/apt/trusted.gpg

然后我将密钥导回 GPG:

$ sudo mkdir /etc/apt/trusted.gpg.d/
$ for file in $(\ls /etc/apt/trusted.gpg.d.BACKUP/ | grep gpg$) 
> do
>   sudo gpg --no-default-keyring --keyring /etc/apt/trusted.gpg.d/$file --import /etc/apt/trusted.gpg.d.BACKUP/$file
> done
gpg: keyring `/etc/apt/trusted.gpg.d/andykimpe-gparted.gpg' created
gpg: key 274A7DA0: public key "Launchpad PPA for andykimpe" imported
gpg: Total number processed: 1
gpg:               imported: 1  (RSA: 1)
...
gpg: keyring `/etc/apt/trusted.gpg.d/openlp-core-release.gpg' created
gpg: key DF629112: public key "Launchpad Development Packages" imported
gpg: Total number processed: 1
gpg:               imported: 1  (RSA: 1)
$

当我检查时,我仍然有相同的情况:

$ apt-key list | grep gpg$
/etc/apt/trusted.gpg

就像什么都没有导入一样。

你能帮我吗 ?

答案1

这是一个权限问题:

$ ll -d /etc/apt/trusted.gpg /etc/apt/trusted.gpg.d /etc/apt/trusted.gpg.d/*.gpg | head
-rw-r--r-- 1 root root 12335 2019-02-24 11:31:28 /etc/apt/trusted.gpg
drwxr-xr-x 2 root root  4096 2019-02-24 12:00:11 /etc/apt/trusted.gpg.d/
-rw------- 1 root root  1132 2019-02-24 12:00:09 /etc/apt/trusted.gpg.d/andykimpe-gparted.gpg
-rw------- 1 root root   362 2019-02-24 12:00:09 /etc/apt/trusted.gpg.d/brightbox-ruby-ng.gpg
-rw------- 1 root root   353 2019-02-24 12:00:09 /etc/apt/trusted.gpg.d/cairo-dock-team-ppa.gpg
-rw------- 1 root root   364 2019-02-24 12:00:09 /etc/apt/trusted.gpg.d/centrych-updates.gpg
-rw------- 1 root root  9178 2019-02-24 12:00:10 /etc/apt/trusted.gpg.d/debian-archive-squeeze-automatic.gpg
-rw------- 1 root root  3780 2019-02-24 12:00:10 /etc/apt/trusted.gpg.d/debian-archive-wheezy-automatic.gpg
-rw------- 1 root root  2851 2019-02-24 12:00:10 /etc/apt/trusted.gpg.d/debian-archive-wheezy-stable.gpg
-rw------- 1 root root   357 2019-02-24 12:00:10 /etc/apt/trusted.gpg.d/djcj-hybrid.gpg
$ sudo chmod -v a+r /etc/apt/trusted.gpg.d/*.gpg
mode of ‘/etc/apt/trusted.gpg.d/andykimpe-gparted.gpg’ changed from 0600 (rw-------) to 0644 (rw-r--r--)
mode of ‘/etc/apt/trusted.gpg.d/brightbox-ruby-ng.gpg’ changed from 0600 (rw-------) to 0644 (rw-r--r--)
mode of ‘/etc/apt/trusted.gpg.d/cairo-dock-team-ppa.gpg’ changed from 0600 (rw-------) to 0644 (rw-r--r--)
mode of ‘/etc/apt/trusted.gpg.d/centrych-updates.gpg’ changed from 0600 (rw-------) to 0644 (rw-r--r--)
mode of ‘/etc/apt/trusted.gpg.d/debian-archive-squeeze-automatic.gpg’ changed from 0600 (rw-------) to 0644 (rw-r--r--)
mode of ‘/etc/apt/trusted.gpg.d/debian-archive-wheezy-automatic.gpg’ changed from 0600 (rw-------) to 0644 (rw-r--r--)
mode of ‘/etc/apt/trusted.gpg.d/debian-archive-wheezy-stable.gpg’ changed from 0600 (rw-------) to 0644 (rw-r--r--)
mode of ‘/etc/apt/trusted.gpg.d/djcj-hybrid.gpg’ changed from 0600 (rw-------) to 0644 (rw-r--r--)
...
$ apt-key list | grep gpg$
/etc/apt/trusted.gpg
/etc/apt/trusted.gpg.d/andykimpe-gparted.gpg
/etc/apt/trusted.gpg.d/brightbox-ruby-ng.gpg
/etc/apt/trusted.gpg.d/cairo-dock-team-ppa.gpg
/etc/apt/trusted.gpg.d/centrych-updates.gpg
/etc/apt/trusted.gpg.d/debian-archive-squeeze-automatic.gpg
/etc/apt/trusted.gpg.d/debian-archive-wheezy-automatic.gpg
/etc/apt/trusted.gpg.d/debian-archive-wheezy-stable.gpg
/etc/apt/trusted.gpg.d/djcj-hybrid.gpg
...
$ sudo apt update
...
Fetched 143 kB in 26s (5 487 B/s)
W: GPG error: http://liveusb.info all Release: The following signatures couldn't be verified because the public key is not available: NO_PUBKEY 4E940D7FDD7FB8CC
W: GPG error: http://kovacsoltvideo.hu ./ Release: The following signatures couldn't be verified because the public key is not available: NO_PUBKEY ADC80AAEABE7778C
W: GPG error: http://ppa.launchpad.net trusty InRelease: The following signatures couldn't be verified because the public key is not available: NO_PUBKEY 3BDAAC08614C4B38
W: GPG error: http://ppa.launchpad.net trusty InRelease: The following signatures couldn't be verified because the public key is not available: NO_PUBKEY 69AD89E0EC179BCC
W: GPG error: http://ppa.launchpad.net trusty InRelease: The following signatures couldn't be verified because the public key is not available: NO_PUBKEY A7E13D78E4A4F4F4
W: GPG error: http://ppa.launchpad.net trusty InRelease: The following signatures couldn't be verified because the public key is not available: NO_PUBKEY FE7385FFAC9B079A
W: GPG error: http://ppa.launchpad.net trusty InRelease: The following signatures couldn't be verified because the public key is not available: NO_PUBKEY 6D975C4791E7EE5E
W: GPG error: http://ppa.launchpad.net trusty InRelease: The following signatures couldn't be verified because the public key is not available: NO_PUBKEY 4C1CBE14852541CB
W: GPG error: http://ppa.launchpad.net trusty InRelease: The following signatures couldn't be verified because the public key is not available: NO_PUBKEY EBB4CCF6A72BC110
W: GPG error: http://ppa.launchpad.net trusty InRelease: The following signatures couldn't be verified because the public key is not available: NO_PUBKEY 03647209B58A653A
W: GPG error: http://ppa.launchpad.net trusty InRelease: The following signatures couldn't be verified because the public key is not available: NO_PUBKEY 03647209B58A653A
W: GPG error: http://ppa.launchpad.net trusty Release: The following signatures couldn't be verified because the public key is not available: NO_PUBKEY BE362D6D32DE30FB
W: GPG error: http://ppa.launchpad.net trusty Release: The following signatures couldn't be verified because the public key is not available: NO_PUBKEY BC3E0682A5A1D6B2
W: GPG error: http://ppa.launchpad.net trusty Release: The following signatures couldn't be verified because the public key is not available: NO_PUBKEY 60ED5CE429FFDC52
W: GPG error: http://ppa.launchpad.net trusty Release: The following signatures couldn't be verified because the public key is not available: NO_PUBKEY 55E2097C08E6D617
W: Failed to fetch http://build.openvpn.net/debian/openvpn/stable/dists/trusty/main/binary-i386/Packages  403  Forbidden [IP: 146.112.61.106 80]

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

然后我用命令循环遍历丢失的键sudo apt-key adv --keyserver keyserver.ubuntu.com --recv-keys $key,现在问题终于解决了。

相关内容