How to fix GPG errors in Ubuntu

Problem: When running sudo apt-get update, you get a bunch of errors such as

W: GPG error: http://ppa.launchpad.net oneiric Release: The following signatures
couldn't be verified because the public key is not available: NO_PUBKEY 6E871C4A881574DE

And because of this, you can’t run the update. There are a couple of fixes for this.

First, there’s the standard suite of commands:

sudo apt-get clean

sudo rm -r /var/lib/apt/lists/*

sudo touch /var/lib/apt/lists/lock

sudo mkdir /var/lib/apt/lists/partial

sudo apt-get clean

sudo apt-get update

If these don’t work you may need to manually re-download the keys.

sudo apt-key adv --keyserver keyserver.ubuntu.com --recv-keys hex_key_here

Substituting the actually key for hex_key_here. The key is the long hexadecimal number at the end of the ap-get update error. Using the example I gave above, I would type into my terminal

sudo apt-key adv --keyserver keyserver.ubuntu.com --recv-keys 6E871C4A881574DE

AND do yourself a favor and copy/paste the keys and/or the commands rather than manually typing them. One error is all it takes to make a lot of frustration.

If this stuff doesn’t work, there may be more info here: http://ubuntuforums.org/showthread.php?t=1221323


11 Comments on “How to fix GPG errors in Ubuntu”

  1. venushakti says:

    Looks like this solved a problem I was having downloading the “lzma” package — thanks!

  2. gerald says:

    brilliant. worked for me but only the last step.

    thanks.

  3. serbia says:

    thanks,this solved my problem in 12.04

  4. Wasif says:

    Thanks, it solved my problem.

  5. Sean says:

    Helped me too!

  6. Glenn says:

    awesome, that worked for me. Back to editing images!

  7. Hamsih says:

    This worked great for me, thank you

  8. sushmita says:

    Thanks a ton, those set of codes worked for me…this was extremly helpful…..

  9. Carmen says:

    I love you!!!!!! Thanks!

  10. Gopi says:

    Thank you…..)


Leave a reply to Hamsih Cancel reply