Ubuntu / Linux news and application reviews.

Almost a year ago, we posted a script created by an Ubuntuforums user (blackgr) which automatically imports Launchpad GPG keys in Ubuntu for all the PPAs you have added to your software sources.

We didn't talk about it much since then because meanwhile, the "add-apt-repository" was introduced in Ubuntu - a command which adds a PPA via command line and also imports the GPG key. But if you add a PPA when the Ubuntu keyserver is down, the key is not added. And if you add multiple PPAs when this happens, it can be quite annoying to search for and manually import the GPG keys for every PPA. For instance, when Ubuntu 10.04 was released, the Ubuntu Keyserver was down so a lot of people possibly have some missing GPG keys.

When a GPG key is missing, an error similar to this is displayed when you run an update:
W: GPG error: http://ppa.launchpad.net lucid Release: The following signatures couldn't be verified because the public key is not available: NO_PUBKEY 5A9BF3BB4E5E17B5
W: GPG error: http://ppa.launchpad.net lucid Release: The following signatures couldn't be verified because the public key is not available: NO_PUBKEY 3B22AB97AF1CDFA9
W: You may want to run apt-get update to correct these problems


For this reason I've created an Ubuntu .deb package for the script I was talking about which you can install via the WebUpd8 PPA:
sudo add-apt-repository ppa:nilarimogard/webupd8
sudo apt-get update
sudo apt-get install launchpad-getkeys

Once installed, to import all the missing GPG keys for your PPAs, simply use the following command:
sudo launchpad-getkeys


That's it!


In a future release, I might add some mirrors for getting the GPG keys to make sure the server launchpad-getkeys tries to access is not down. We'll see...


Update: I've released a new Launchpad Getkeys version which uses port 80 by default so it will now also work for those behind a firewall. Futher more, you can now specify the keyserver it should use for importing the GPG key. See this post: Import Missing GPG Keys, Even Behind A Firewall (Port 11371 Closed) [Launchpad PPAs]