It all started when i executed -
sudo apt-get update
on my Ubuntu 12.04(Precise Pangolin). After fetching the required updates it showed me an error at the bottom - 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 6AF0E1940624A220
Screen-shot for the same is given below -
Clearly we need to download the key from Ubuntu key server.
Things to check before you see Approach 1 and 2.
Once you have copied the data to file. Save it. Then run the following command
sudo apt-key add key1
You will get an "OK" response.
aniket@aniket-Compaq-610:~/Desktop$ sudo apt-key add key1
[sudo] password for aniket:
OK
And you are done. Repeat the procedure of other keys that might be missing.
Then you can run
sudo apt-get update
and you will not get any error. Update happens smoothly. Do let me know if you still have any doubts.
sudo apt-get update
on my Ubuntu 12.04(Precise Pangolin). After fetching the required updates it showed me an error at the bottom - 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 6AF0E1940624A220
Screen-shot for the same is given below -
Clearly we need to download the key from Ubuntu key server.
Things to check before you see Approach 1 and 2.
- Open the file
~/.gnupg/gpg.conf
with the editor. - From the terminal
gedit ~/.gnupg/gpg.conf
- Go to 116th like
keyserver hkp://keys.gnupg.net - Comment this out and add line above it so the setup now looks like
keyserver http://keyserver.ubuntu.com
#
keyserver hkp://keys.gnupg.net
# keyserver mailto:pgp-public-keys@keys.nl.pgp.net
# keyserver ldap://keyserver.pgp.com - Save the file.
Trying Reset(Did not help. Same error persisted)
Enter the following command on the terminal -
sudo rm /var/lib/apt/lists/* -vf
and then update your system using following command -
sudo apt-get update && sudo apt-get upgrade
1st Approach(Did not Work for me)
Run the following command -
sudo apt-key adv --keyserver keyserver.ubuntu.com --recv-keys 6AF0E1940624A220This did not solve my problem. I got connection timed out.
Generally Ubuntu key-server uses port 11371 which may be blocked by tour firewall. So you can use 80 as the port -
sudo gpg --keyserver hkp://keyserver.ubuntu.com:80 --recv-keys 6AF0E1940624A220
But even this did not solve my problem -
Errors i got by following both methods in this approach are in below screen-shot.
Note : Here if you are getting Connection refused then this may be a proxy problem. Check if you are behind any proxy or firewall.
2nd Approach(Worked for me)
If the command are not doing it for you, you have to do it on your own. After a long research on this problem i finally decided that the best thing to do was manually download the key and add it.This is how i did it.
Go to Ubuntu Key-server(Click here). Here you can search your key. In my case it was 6AF0E1940624A220. Note while searching for key pre-append the key with 0x. So search for 0x6AF0E1940624A220
Click on the link provided in the pub section.
Copy the whole text(highlighted in below screen shot) from the page and save it in a file(say filename is key1).
Once you have copied the data to file. Save it. Then run the following command
sudo apt-key add key1
You will get an "OK" response.
aniket@aniket-Compaq-610:~/Desktop$ sudo apt-key add key1
[sudo] password for aniket:
OK
And you are done. Repeat the procedure of other keys that might be missing.
Then you can run
sudo apt-get update
and you will not get any error. Update happens smoothly. Do let me know if you still have any doubts.
Related Links
- W: GPG error: http://ppa.launchpad.net precise Release: The following signatures couldn't be verified because the public key is not available: (Ask Ubuntu)
- What is the difference between dpkg and aptitude/apt-get?