Written by Andrew @ http://www.webupd8.org
Launchpad-Getkeys is a script (comes packaged in a .deb) that automatically imports all missing GPG keys, even if you’re behind a firewall
. It was initially created by blackgr @ ubuntuforums but then I decided to completely re-write the script so I can add some options, new features and so on.
How do you know when you have a missing GPG key?
Here’s an example: when you run “sudo apt-get
update”, you’ll see some errors like this:
Fetched 47.0kB in 6s (7,710B/s)
Reading package lists... Done
W: GPG error: http://ppa.launchpad.net maverick Release: The following signatures couldn't be verified because the public key is not available: NO_PUBKEY B2DFD25316B94077
W: GPG error: http://ppa.launchpad.net maverick Release: The following signatures couldn't be verified because the public key is not available: NO_PUBKEY 1FFD34C9EB13C954
W: GPG error: http://ppa.launchpad.net maverick Release: The following signatures couldn't be verified because the public key is not available: NO_PUBKEY EF4186FE247510BE
Here’s a screenshot too:
Further more, if you have missing GPG keys, the update manager
will not allow you to update the packages. That’s when Launchpad-Getkeys comes in: it can automatically import all these missing GPG keys, thus fix the errors.
Here is a video with Launchpad-getkeys in action to get a better idea on how it works:
Unfortunately my script didn’t work if the user was behind a proxy but WebUpd8 reader Saurabh Kumar added proxy support to Launchpad-Getkeys
– I couldn’t test this (I’m not behind a proxy and even if I’d try to simulate this, I wouldn’t know for sure that it works) but I’ve merged his change into the Launchpad-Getkeys package in the WebUpd8 PPA
anyway. Read on to find out how to install and use Launchpad-Getkeys.
Launchpad-Getkeys is available for Ubuntu 9.10, 10.04, 10.10 and 11.04, in the WebUpd8 PPA. Add the PPA and install Launchpad-Getkeys using the following commands:
sudo add-apt-repository ppa:nilarimogard/webupd8
sudo apt-get update
sudo apt-get install launchpad-getkeys
How to use Launchpad-Getkeys
To automatically import all the missing Launchpad GPG keys, all you have to do is run the following command:
You can also specify a keyserver and port using the “-k” parameter, like so:
sudo launchpad-getkeys -k SERVER:PORT
This is useful if the port is blocked (but Launchpad-Getkeys uses port 80 by default, unlike the “add-apt-repository” command until Ubuntu 11.04) or if the keyserver is down.
To use Launchpad Getkeys when you’re behind a proxy (instructions by Saurabh Kumar – tested by him only), run the following command:
Then search for this line:
And above it, add this:
Defaults env_keep = "http_proxy"
Then press “Ctrl + O” and “Ctrl + X” if visudo is open using Nano (that’s the default behavior).
This will use your “http_proxy” so all you have to do is run:
If you want, you can specify a different proxy like this:
sudo launchpad-getkeys -p http://SERVER:PORT
Note: There are still things to do. For instance, the script cannot tell if it imported the keys successfully or not and will always report this as successful. I’m still working on solving this.
Many thanks to Saurabh Kumar for his patch!