当我想要 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

相关内容