Apt
當我想更新時出現 GPG 錯誤
我剛剛安裝了 Kali NetHunter,我正在嘗試做一個簡單的操作
apt update
,但看起來缺少公鑰root@kali:~# apt-get update 0% [Waiting for headers] [Connected to packages.microsoft.com (13.8Get:2 https://packages.microsoft.com/repos/microsoft-debian-stretch-prod stretch InRelease [3232 B] Hit:1 http://kali.download/kali kali-rolling InRelease Err:2 https://packages.microsoft.com/repos/microsoft-debian-stretch-prod stretch InRelease The following signatures couldn't be verified because the public key is not available: NO_PUBKEY EB3E94ADBE1229CF Reading package lists... Done W: GPG error: https://packages.microsoft.com/repos/microsoft-debian-stretch-prod stretch InRelease: The following signatures couldn't be verified because the public key is not available: NO_PUBKEY EB3E94ADBE1229CF E: The repository 'https://packages.microsoft.com/repos/microsoft-debian-stretch-prod stretch 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.
我試過
curl -s https://packages.microsoft.com/repos/microsoft-debian-stretch-prod/dists/stretch/Release.gpg | apt-key add -
和
wget --no-check-certificate https://packages.microsoft.com/repos/microsoft-debian-stretch-prod/dists/stretch/Release.gpg | apt-key add -
結果是
gpg: no valid OpenPGP data found
雙方
我找到的解決方法是刪除
/etc/apt/sources.list.d/microsoft.list
並確保 kali repo 未註釋並且位於 main/etc/apt/sources.list
從微軟載入密鑰
curl https://packages.microsoft.com/keys/microsoft.asc | sudo apt-key add -