Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I'm tring to add a keys (on Kubuntu 12.04)

sudo apt-key adv --keyserver --recv-keys SOMEKEY

and I constantly get

gpg: requesting key 8AC93F7A from hkp server
gpg: keyserver timed out
gpg: keyserver receive failed: keyserver error

I thought my ports are closed. But the following should have made ports 80 and 11371 open:

iptables -A INPUT -p tcp -d 0/0 -s 0/0 --dport 80 -j ACCEPT
iptables -A INPUT -p tcp -d 0/0 -s 0/0 --dport 11371 -j ACCEPT

But I still get timed out.


The following solves it:

sudo gpg --keyserver hkp:// --recv-keys SOMEKEY
share|improve this question
What version of Ubuntu is this? You need to add that so we can help you. – belkinsa May 10 '12 at 10:41
Kubuntu 12.04. I had the same problems in 11.10 and 11.04 – Adobe May 10 '12 at 10:43
I added the tags and edited your question with the info. – belkinsa May 10 '12 at 10:47
@Adobe To mark this question technically 'answered'; Kindly add an 'answer' and 'accept' it. You may need to wait a day or two to be able to accept your own answer,though. – Mahesh May 10 '12 at 11:53
up vote 14 down vote accepted

The following solves it:

sudo gpg --keyserver hkp:// --recv-keys SOMEKEY

If You see smth like this:

W: GPG error: jaunty Release: The following signatures couldn't be verified because the public key is not available: NO_PUBKEY 40976EAF437D05B5 

add the appropriate key:

sudo apt-key adv --keyserver --recv-keys 40976EAF437D05B5 

(You can list all the bad keys You have)

You can get a list of repos here: (but it is not recommended to add x-org updates - at least be sure to back up You xorg.conf)

If see errors from previous repos - empty Your /etc/apt/sources.list.d dir.

share|improve this answer

This saved my life behind corporate proxy, hope it helps you too:

sudo apt-key adv --keyserver-options http-proxy="http://<username>:<password>@<proxy_server_addr>:<proxy_port>" --keyserver hkp:// --recv-keys <key_to_import>
share|improve this answer
Just saved my life too! Thanks – Alexandre Neto Aug 3 '15 at 12:22

given that you are not a newbie since you tried by configuring iptables via the command line: are you still sure that this is not caused by your internet connection? I had a similar problem by adding repos when connected to the university wireless network, that obviously kept most ports well closed. Even some (few) internet providers make this kind of jokes sometimes.

share|improve this answer
Since most people don't seem to have such problems -- that must be due to my internet connection. sudo gpg --keyserver hkp:// --recv-keys SOMEKEY solves it and makes me satisfied. – Adobe May 10 '12 at 11:27
This is really a comment, not an answer. With a bit more rep, you will be able to post comments. Kindly 'delete' this answer to help keep the site clean. – Mahesh May 10 '12 at 11:49

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.