Fixing NO_PUBKEY errors from Apt

The blog is currently being ported from WordPress to over 12 years of static pages of content. If there's an article missing that you're hoping to see, please contact me and let me know and I'll prioritize getting it online.

July 13, 2011


I’ve been ignoring a problem updating Diodon (a great clipboard manager) whenever Ubuntu’s daily Update Manager tries to alert me of new software updates. I finally opened a shell prompt, ran apt-get update and got this error:

signatures couldn't be verified because the public key is not 
available: NO_PUBKEY 751A20CF523884B2

Here’s how to fix any NO_PUBKEY error in two simple steps:

$ gpg --recv-keys 751A20CF523884B2
gpg: requesting key 523884B2 from hkp server keys.gnupg.net
gpg: /home/id/.gnupg/trustdb.gpg: trustdb created
gpg: key 523884B2: public key "Launchpad PPA for Diodon Team" 
imported
gpg: Total number processed: 1
gpg:               imported: 1  (RSA: 1)

$ gpg --armor --export 751A20CF523884B2 | sudo apt-key add -
OK</pre>
<div>Ta-da...&nbsp;<br /></div>
<pre>$ sudo apt-get upgrade
Reading package lists... Done
Building dependency tree       
Reading state information... Done
The following packages will be upgraded:
  diodon
1 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.
Need to get 55.4 kB of archives.
After this operation, 115 kB of additional disk space will be used.
Do you want to continue [Y/n]? y

Replace “751A20CF523884B2” with whatever public key value that Apt is complaining about. You can also specify which GPG server to connect to when using the --recv-keys flag, but if you leave it off, I believe it will just connect to their main pool of GPG databases.

image credit: http://www.computerhope.com/unix/apt-get.htm