我在 WSL2 中运行 Kali Linux。这是一个新安装(使用wsl --install
),但当我尝试时apt-get update
出现以下错误:
W: An error occurred during the signature verification. The repository is not updated and the previous
index files will be used. GPG error: http://mirrors.jevincanders.net/kali kali-rolling InRelease: The
following signatures were invalid: EXPKEYSIG ED444FF07D8D0BF6 Kali Linux Repository <[email protected]>
W: Failed to fetch http://http.kali.org/kali/dists/kali-rolling/InRelease The following signatures
were invalid: EXPKEYSIG ED444FF07D8D0BF6 Kali Linux Repository <[email protected]>
W: Some index files failed to download. They have been ignored, or old ones used instead.
现在我看到其他问题建议使用apt-key
命令来修复此问题。然而,这会引发另一个错误:
E: gnupg, gnupg2 and gnupg1 do not seem to be installed, but one of them is required for this operation
我无法安装 gnupg,因为我apt update
还没有运行。我该怎么办?
答案1
是的,Kali Linux WSL(不是从 Microsoft Store 下载的)似乎存在问题。
Kali 档案密钥似乎丢失,无法使用进行安装,apt-add key
因为它依赖于 GnuPG,而 GnuPG 无法使用进行安装apt
,因为无法验证签名。
最好的解决方案是 Jim 提交的解决方案,它从 Debian 软件包中安装了 Kali 存档密钥。一旦完成,apt update
它apt upgrade
就会正常工作。
- 下载 Debian 软件包以获取 Kali 存档密钥
wget -O kali-archive-keyring_2020.2_all.deb https://http.kali.org/kali/pool/main/k/kali-archive-keyring/kali-archive-keyring_2020.2_all.deb
- 安装 Kali 存档密钥包
sudo dpkg -i kali-archive-keyring_2020.2_all.deb
- 更新 Kali repo 中可用软件包的列表
sudo apt update
- 升级 WSL 系统
sudo apt full-upgrade
答案2
如果您在尝试下载密钥环时遇到任何 404 错误消息,请尝试以下操作:
2024 年更新
为了方便起见:当前密钥环文件已更改,请使用以下命令:
# download
wget http://http.kali.org/kali/pool/main/k/kali-archive-keyring/kali-archive-keyring_2024.1_all.deb
# install
sudo dpkg -i kali-archive-keyring_2024.1_all.deb
# remove downloaded file again
rm kali-archive-keyring_2024.1_all.deb
# update
sudo apt-get update
答案3
我没有改变/etc/apt/sources.list
。
我使用以下命令(从 root 运行)解决了“签名验证期间发生错误”:
wget --no-check-certificate https://http.kali.org/kali/pool/main/k/kali-archive-keyring/kali-archive-keyring_2020.2_all.deb
dpkg -i kali-archive-keyring_2020.2_all.deb
apt update
答案4
补充一点,因为我还需要一个额外的步骤:Windows 11 WSL kali-linux
wget --no-check-certificate https://http.kali.org/kali/pool/main/k/kali-archive-keyring/kali-archive-keyring_2020.2_all.deb
dpkg -i kali-archive-keyring_2020.2_all.deb
apt update
apt install libcrypt1
apt full-upgrade
apt autoremove
如果不先安装 libcrypt1,升级将会锁定您无法使用 Kali。