Fix GPG error NO_PUBKEY when apt-get update your Ubuntu

Some of you might encounter the following error when $apt-get update your Ubuntu system, like mine:

Fetched 24.0 MB in 9s (2542 kB/s)
Reading package lists... Done
W: GPG error: <a href="http://archive.canonical.com/" target="_blank">http://archive.canonical.com</a> 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: <a href="http://http//archive.ubuntu.com" target="_blank">http://archive.ubuntu.com</a> trusty-updates InRelease: The following signatures couldn't be verified because the public key is not available: NO_PUBKEY 40976EAF437D05B5 NO_PUBKEY 3B4FE6ACC0B21F32
W: GPG error: <a href="http://security.ubuntu.com/" target="_blank">http://security.ubuntu.com</a> trusty-security InRelease: The following signatures couldn't be verified because the public key is not available: NO_PUBKEY 40976EAF437D05B5 NO_PUBKEY 3B4FE6ACC0B21F32
W: GPG error: <a href="http://http//archive.ubuntu.com" target="_blank">http://archive.ubuntu.com</a> trusty Release: The following signatures couldn't be verified because the public key is not available: NO_PUBKEY 40976EAF437D05B5 NO_PUBKEY 3B4FE6ACC0B21F32

To solve it, simple add the missing key

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

If any other key is missing, simple change the key (3B4FE6ACC0B21F32) in the previous command with the missing key. Now try to run it again, and no more error is thrown.

Have fun!

Leave a Comment

Your email address will not be published. Required fields are marked *