执行sudo update时遭遇GPG密钥错误,无法完成软件源更新
看起来你碰到了个Linux系统里挺常见的源更新小问题——ProtonVPN的软件源因为缺失对应GPG密钥,导致系统没法验证它的合法性,所以更新时就报错卡住了。先看看你遇到的具体错误信息:
7,898 kB were fetched in 2 s (3,370 kB/s).
Reading package lists… Done
Building dependency tree… Done
Status information is being read in… Done
Update available for 6 packages. Run "apt list --upgradable" to view them.
W: An error occurred while verifying the signature. The depot has not been updated and the previous index files are used.
GPG Error: https://repo.protonvpn.com/debian stable InRelease: The following signatures could not be verified because their public key is not available: NO_PUBKEY 4EDE055B645F044F
W: Failed to get from https://repo.protonvpn.com/debian/dists/stable/InRelease The following signatures could not be verified because their public key is not available: NO_PUBKEY 4EDE055B645F044F
W: Some index files could not be downloaded. They were ignored or old ones were used in their place.
别慌,我之前也碰到过一模一样的情况,咱们把缺失的密钥导入系统就行,给你两种靠谱的解决方法:
方法一:快速导入密钥(适合大多数Debian/Ubuntu系系统)
直接用apt-key命令把缺失的密钥从公共密钥服务器导入到系统可信库:
sudo apt-key adv --keyserver keyserver.ubuntu.com --recv-keys 4EDE055B645F044F
导入完成后,重新跑更新命令:
sudo apt update
方法二:符合新系统规范的导入方式(比如Ubuntu 22.04+、Debian 11+)
如果你的系统版本比较新,推荐用密钥环的方式导入,更贴合现在的安全规范:
- 先从密钥服务器获取密钥:
gpg --keyserver keyserver.ubuntu.com --recv-keys 4EDE055B645F044F
- 把密钥导出到系统的可信密钥环目录:
gpg --export 4EDE055B645F044F | sudo tee /usr/share/keyrings/protonvpn-archive-keyring.gpg > /dev/null
- 最后重新执行更新:
sudo apt update
一般来说,跑完上面任意一种方法,GPG错误就会消失,源也能正常更新了。至于为什么之前没问题现在突然报错,大概率是ProtonVPN更新了源的签名密钥,或者你的系统密钥库意外丢失了这个密钥,重新导入就好啦。
备注:内容来源于stack exchange,提问作者Srecko Mitrovic




