Tuesday, 30 April 2013

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

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.
  1. Open the file ~/.gnupg/gpg.conf with the editor.
  2. From the terminal gedit ~/.gnupg/gpg.conf
  3. Go to 116th like
    keyserver hkp://keys.gnupg.net
  4. 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
  5. 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

43 comments:

  1. Thank you very much...worked so well..

    ReplyDelete
  2. Thanks a lot. The second approached worked great.

    ReplyDelete
  3. Second approach worked for me. I have no clue why these small issues are necessary all the time. Anyway, you helped me a lot! Thanks dude!

    ReplyDelete
  4. The second option worked pretty good and fast for me.

    Thanks a lot man

    ReplyDelete
  5. Excellent it worked for me too, Thanks a lot

    ReplyDelete
  6. Great, the 2nd approach worked smoothly (ubuntu 12.04).

    ReplyDelete
  7. Thanks Aniket
    Worked perfectly for me!

    ReplyDelete
  8. I know the feeling of getting stuck with this error. Glad it helped so many people!

    ReplyDelete
  9. Sorry no the approaches work for me. I don't know how to do.

    https://drive.google.com/file/d/0B0WAJHUVk9sBbFhwVU9fNWNmSGs/edit?usp=sharing

    Could you help

    ReplyDelete
  10. Thanks a lot the second approach worked for me too.

    ReplyDelete
  11. Thanks for this valuable post; the first approach worked for me.

    ReplyDelete
  12. Thanks.. First approach worked for me

    ReplyDelete
  13. It did not word for me... Neither the first or the second option; what can I do?

    ReplyDelete
  14. neither worked for me either. after doing the second option I get Fetched 2,624 kB in 8s (303 kB/s)
    Reading package lists... Done
    root@Coldstone:~#

    can you help me figure out what I did wrong?

    ReplyDelete
  15. @mib could you give some more specific as in what difficulty or what part is not working ?

    @Knoxville Looking at the output it seems your public key not available error is not longer occurring and your packages are up to date. Am I missing something? If some broken packages are creating problem try "sudo apt get clean" and then update.

    ReplyDelete
  16. no they arent updating, I've rebooted the server and tried again and after it reads the package list it does nothing but drop me back to the cursor. since 14.01 lts is available for ubuntuserver now thru apt I may just reinstall anyway if I cant get this fixed easily. its not doing anything critical as its my home server that I use to tinker with so its not that big of deal, just a big hassle.

    ReplyDelete
  17. Hi, I am getting following error :
    "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 CBD000C02853C2C3"
    And the key that i am missing is unavailable on link given. - See more at: http://opensourceforgeeks.blogspot.in/2013/04/w-gpg-error-httpppalaunchpadnet-precise.html?showComment=1425590525730#c3487138071342912992

    ReplyDelete
  18. thanks! 2nd approach worked for me too on ubuntu 14.04

    ReplyDelete
  19. Great. Thanks for this solution. Tried the second approach and it worked.

    ReplyDelete
  20. thanks a lot ...2nd approach worked for me. :D

    ReplyDelete
  21. And the second soultion worked!! Thanks!!

    ReplyDelete
  22. Thanks for taking the time to post this. Second solution ftw!

    ReplyDelete
  23. Thanks, a ton man. Really worked for me!!!

    ReplyDelete
  24. Thanks a lot. The first approach worked for me!

    ReplyDelete
  25. when i save the file and run terminal sudo apt-key add key1
    no such file or directory ..... so what i should to do

    ReplyDelete
  26. Modifying gpg.conf and resetting did not work for me either. However the first approach (getting the missing key) did work. I was missing a different key, though (4DF9B28CA252A784). Thanks for the help.

    ReplyDelete
  27. Second option worked for me. Thanks a bunch

    ReplyDelete
  28. 2nd approach worked !! Thanks a tonne !!

    ReplyDelete
  29. This was so helpful thank you!

    ReplyDelete
  30. Thankyou so much... It helped me..

    ReplyDelete
  31. Thanks. The 2nd approach worked for me.

    ReplyDelete

t> UA-39527780-1 back to top