How to solve GPG warning about apt/aptitude repository update

When you add a repository in your /etc/apt/sources.list and run a apt-update you'll get the update of the newly added repository but also a warning about a GPG key like the following one :

Hit intrepid/main Sources
Hit intrepid-proposed/universe Packages
Hit intrepid/main Packages
Fetched 309B in 0s (519B/s)
Reading package lists... Done
W: GPG error: intrepid Release: The following signatures couldn't be verified because the public key is not available: NO_PUBKEY D702BF6B8C6C1EFD
W: You may want to run apt-get update to correct these problems

Running again apt-update won't solve the issue.
This warning can be safely ignored, but I don't like to leave warning when there is a solution to get rid of it... because when something is going wrong, it would complicate to sort out what is safe to be ignored and what tells about a real issue.

So, to get rid of this warning here is the two command you need to execute :

gpg --keyserver --recv D702BF6B8C6C1EFD
gpg --export --armor D702BF6B8C6C1EFD | sudo apt-key add -
sudo apt-get update

which will give this output :

thomas@daisybox:~$ gpg --keyserver --recv D702BF6B8C6C1EFD
gpg: directory `/home/thomas/.gnupg' created
gpg: new configuration file `/home/thomas/.gnupg/gpg.conf' created
gpg: WARNING: options in `/home/thomas/.gnupg/gpg.conf' are not yet active during this run
gpg: keyring `/home/thomas/.gnupg/secring.gpg' created
gpg: keyring `/home/thomas/.gnupg/pubring.gpg' created
gpg: requesting key 8C6C1EFD from hkp server
gpg: /home/thomas/.gnupg/trustdb.gpg: trustdb created
gpg: key 8C6C1EFD: public key "Launchpad PPA for Bazaar Developers" imported
gpg: Total number processed: 1
gpg: imported: 1 (RSA: 1)
thomas@daisybox:~$ gpg --export --armor D702BF6B8C6C1EFD | sudo apt-key add -
thomas@daisybox:~$ sudo apt-get update
Hit intrepid Release.gpg
Hit intrepid/free Sources
Hit intrepid/non-free Sources
Fetched 309B in 0s (478B/s)
Reading package lists... Done

No more warning ;)


Anonymous said…
Hey thanks so much for these commands; I was hitting the same issue and wasn't sure how to fix it. Googled the warning I was getting, and your blog post came up (also the only thing to appear in the search results).
Unknown said…
many thanks. this saved me a ton of time!
Cath said…
Thank you very much for posting that - it was driving me crazy.
David Tussey said…
Perfect. Thanks so much. Was driving me nuts.
Unknown said…
Not sure the difference but using --recv-keys rather than --recv worked for me. Thanks for posting.

Popular posts from this blog

Upgrade Slimframework v3 to v4, how I did it

Reset Bacula database and files

Limit the upload bandwidth of your apache webserver with mod_bw