Ubuntu – WARNING: The following packages cannot be authenticated. `apt-key update` doesn’t work

apt

I'm trying to install bitcoind by simply doing sudo apt-get install bitcoind, but I get this error saying that the following packages could not be authenticated:

libdb5.1++ libcrypto++9 bitcoind

I can simply install them without authenticating them, but since this program may handle money, I would like them to be the correct ones. So I found this solution here on AskUbuntu, which suggests to do the following:

$ sudo apt-key update
$ sudo apt-get update

After the first command, it lists four keys of which it says that all remain unchanged. The second command simply does the usual, but it ends with a message saying that there was a GPG-error. After some blabla, it then says that the following signatures are invalid (freely translated from Dutch):

BADSIG 16126D3A3E5C1192 Ubuntu Extras Archive Automatic Signing Key <ftpmaster@ubuntu.com>
BADSIG 40976EAF437D05B5 Ubuntu Archive Automatic Signing Key <ftpmaster@ubuntu.com>

And the following signatures could not be verified because the public key is not available:

NO_PUBKEY 1F968B3903D886E7

And the following sugnatures were invalid:

BADSIG E585066A30C18A2B Opera Software Archive Automatic Signing Key 2013 <packager@opera.com>

And that getting stuff from the following address has failed:

 http://extras.ubuntu.com/ubuntu/dists/precise/Release

Does anybody know what I can do to solve this?

Best Answer

You have to add the pub key manually.

The command is

sudo apt-key adv --recv-key --keyserver keyserver.ubuntu.com «key number»

where «key number» you must replace it with the missing key.

For example in this error you received

NO_PUBKEY 1F968B3903D886E7

you can do

sudo apt-key adv --recv-key --keyserver keyserver.ubuntu.com 1F968B3903D886E7
sudo apt-get update

That way you will download this key in your keyring from the keyserver (keyserver.ubuntu.com)

About the BADSIG error, check this answer here