由于缺少 gpg 密钥导致 apt-get 更新出现问题

由于缺少 gpg 密钥导致 apt-get 更新出现问题

我在测试 apt-key del 时意外删除了一些 Debian gpg 密钥。(我不记得是哪个密钥了)

我重新下载了 deb 包并提取了 gpg 密钥。然后我将apt-key add这些密钥添加到密钥环中。所有 3 个 Debian Stretch 密钥都已添加,但我仍然收到缺少公钥的警告apt update

Ign:1 http://deb.debian.org/debian stable InRelease                                
Get:2 http://deb.debian.org/debian stable-updates InRelease [91.0 kB]              
Ign:3 http://download.opensuse.org/repositories/home:/ivaradi/Debian_9.0_update  InRelease
Err:2 http://deb.debian.org/debian stable-updates InRelease
  The following signatures couldn't be verified because the public key is not available: NO_PUBKEY 8B48AD6246925553 NO_PUBKEY 7638D0442B90D010
Hit:4 https://dl.winehq.org/wine-builds/debian stretch InRelease
Ign:5 http://download.opensuse.org/repositories/home:/ivaradi/Debian_9.0  InRelease    
Get:6 http://deb.debian.org/debian-security stable/updates InRelease [94.3 kB]         
Err:6 http://deb.debian.org/debian-security stable/updates InRelease
  The following signatures couldn't be verified because the public key is not available: NO_PUBKEY 9D6D8F6BC857C906 NO_PUBKEY 8B48AD6246925553
Ign:7 http://download.opensuse.org/repositories/home:/strycore/Debian_9.0 ./ InRelease
Hit:8 http://download.opensuse.org/repositories/home:/ivaradi/Debian_9.0_update  Release
Hit:10 http://deb.debian.org/debian stable Release                                                                
Hit:12 http://download.opensuse.org/repositories/home:/ivaradi/Debian_9.0  Release
Hit:14 http://download.opensuse.org/repositories/home:/strycore/Debian_9.0 ./ Release
Reading package lists... Done
Building dependency tree       
Reading state information... Done
All packages are up to date.
W: An error occurred during the signature verification. The repository is not updated and the previous index files will be used. GPG error: http://deb.debian.org/debian stable-updates InRelease: The following signatures couldn't be verified because the public key is not available: NO_PUBKEY 8B48AD6246925553 NO_PUBKEY 7638D0442B90D010
W: An error occurred during the signature verification. The repository is not updated and the previous index files will be used. GPG error: http://deb.debian.org/debian-security stable/updates InRelease: The following signatures couldn't be verified because the public key is not available: NO_PUBKEY 9D6D8F6BC857C906 NO_PUBKEY 8B48AD6246925553
W: Failed to fetch http://deb.debian.org/debian/dists/stable-updates/InRelease  The following signatures couldn't be verified because the public key is not available: NO_PUBKEY 8B48AD6246925553 NO_PUBKEY 7638D0442B90D010
W: Failed to fetch http://deb.debian.org/debian-security/dists/stable/updates/InRelease  The following signatures couldn't be verified because the public key is not available: NO_PUBKEY 9D6D8F6BC857C906 NO_PUBKEY 8B48AD6246925553
W: Some index files failed to download. They have been ignored, or old ones used instead.

请告诉我还缺少哪些钥匙。

这是我的 apt-key 列表

/etc/apt/trusted.gpg
--------------------
pub   rsa4096 2017-05-22 [SC] [expires: 2025-05-20]
      6ED6 F5CB 5FA6 FB2F 460A  E88E EDA0 D238 8AE2 2BA9
uid           [ unknown] Debian Security Archive Automatic Signing Key (9/stretch) <[email protected]>
sub   rsa4096 2017-05-22 [S] [expires: 2025-05-20]

pub   rsa4096 2017-05-20 [SC] [expires: 2025-05-18]
      067E 3C45 6BAE 240A CEE8  8F6F EF0F 382A 1A7B 6500
uid           [ unknown] Debian Stable Release Key (9/stretch) <[email protected]>

/etc/apt/trusted.gpg.d/debian-archive-stretch-automatic.gpg
-----------------------------------------------------------
pub   rsa4096 2017-05-22 [SC] [expires: 2025-05-20]
      E1CF 20DD FFE4 B89E 8026  58F1 E0B1 1894 F66A EC98
uid           [ unknown] Debian Archive Automatic Signing Key (9/stretch) <[email protected]>
sub   rsa4096 2017-05-22 [S] [expires: 2025-05-20]

答案1

尝试使用以下命令重新导入丢失的密钥。

sudo su -
gpg --keyserver pgp.mit.edu --recv-keys 7638D0442B90D010 8B48AD6246925553
gpg --armor --export 7638D0442B90D010 | apt-key add -
gpg --armor --export 8B48AD6246925553 | apt-key add -
apt-get update
apt-get install -y debian-keyring debian-archive-keyring debian-ports-archive-keyring
apt-get update

相关内容