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

Lyr*_*ell 5 linux networking key gnupg

我添加了一个新来源

deb http://httpredir.debian.org/debian buster-backports main contrib
Run Code Online (Sandbox Code Playgroud)

到我的树莓派上的源列表文件。当我更新 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.
Run Code Online (Sandbox Code Playgroud)

我得到了以下指示:

gpg --recv-keys 04EE7237B7D453EC
gpg --recv-keys 648ACFD622F3D138
gpg --export 04EE7237B7D453EC | sudo apt-key add -
gpg --export 648ACFD622F3D138 | sudo apt-key add -
Run Code Online (Sandbox Code Playgroud)

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

gpg --recv-keys 04EE7237B7D453EC
Run Code Online (Sandbox Code Playgroud)

我收到此错误:

gpg: key E0B11894F66AEC98: new key but contains no user ID - skipped
gpg: Total number processed: 1
gpg:           w/o user IDs: 1
Run Code Online (Sandbox Code Playgroud)

该输出应该发生吗?我按照说明进行操作,但仍然出现之前的错误,public key is not available这意味着我的钥匙有问题。

Lyr*_*ell 5

我找到了答案:

包管理器需要拥有 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
Run Code Online (Sandbox Code Playgroud)

然后将它们导入到本地 APT 密钥存储中:

$ gpg --export 04EE7237B7D453EC | sudo apt-key add -
OK
$ gpg --export 648ACFD622F3D138 | sudo apt-key add -
OK
Run Code Online (Sandbox Code Playgroud)

然后你的 apt 更新应该可以工作。

  • 这并不是说您之前没有使用密钥服务器,而是默认密钥服务器从密钥中剥离了用户 ID。这个[答案](https://superuser.com/a/1485255/41709)解释了原因。 (2认同)