How to Fix Apt-Get GPG error NO_PUBKEY Ubuntu 14

Fix Apt-Get GPG error NO_PUBKEY Ubuntu

In this tutorial, we will show you how to fix apt-get GPG error NO_PUBKEY on Ubuntu 14. For those of you who didn’t know, The apt packaging system has a set of trusted keys that determine whether a package can be authenticated and therefore trusted to be installed on the system. Sometimes the system does not have all the keys it needs and runs into this issue. Fortunately, there is a quick fix. Each key that is listed as missing needs to be added to the apt-key manager so that it can authenticate the packages.

This article assumes you have at least basic knowledge of Linux, know how to use the shell, and most importantly, you host your site on your own VPS. The installation is quite simple and assumes you are running in the root account, if not you may need to add ‘sudo‘ to the commands to get root privileges. I will show you through the step-by-step Fix Apt-Get GPG error NO_PUBKEY on Ubuntu 14.

This morning when I do apt-get update on my new Ubuntu 14.04 server, I got these error messages:

Reading package lists... Done
W: GPG error: http://security.ubuntu.com trusty-security Release: The following signatures couldn't be verified because the public key is not available: NO_PUBKEY 40976EAF437D05B5 NO_PUBKEY 3B4FE6ACC0B21F32
W: GPG error: http://archive.canonical.com trusty Release: The following signatures couldn't be verified because the public key is not available: NO_PUBKEY 40976EAF437D05B5 NO_PUBKEY 3B4FE6ACC0B21F32
W: GPG error: http://archive.ubuntu.com trusty Release: The following signatures couldn't be verified because the public key is not available: NO_PUBKEY 40976EAF437D05B5 NO_PUBKEY 3B4FE6ACC0B21F32
W: GPG error: http://archive.ubuntu.com trusty-updates Release: The following signatures couldn't be verified because the public key is not available: NO_PUBKEY 40976EAF437D05B5 NO_PUBKEY 3B4FE6ACC0B21F32

Fix Apt-Get GPG error NO_PUBKEY Ubuntu

Fix Apt-Get GPG error NO_PUBKEY Ubuntu

After did some small research on Google, I found a way to overcome this GPG NO_PUBKEY error by downloading the missing key using apt-key tools. The command is as follow:

apt-key adv --keyserver keyserver.ubuntu.com --recv-keys 40976EAF437D05B5

Command result:

Executing: gpg --ignore-time-conflict --no-options --no-default-keyring --homedir /tmp/tmp.nbL6QNuTxI --no-auto-check-trustdb --trust-model always --keyring /etc/apt/trusted.gpg --primary-keyring /etc/apt/trusted.gpg --keyserver keyserver.ubuntu.com --recv-keys 40976EAF437D05B5
gpg: requesting key 437D05B5 from hkp server keyserver.ubuntu.com
gpg: key 437D05B5: public key "Ubuntu Archive Automatic Signing Key <[email protected]>" imported
gpg: Total number processed: 1
gpg:               imported: 1

Second command:

apt-key adv --keyserver keyserver.ubuntu.com --recv-keys 3B4FE6ACC0B21F32

Result:

Executing: gpg --ignore-time-conflict --no-options --no-default-keyring --homedir /tmp/tmp.scMJ2LlY0s --no-auto-check-trustdb --trust-model always --keyring /etc/apt/trusted.gpg --primary-keyring /etc/apt/trusted.gpg --keyserver keyserver.ubuntu.com --recv-keys 3B4FE6ACC0B21F32
gpg: requesting key C0B21F32 from hkp server keyserver.ubuntu.com
gpg: key C0B21F32: public key "Ubuntu Archive Automatic Signing Key (2012) <[email protected]>" imported
gpg: Total number processed: 1
gpg:               imported: 1  (RSA: 1)

Notice that codes 40976EAF437D05B5 and 3B4FE6ACC0B21F32 were taken from the error messages above. Now you can do apt-get update again and you should have no error anymore.

Congratulations! You have successfully fixed apt-get GPG error. For additional help or useful information, we recommend you check the official Ubuntu website.

VPS Manage Service Offer
If you don’t have time to do all of this stuff, or if this is not your area of expertise, we offer a service to do “VPS Manage Service Offer”, starting from $10 (Paypal payment). Please contact us to get the best deal!

Tags: