Sunday, May 31, 2009

Resolving apt key signature problems in Ubuntu

I often come across a problem of following online instructions for installing applications through a third-party repository, but the instructions do not include how to include the key signature. There is an easy way to add the key you need, but it is not so easy to remember. I am mainly posting this here to help myself remember, but hopefully it will help others who may run in to this problem as well.

So the first thing to do is add the repository in question. For example, I added deb http://ppa.launchpad.net/compiz/ubuntu jaunty main, but after refreshing I got an error that read, "W: GPG error: http://ppa.launchpad.net jaunty Release: The following signatures couldn't be verified because the public key is not available: NO_PUBKEY 2ED6BB6042C24D89"

To fix this all we need to do is run the following command from the console:
gpg --keyserver hkp://subkeys.pgp.net --recv-keys 2ED6BB6042C24D89
gpg --export --armor 2ED6BB6042C24D89 | sudo apt-key add -


All that one needs to do is replace 2ED6BB6042C24D89 with the key listed in the error and you are back in business.

If anyone happens to know of a better way, I am all ears.