GPG版本冲突求助:已装gnupg2却无法用HTTPS获取密钥
Hey there, let's break down what's happening and how to fix it:
Your system has two versions of GnuPG installed:
- The old 1.4.20 (linked to the
gpgcommand) which doesn't support HTTPS for key fetching - The latest gnupg2 (2.1.11) which does support HTTPS, but it's using the
gpg2command instead of the defaultgpg
Here are your solutions:
1. Use gpg2 Directly (Quick Fix)
Since you already have the latest gnupg2 installed, just run your key fetch command with gpg2 instead:
gpg2 --fetch-keys https://keys.qubes-os.org/keys/qubes-master-signing-key.asc
This should work immediately because GnuPG 2.x added support for HTTPS key sources.
2. Set gpg2 as the Default gpg (Permanent Fix)
If you want the gpg command to always point to the newer version, use the update-alternatives tool to configure your system's default:
- First, check if
gpg2is already in the alternatives list:
update-alternatives --list gpg
- If you don't see
/usr/bin/gpg2in the output, add it with a high priority:
sudo update-alternatives --install /usr/bin/gpg gpg /usr/bin/gpg2 100
- Now select
gpg2as the default:
sudo update-alternatives --config gpg
You'll see a menu with numbered options—enter the number next to /usr/bin/gpg2 and press Enter.
After this, run gpg --version and you should see the 2.x version. Your original gpg --fetch-keys command will now work over HTTPS.
Bonus Note
GnuPG 1.x is outdated and lacks modern features (like HTTPS support, newer encryption algorithms). It's a good idea to stick with 2.x long-term. If you want to remove the old 1.x package, you can run sudo apt remove gnupg—just double-check that no critical software depends on it first (most modern apps use gnupg2 anyway).
内容的提问来源于stack exchange,提问作者YouHaveaBigEgo

