I spent the evening relocating a local mirror of Ubuntu’s Hardy and Intrepid repository from one machine to another. When I was finished, I went about updating the sources.list files on the various computers when I encountered a GPG error. One of the four Launchpad PPA repos I follow added a signature and I didn’t have the public key in which to verify it.

After updating the repos with apt-get update, it kicked out the following error:

W: GPG error: http://ppa.launchpad.net hardy Release: The following signatures couldn’t be verified because the public key is not available: NO_PUBKEY 4874D3686E80C6B7
W: You may want to run apt-get update to correct these problems

It’s suggestion to run the very same command again wasn’t going to work. I needed to get and add the public key. But since I’m following more than one Launchpad PPA repo, I wanted to verify whose key was being used before I added it.

Ubuntu runs a keyserver at http://keyserver.ubuntu.com:11371 that can be queried both automatically and manually. The error shows you the hex format of the keyid. When you go to Ubuntu’s keyserver with your web browser, you’ll see a form in which to extract a key. Enter the keyid into the Search String box, preceding it with 0x (zero and the letter X) and click Submit Query. You’ll then be presented with that keyid’s details which includes its creation date, its uid, and a list of people who signed it.

keyserver_banshee_keyid

You can see that this is a fairly new signature. From the uid, you can see that it’s for the Banshee Launchpad PPA. It was created on 2009-01-20 and was signed by Kaushal with their key. For a comparison, see Google’s Linux Package Signing Key’s entry.

keyserver_google_keyid

Google’s key is almost two years old with a few more signatures.

To see the actual key, you can click on the link next to pub. What you get is the actual public key that needs to be stored.

keyserver_banshee_key

The next thing I want to do is add that key from the keyserver to apt’s list of keys. Highlight and copy the key’s keyserver address. For this key, it’s http://keyserver.ubuntu.com:11371/pks/lookup?op=get&search=0x4874D3686E80C6B7 and use it on the command line like so:

wget -q "http://keyserver.ubuntu.com:11371/pks/lookup?op=get&search=0x4874D3686E80C6B7" -O- | sudo apt-key add -

This will have wget fetch the key and pipe it to apt-key. You’ll probably be asked for your user password. After apt-key adds it to its list, you’ll see OK and the command prompt.

adam@obsidian:~$ wget -q “http://keyserver.ubuntu.com:11371/pks/lookup?op=get&search=0x4874D3686E80C6B7″ -O- | sudo apt-key add -
[sudo] password for adam:
OK
adam@obsidian:~$

If you’d like to see a list of all apt’s stored keys, you can have it display them with:

sudo apt-key list

You should see a listing similar to:

adam@obsidian:~$ sudo apt-key list
[sudo] password for adam:
/etc/apt/trusted.gpg
——————–
pub   1024D/437D05B5 2004-09-12
uid                  Ubuntu Archive Automatic Signing Key <[email protected]>
sub   2048g/79164387 2004-09-12

pub   1024D/FBB75451 2004-12-30
uid                  Ubuntu CD Image Automatic Signing Key <[email protected]>

pub   1024D/0C5A2783 2006-11-23
uid                  Medibuntu Packaging Team <[email protected]>
uid                  The Medibuntu Team <[email protected]>
sub   2048g/16C7105A 2006-11-23

pub   1024D/6A423791 2006-09-26 [expires: 2009-09-25]
uid                  Opera Software Archive Automatic Signing Key <[email protected]>
sub   2048g/BEAEDCB7 2006-09-26 [expires: 2009-09-25]

pub   1024D/7FAC5991 2007-03-08
uid                  Google, Inc. Linux Package Signing Key <[email protected]>
sub   2048g/C07CB649 2007-03-08

pub   1024D/6DFBCBAE 2008-07-14
uid                  Sun Microsystems, Inc. (xVM VirtualBox archive signing key) <[email protected]>
sub   2048g/78A86EAF 2008-07-14

pub   1024D/387EE263 2004-09-17
uid                  Scott Ritchie <[email protected]>
uid                  Scott Ritchie <[email protected]>
uid                  Scott Ritchie <[email protected]>
sub   1024g/203C857C 2004-09-17

pub   1024R/6E80C6B7 2009-01-20
uid                  Launchpad PPA for Banshee Team

adam@obsidian:~$

Right there at the bottom, you can see the newly added key for the Banshee Team.

UPDATE:

Launchpad News posted a screencast showing how to find/add PPA keys through the desktop without having to use the command line as I have done above. You can find it at http://news.launchpad.net/ppa/adding-a-ppas-key-to-ubuntu with full audio commentary.

Share