Tag Archives: apt-get

Fix PGP error NO_PUBKEY when apt-get updating

28 Oct

It is common to find that a  sudo apt-get update does not do a clean job because of a couple of missing public keys. You might get something of the type:

W: GPG error: <a href="http://ppa.launchpad.net">http://ppa.launchpad.net</a> trusty InRelease: The following signatures couldn't be verified because the public key is not available: NO_PUBKEY 8BAF9A6F

Usually, it is possible to directly fetch the missing public key from a popular key server like Ubuntu’s:

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

… where PUBKEY is replaced by the right identifier in your warning message.

That is usually enough and concludes with gpg: Total number processed: 1

However, if the key is not found on the server, you might have to look for it yourself. For example, in the case of the following error:

W: GPG error: http://download.opensuse.org  Release: The following signatures couldn't be verified because the public key is not available: NO_PUBKEY F2AA0B1E5EF8303B

… the missing key was not available on the Ubuntu key server. I had to first check what exactly the problematic source’s URL looked like, which you can do by either using your distribution’s updater’s GUI (for example, Muon Update Manager > More… > Advanced … > Configure software sources), or by finding it in /etc/apt/sources.list or /etc/apt/sources.list.d/. In my case, the URL was http://download.opensuse.org/repositories/home:/antonbatenev:/tox/xUbuntu_14.04/, which is where I navigated to in my Internet browser to find a Release.key file.

Once you have downloaded that key, you can use the following command to add it to your keyring:

sudo apt-key add Downloads/Release.key

(Make sure you replace Downloads/Release.key with the right path/name.)

Now, you should be able to re-run sudo apt-get update and not run into any warning!

Advertisements