Saturday, January 31, 2009

Getting the public key of a ubuntu repository

I sometimes have problems when I add an APT line to the source.list and when I do and apt-get update, get an error message saying I do not have an authentication key, especially from one of the repositories. The usual message would be:

GPG error: intrepid Release: The following signatures couldn't be verified because the public key is not available: NO_PUBKEY 0123456789ABCDEF

I have a short script that can help you get the correct key. Simply create a file called and type in the following code:

gpg --keyserver --recv $1
gpg --export --armor $1 | sudo apt-key add -

You then have to make the file an executable file, this can be done by using the chmod command with the +x switch:

chmod +x

To import the signature, simply type:

./ 0123456789ABCDEF

The above assumes the script is located in the current directory and the repository's public key is located on the server.

No comments:

Post a Comment