Fix GPG signature verification error on Ubuntu

ubuntu_logo_81x81I had been receiving errors like the following on Ubuntu 14.04 when trying to update my packages from synaptic:

The following signatures couldn't be verified because the public key is not available: NO_PUBKEY 16126D3A3E5C1192
The following signatures couldn't be verified because the public key is not available: NO_PUBKEY 40976EAF437D05B5 NO_PUBKEY 3B4FE6ACC0B21F32
and so on ...

This happens when you add too many trusted keyrings which GPG can’t handle. Not your fault either. Keyrings keep adding up as you add more and more PPAs. The solution is to remove the keyrings which you do not need. Try the following:

$ sudo cp -rvf etc/apt/trusted.gpg.d/ /etc/apt/trusted.gpg.d.backup
$ cd etc/apt/trusted.gpg.d/
$ ls

Now start removing the .gpg files you no longer need. For example:

$ sudo rm linvinus-altyo.gpg*

If it’s not clear from the file name and you are wondering which package the PPA provides, Google the file name (without the .gpg extension) “+ PPA” and check the contents of the PPA online.

In case you have removed a necessary key, run the following:

$ sudo apt-key adv --keyserver keyserver.ubuntu.com --recv-keys [MISSING KEY]
e.g.
$ sudo apt-key adv --keyserver keyserver.ubuntu.com --recv-keys 40976EAF437D05B5

If everything goes fine, remove the backup directory:

$ sudo rm -rf /etc/apt/trusted.gpg.d.backup

Comment

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s