GPG 密钥新密钥但不包含用户 ID

GPG keys new key but contains no user ID

我添加了一个新来源

deb http://httpredir.debian.org/debian buster-backports main contrib

到我 raspberry pi 上的源列表文件。当我更新我的 sudo apt 以确认更改时,我收到此错误:

sudo apt update
Hit:1 http://raspbian.raspberrypi.org/raspbian buster InRelease
Get:2 http://httpredir.debian.org/debian buster-backports InRelease [46.7 kB]
Get:3 http://archive.raspberrypi.org/debian buster InRelease [32.6 kB]
Err:2 http://httpredir.debian.org/debian buster-backports InRelease
  The following signatures couldn't be verified because the public key is not available: NO_PUBKEY 04EE7237B7D453EC NO_PUBKEY 648ACFD622F3D138
Get:4 http://archive.raspberrypi.org/debian buster/main armhf Packages [330 kB]
Reading package lists... Done
W: GPG error: http://httpredir.debian.org/debian buster-backports InRelease: The following signatures couldn't be verified because the public key is not available: NO_PUBKEY 04EE7237B7D453EC NO_PUBKEY 648ACFD622F3D138
E: The repository 'http://httpredir.debian.org/debian buster-backports InRelease' is not signed.
N: Updating from such a repository can't be done securely, and is therefore disabled by default.
N: See apt-secure(8) manpage for repository creation and user configuration details.

我得到了以下说明:

gpg --recv-keys 04EE7237B7D453EC
gpg --recv-keys 648ACFD622F3D138
gpg --export 04EE7237B7D453EC | sudo apt-key add -
gpg --export 648ACFD622F3D138 | sudo apt-key add -

但是当我执行这个命令时:

gpg --recv-keys 04EE7237B7D453EC

我收到这个错误:

gpg: key E0B11894F66AEC98: new key but contains no user ID - skipped
gpg: Total number processed: 1
gpg:           w/o user IDs: 1

是否应该出现该输出?我按照说明进行操作,但仍然遇到之前的错误,public key is not available 暗示我的密钥有问题。

我找到了答案:

包管理器需要 PGP 密钥来验证新存储库中的包集。 您首先必须从密钥服务器获取密钥,例如SKS 之一:

$ gpg --recv-keys --keyserver ipv4.pool.sks-keyservers.net 04EE7237B7D453EC
gpg: key E0B11894F66AEC98: public key "Debian Archive Automatic Signing Key (9/stretch) <ftpmaster@debian.org>" imported
gpg: Total number processed: 1
gpg:               imported: 1
$ gpg --recv-keys --keyserver ipv4.pool.sks-keyservers.net 648ACFD622F3D138
gpg: key DC30D7C23CBBABEE: public key "Debian Archive Automatic Signing Key (10/buster) <ftpmaster@debian.org>" imported
gpg: Total number processed: 1
gpg:               imported: 1

然后将它们导入您本地的 APT 密钥库:

$ gpg --export 04EE7237B7D453EC | sudo apt-key add -
OK
$ gpg --export 648ACFD622F3D138 | sudo apt-key add -
OK

那么你的 apt 更新应该可以工作了。