How-To Geek

How to Automatically Import Missing GPG Keys in Ubuntu


If you have missing GPG keys you’ll get an error like the one above in the screenshot if you are using Synaptic Package Manager and a similar one if you use the terminal. “Launchpad-getkeys” is a script that imports these missing keys automatically.

When adding PPAs to Ubuntu via “apt-add-repository” the PPA and its key will be imported. These GPG keys are a way to verify the packages in that PPA. But if you add a PPA when the Ubuntu key server is down the key will not be imported and the PPA will produce an error every time you try refreshing your packages. Ubuntu Forums user (blackgr) created a script called “launchpad-getkeys” that will import all missing keys automatically. To get this script on your computer, type these commands in a terminal and hit “Enter” after every line.

sudo apt-add-repository ppa:nilarimogard/webupd8

sudo apt-get update

sudo apt-get install launchpad-getkeys

Launchpad-getkeys is now installed. To import keys, just run:

sudo Launchpad-getkeys


As launchpad-getkeys says, you shouldn’t see any key errors anymore.


Omar Hafiz is a geeky Linux user who loves customizing Ubuntu to fit his personal style. Whether it's the login screen or his Gnome panels, he's got them tweaked to perfection.

  • Published 09/13/11

Comments (6)

  1. Ted Kitch

    To launch launchpad-getkeys the command should show:

    sudo launchpad-getkeys

    in all lowercase letters, otherwise you will get a command not found error

  2. cam2644

    Useful stuff

  3. Larry Thiel

    You might also show what happens if you run the script when there are no GPG keys midding just so people know.

    user@machine:~$ sudo launchpad-getkeys

    Please wait… launchpad-getkeys is running an update so
    it can detect the missing GPG keys

    There are no missing GPG keys!

  4. Odex

    Hi, I do apologize for sending this, but am in dire need for help. I tried the script and it worked fine for most gpg keys. I do however get the following errors and have no idea how to solve them. I seriously want to resolve the problem though.
    W: Failed to fetch 404 Not Found


    W: Failed to fetch 404 Not Found

    This tells me (and boy am I a total beginner on Linux) that the page it tries to update from does not exist. How, please, how do I fix this?

    It happened after I removed XBMC to upgrade to the latest version. Needless to say, no more XBMC and no way I can get it back.

    Thank you in advance for assisting. Regards, Odex

  5. Omar Hafiz


    There seem to be a problem with the XBMC ppa for natty. Try the unstable ppa at

    deb natty main

    If you continue to recieve this error please use the forums. You’ll get much better help there.

  6. Odex

    Thank you very much Omar. I’m going to try it right now!

More Articles You Might Like

Enter Your Email Here to Get Access for Free:

Go check your email!