Dec 172009

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.

 Posted by at 5:36 am