Debian
GPG 密鑰新密鑰但不包含使用者 ID
我添加了一個新來源
deb http://httpredir.debian.org/debian buster-backports main contrib
到我的樹莓派上的源列表文件。當我更新我的 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 update 應該可以工作了。