當我想要 apt 更新時 GPG 錯誤

當我想要 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對雙方來說都是

答案1

從微軟載入金鑰

curl https://packages.microsoft.com/keys/microsoft.asc | sudo apt-key add -

答案2

我找到的解決方案是刪除/etc/apt/sources.list.d/microsoft.list並確保 kali 存儲庫未註釋並且位於主文件內/etc/apt/sources.list

答案3

  1. cd /etc/apt/sources.list.d
  2. ls(顯示 microsoft.sources.list.d)
  3. cd
  4. rm /etc/apt/sources.list.d/microsoft.sources.list.d

現在它已經刪除了嘗試更新時的訊息;但是,我不知道我是否正確地完成了此操作,因為我對此很陌生。

答案4

對於raspberrypi來說也是一樣的,只是對原始檔案進行了註釋,然後apt update再次執行。

# cat /etc/apt/sources.list.d/vscode.list
### THIS FILE IS AUTOMATICALLY CONFIGURED ###
# You may comment out this entry, but any other modifications may be lost.
# deb [arch=amd64,arm64,armhf] http://packages.microsoft.com/repos/code stable main

相關內容