Adding missing PPA keys to an apt keyring

Jack Wallen
Mar 31, 2011
Updated • Jan 14, 2013
Linux
|
5

If you are a user of a Linux distribution that takes advantage of Launchpad's Personal Package Archive, then you know how easy that tool can be for adding those hard to find applications pre-packaged for your system. Once you get used to PPAs, it's fairly easy to depend upon those repositories. But there is sometimes a, seemingly, insurmountable issue with those PPAs - keys. If the key for a particular PPA isn't given to you, you can't use the software -- not until the key is added to your keyring.

But how do you add the key when you never received it? Believe it or not, there is a simple solution for that task.

I'm going to assume you have the PPA added to to your /etc/apt/sources.list file (or added them with the command sudo add-apt-repository ppa:chromium-daily.). After the PPA has been added, the next step before the installation of the software, is to run the command sudo apt-get update. If the key hasn't been added an error will be displayed indicated the key is missing. When that error pops up, that particular PPA can not be used. The error will look like:

GPG error: http://ppa.launchpad.net lucid Release: The following signatures couldn't be verified because the public key is not available: NO_PUBKEY 2524246B1CC723DB

The clue here is the last string of characters, which is the public key. In order to add the key for this particular PPA (or repository), issue the command:

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

Where KEY_ID is the last string of characters in the error (in this case 2524246B1CC723DB).

When the above command is issued, the following output will be displayed:

Executing: gpg --ignore-time-conflict --no-options --no-default-keyring --secret-keyring /etc/apt/secring.gpg --trustdb-name /etc/apt/trustdb.gpg --keyring /etc/apt/trusted.gpg --primary-keyring /etc/apt/trusted.gpg --keyserver keyserver.ubuntu.com --recv-keys 2524246B1CC723DBgpg: requesting key 1CC723DB from hkp server keyserver.ubuntu.comgpg: key 1CC723DB: public key "Launchpad PPA for Chris Coulson" importedgpg:

Total number processed: 1gpg: imported: 1  (RSA: 1)

The important part of the above output is the final line, indicated that 1 of 1 key was processed. That PPA (or repository) can now be used.

Finding repos and PPA

There are plenty of repositories and PPAs out there. One very good place to start (other than Google) is Launchpad. When you go to launchpad you can search under Registered PPAs, Published sources, Active PPAs, and Published binaries. This site also breaks down PPAs according to release, which includes 6.06 to 11.04. Of course this is a Ubuntu-only site, so those repositories will only work for Ubuntu and distributions based on Ubuntu.

GUI

There is a GUI called gui-apt-key. You can find that in Synaptic (search for "gui-apt-key",  mark it for installation, and click Apply to install.) This tool basically allows you to take the key ID, enter it in a small text area, and push the Add button in order to add a key to your keyring. If you prefer a GUI tool, it's a good route to go. Personally, I prefer using the command line, as it is more reliable and more flexible.

Final thoughts

Sometimes those apt errors can be a real pain. But when the error is a missing key, there is always a quick solution for adding that key.

Advertisement

Previous Post: «
Next Post: «

Comments

  1. crazy_player said on November 26, 2013 at 4:13 pm
    Reply

    when i put dis command:
    sudo apt-key adv –keyserver keyserver.ubuntu.com –recv-keys KEY_ID

    i get this error intstead of what is showen in your above instructions

    Executing: gpg –ignore-time-conflict –no-options –no-default-keyring –secret-keyring /tmp/tmp.2yi87VfIwA –trustdb-name /etc/apt//trustdb.gpg –keyring /etc/apt/trusted.gpg –primary-keyring /etc/apt/trusted.gpg –keyserver keyserver.ubuntu.com –recv-keys KEY_ID
    gpg: “KEY_ID” not a key ID: skipping

    now what is this error and what i have to do to solve this ??

  2. Shane said on May 24, 2012 at 4:20 pm
    Reply

    It appears that the add-apt-repository command will take care of all of this for you.

    http://manpages.ubuntu.com/manpages/lucid/man1/add-apt-repository.1.html

  3. Will said on April 1, 2011 at 3:34 am
    Reply

    Ubuntu Tweak @ http://ubuntu-tweak.com/

    Awesome for adding PPAs if you are a Ubuntu User.

    Has a built in list that is updated frequently.

    Even more are listed at their website, on this page

    http://ubuntu-tweak.com/source/

Leave a Reply

Check the box to consent to your data being stored in line with the guidelines set out in our privacy policy

We love comments and welcome thoughtful and civilized discussion. Rudeness and personal attacks will not be tolerated. Please stay on-topic.
Please note that your comment may not appear immediately after you post it.