Chris Jean

WordPress developer for iThemes, Linux fan, all-around nerd, and @chrisjean on Twitter

Fix apt-get update “the following signatures couldn’t be verified because the public key is not available”

There are times when running apt-get update in Ubuntu will result in error messages such as the following:

[chris@server ~]$ sudo apt-get update
Ign http://security.ubuntu.com trusty-security InRelease
Get:1 http://security.ubuntu.com trusty-security Release.gpg [933 B]
...
Fetched 21.9 MB in 14s (1,537 kB/s)
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
[chris@server ~]$

If these errors aren’t fixed, apt will have problems when installing or upgrading packages. For example:

[chris@server ~]$ sudo apt-get upgrade
Reading package lists... Done
Building dependency tree... Done
Calculating upgrade... Done
...
E: Some packages could not be authenticated
[chris@server ~]$

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.

Looking at the error above, apt is telling us that the following keys are missing: 40976EAF437D05B5 and 3B4FE6ACC0B21F32. Notice that these are listed multiple times. Each unique key will only need to be added once.

To add these keys, run the following commands:

[chris@server ~]$ sudo apt-key adv --keyserver keyserver.ubuntu.com --recv-keys 40976EAF437D05B5
Executing: gpg --ignore-time-conflict --no-options --no-default-keyring --homedir /tmp/tmp.QTeppiINUh --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 " imported
gpg: Total number processed: 1
gpg: imported: 1
[chris@server ~]$ sudo apt-key adv --keyserver keyserver.ubuntu.com --recv-keys 3B4FE6ACC0B21F32
Executing: gpg --ignore-time-conflict --no-options --no-default-keyring --homedir /tmp/tmp.77TqYGKU7b --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) " imported
gpg: Total number processed: 1
gpg: imported: 1 (RSA: 1)
[chris@server ~]$

If the keys that your system is missing differs, simply replace the key at the end of the above command with your key and run it.

Did I help you? Send me a tip.

Categories : Linux

Comments

kemploe says:

April 14, 2015 at 9:35 am

this solved my problem

thank you !

Reply

Meir Shani says:

April 23, 2015 at 3:49 pm

I’m sorry, did not work for me:

…
W: GPG error: http://download.opensuse.org Release: The following signatures couldn’t be verified because the public key is not available: NO_PUBKEY 0429ACCAF7AA50B3
~/ #

I tried the solution and it failed:

~/ # sudo apt-key adv –keyserver keyserver.ubuntu.com –recv-keys 0429ACCAF7AA50B3
Executing: gpg –ignore-time-conflict –no-options –no-default-keyring –secret-keyring /tmp/tmp.Nd5sw1reOg –trustdb-name /etc/apt/trustdb.gpg –keyring /etc/apt/trusted.gpg –primary-keyring /etc/apt/trusted.gpg –keyserver keyserver.ubuntu.com –recv-keys 0429ACCAF7AA50B3
gpg: requesting key F7AA50B3 from hkp server keyserver.ubuntu.com
gpgkeys: key 0429ACCAF7AA50B3 not found on keyserver
gpg: no valid OpenPGP data found.
gpg: Total number processed: 0
~/ #

Reply

Chris Jean says:

April 23, 2015 at 5:36 pm

It looks like openSUSE doesn’t maintain keys on the Ubuntu keyserver. You’ll have to manually download the appropriate key and add it to your system using add-key. You can find an example here.

Reply

Paulo Souza says:

July 1, 2015 at 9:04 pm

really really really really thanks!

Reply

Mark says:

September 12, 2015 at 11:57 am

Thanks – worked for me a treat!

Reply

lory says:

November 18, 2015 at 11:48 am

Grazie mille from Italy! (thank you so much!)

Reply

Howy says:

December 1, 2015 at 1:09 am

Many thanks!

Reply

Wally says:

December 8, 2015 at 4:49 pm

thanks man!

Reply

William says:

December 13, 2015 at 3:51 pm

Thank you for this info. Could not find the proper command to install the missing public key until this website.

Reply

darkki says:

December 28, 2015 at 1:21 am

Thanks works great!!!

Reply

MohamedRamadan says:

January 26, 2016 at 8:17 am

This is awesome … thank you
NOTE : Every one change the key with the key the error carry .. GOOD LUCK

Reply

krst0 says:

March 3, 2016 at 7:44 am

As others said – awesome!
So easy, just need to replace keys. I´ll bookmark this page.
Thank you very much. Regards, krst0

Reply

Freddy says:

March 18, 2016 at 2:25 am

Thank you for your helpful post. It solved my problem. Really.

Reply

KangDeb says:

April 1, 2016 at 1:13 pm

its work, thanks

Reply

Linux Mint: Moving the /home Folder to a Separate /home Partition | Ray Woodcock's Latest says:

April 25, 2016 at 9:24 pm

[…] couldn’t be verified because the public key is not available.” A search led to instructions to run this […]

Reply

Adam says:

May 3, 2016 at 7:23 am

Thanks! I’ve had that error hanging around for ever.

Reply

wow says:

June 9, 2016 at 4:16 am

tnx dude

Reply

Kingsley says:

June 12, 2016 at 11:06 am

Hello;

Thanks for this, it was helpful

Reply

Dockerizing WordPress in a multi-container architecture | Knowledge Base says:

June 20, 2016 at 9:25 am

[…] Apt-key commands https://chrisjean.com/fix-apt-get-update-the-following-signatures-couldnt-be-verified-because-the-pu&#8230; […]

Reply

Suici Doga says:

June 23, 2016 at 8:24 am

I had to run the following commands before this worked.

sudo mv /etc/apt/trusted.gpg.d/ /etc/apt/trusted.gpg.d.backup
sudo mkdir /etc/apt/trusted.gpg.d
sudo chmod 755 /etc/apt/trusted.gpg.d

Then run sudo apt-get update . You will see more key errors, add all the keys you see

Reply

Chris Jean says:

July 5, 2016 at 12:06 pm

Looks like you ran into the “keyblock resource” bug and followed the solution documented here. I’m making note of that resource in case others see your comment and want to know more.

Reply

Johnny G says:

July 4, 2016 at 4:34 pm

The gift that keeps on giving…

This site post has helped me now on two separate occasions so I’d like to pass on my heartfelt thanks.
I’ve used the info to help me sort out the nightmare of removing the dreaded/awful systemd from my systems.

Cheers.

Reply

Pablo says:

September 20, 2016 at 9:40 am

Thank youuuuuuu

Reply

c.w. says:

September 29, 2016 at 4:09 am

Thank you so much. Appreciate your help.

Reply

john says:

October 14, 2016 at 3:50 pm

Worked a treat, many thanks

Reply

Pranita says:

October 18, 2016 at 12:35 am

Thank you so much, it worked for me

Reply

Leave a Reply

Click here to cancel reply.

Name (required)

Mail (will not be published) (required)

Website

Notify me of followup comments via e-mail

I believe that the free flow of information and ideas is key to the past and future development of mankind. Unless the content declares otherwise, the post content on this site is declared public domain (CC0 1.0 Universal) and can be used in any manner with or without attribution or permission. Of course, if you wish to give attribution back to me, that would be very nice. :)

You can view this site's privacy policy here.
This site is running WordPress with the iThemes Builder theme by iThemes.