Get Missing PPA GPG Keys Automatically

In many articles they require you to add a PPA to get the latest version of programs. PPAs are very useful, but when missing PPA keys pile up, it’s not exactly the easiest of situations to take care of.

To get a PPA key, you normally have to go the Terminal and type in a separate command for every missing PPA key, which might take a while if you have many PPA keys missing.

If only there was an easier way. Like, an automatic way to do the job for us.

Well there is. If you’re missing any PPA keys you can simply paste the Terminal command below to do the job of for you.

sudo 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 --recv $key && gpg --export --armor $key | sudo apt-key add -; done

An even easier (and more automatic) way of getting missing PPA keys would be by running a little script called launchpad-update when you update your software sources.

First off download launchpad-update to the desktop, right click on the file, go to “Properties”, tick the “Allow executing file as program” box in the “Permissions” tab and then get rid of the .txt extension and then run the command below:

cd Desktop && sudo mv launchpad-update /usr/bin && echo "APT::Update::Pre-Invoke {\"if [ -x /usr/bin/launchpad-update ]; then /usr/bin/launchpad-update; fi;\"};" > 05ppa && sudo mv 05ppa /etc/apt/apt.conf.d/

Now everytime that you update your software sources, it will automatically get the missing PPA GPG keys for you. You can also run “launchpad-update” anytime if you wish to get the missing PPA GPG keys.


I am a g33k, Linux blogger, developer, student and Tech Writer for My passion for all things tech drives my hunt for all the coolz. I often need a vacation after I get back from vacation....

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.