How to fix missing GPG keys?

I have just installed Ubuntu 12.04 and I added some repo, and when I did apt-get update, I got missing gpg key.

Following command seems to doesn't work for me:

apt-get update 2> /tmp/keymissing; for key in $(grep "NO_PUBKEY" /tmp/keymissing |sed "s/.*NO_PUBKEY //"); do echo -e "\nProcessing key: $key"; gpg --keyserver subkeys.pgp.net --recv $key && sudo gpg --export --armor $key | apt-key add -; done

How to fix this problem?


I liked this solution, re-download the missing keys from the Ubuntu key server.

For Ubuntu

  • UBUNTU: Fixing GPG Keys in UBUNTU

In my case

 Reading package lists... Done  
 W: GPG error: http://ppa.launchpad.net precise 
 Release: The following signatures couldn't be verified because the public key is not available: 
 NO_PUBKEY 2EA8F35793D8809A

Here is the command to add the missing key mentioned in the error message.

sudo apt-key adv --keyserver ha.pool.sks-keyservers.net --recv-keys 2EA8F35793D8809A

So I take the missing key 2EA8F35793D8809A and ask the keyserver.ubuntu.com to added it to the list of keys I have in apt.

For linux mint
Your key server is slightly different keyserver.linuxmint.com

sudo apt-key adv --recv-key --keyserver keyserver.linuxmint.com "missing key"

Alternative key servers to try
keyserver.ubuntu.com


There is a software called as Y PPA manager It can help fix GPG keys errors.
Y PPA manager

To install -

sudo add-apt-repository ppa:webupd8team/y-ppa-manager  
sudo apt-get update  
sudo apt-get install y-ppa-manager    

Once you install it start it ,then go to advance and select "import all missing GPG keys"