Saturday, September 19, 2009

GPG Error - Public Key Not Available

In 64-bit Ubuntu 9.04 (Jaunty Jackalope), I received this message after clicking the Check button in (System > Administration >) Update Manager:

W: GPG error: http://deb.opera.com stable Release: The following signatures couldn't be verified because the public key is not available: NO_PUBKEY F9A2F76A9D1A0061
The recommended solution was to type this into Terminal:
gpg --keyserver keyserver.ubuntu.com --recv [last 8 characters of code]; gpg --export --armor [last 8 characters of code] | sudo apt-key add
In my case, as shown above, those last eight characters were 9D1A0061, so that's what I entered into the command just given. This gave me a message, "gpg: requesting key 9D1A0061 from hkp server keyserver.ubuntu.com." But then we went no further: after several minutes, I got this message:
gpg: keyserver timed out gpg: keyserver receive failed: keyserver error [sudo] password for ray: gpg: WARNING: nothing exported
and then it just seemed to hang there. So I tried a different approach. Although "apt-key update" was supposed to work, it didn't; it gave me this:
gpg: can't access `/etc/apt/trustdb.gpg': Permission denied gpg: fatal: can't init trustdb: trust database error secmem usage: 0/0 bytes in 0/0 blocks of pool 0/32768
Continuing, then, with what looked like an earlier approach at that same webpage, I tried this:
gpg --keyserver wwwkeys.eu.pgp.net --recv-keys F9A2F76A9D1A0061 sudo apt-key add /root/.gnupg/pubring.gpg apt-get update
. . . using, in other words, the full key from the error message in the first of these three command line entries. This approach appeared to be working better: the first line got me an indication that a key had been imported. But the second line ("apt-key add ...") resulted in an error: "gpg: can't open `/root/.gnupg/pubring.gpg': No such file or directory." I was still getting the error when I clicked "Check" in Update Manager. A comment added to the instructions cited above suggested using this:
sudo apt-get install debian-archive-keyring
but I still got the same error in Update Manager. Another comment said this would work:
apt-key list apt-key del [last 8 digits of key shown as expired in the apt-key list output] [repeat this del command for each such expired key] dpkg –purge debian-archive-keyring apt-get install debian-archive-keyring
I got tired of typing "sudo" in front of each line, so I just typed "sudo -i" and then started down this list. I only got to the first command: it appeared that I didn't have any expired keys. So this wasn't the fix for me. Still another suggestion from the comments in that same webpage:
sudo apt-get update -o Acquire::http::No-Cache=True
This ran, and then advised me to run apt-get update. I ran that twice, but still got that same message about the Opera key, and the same error message persisted when I ran Update Manager. From a Debian page that I located by doing a search for the specific NO_PUBKEY error message (above), I got this:
wget -O - http://deb.opera.com/archive.key | sudo apt-key add -
and that seemed to solve the problem.

4 comments:

Unknown

You probably want to put the solution that actually works up at the top of this article.... why bother posting the ones that don't work at all?

anyways, thanks for the help, typing

sudo wget -O - http://deb.opera.com/archive.key | sudo apt-key add -

worked for me

raywood

Benjamir - it's a good question. I have several reasons for doing it this way: (1) Often, in these long posts, I cover answers that did work for other people. (2) Sometimes the steps that work are successful because, in the process, I have changed other settings, updated drivers, etc. If people go directly to the bottom line, it may not work for them because they won't have done the intermediate stuff. (3) There are usually a number of sites that do what you suggest. My purpose is not just to state "the answer," but to log the process.

Iphien

Perfect, it works for me with Ubuntu 9.04 Jaunty. Thanks.

tanjib

It didn't work for me. I typed the code and it came

--2010-06-21 09:43:56-- http://deb.opera.com/archive.key
Resolving deb.opera.com... 195.189.143.183
Connecting to deb.opera.com|195.189.143.183|:80... connected.
HTTP request sent, awaiting response... 200 OK
Length: 2441 (2.4K) [application/pgp-keys]
Saving to: `STDOUT'

100%[======================================>] 2,441 12.2K/s in 0.2s

2010-06-21 09:43:58 (12.2 KB/s) - `-' saved [2441/2441]

OK


I still get the same error message from the Update Manager while clicking Check. Can anyone help?