Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

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 trying to install Mongodb on Ubuntu 12 but when I run this command:
sudo apt-key adv --keyserver --recv 7F0CEB10
This returned the error below: host not found
gpgkeys: HTTP fetch error 7: couldn't connect: no such file or directory
gpg:no valid openPGP data found
gpg: Total number processes :0

I turned off Firewall on Iptables, but it don't work. Is there any idea?

share|improve this question
Can your system resolve as an IP address? I.e, what's the output of dig – Xyon Jul 17 '13 at 14:36

This may not actually be a problem with looking up the keyserver, which is what the error suggests. The apt-key command calls gpg, which in turn tries to access the keyserver. Apparently there's a bug in gpg whereby if the keyserver doesn't have the key you are requesting, then gpg misinterprets that as "host not found".

It may well be that a non-responsive keyserver will do the same thing, and I have seen environments where the keyservers are blocked (corporate firewall rules), so that could be your root cause if there is an upstream firewall you do not have access to.

Just for reference, the key is there and the keyserver is currently responding for me:

$ sudo apt-key adv --keyserver --recv 7F0CEB10
Executing: gpg --ignore-time-conflict --no-options --no-default-keyring --secret-keyring /tmp/tmp.rh1myoBdSE --trustdb-name /etc/apt//trustdb.gpg --keyring /etc/apt/trusted.gpg --primary-keyring /etc/apt/trusted.gpg --keyserver --recv 7F0CEB10
gpg: requesting key 7F0CEB10 from hkp server
gpg: key 7F0CEB10: "Richard Kreuter <>" not changed
gpg: Total number processed: 1
gpg:              unchanged: 1

It may be that the port is the issue (it was the last time when I hit a corporate firewall problem), so try doing this on the standard HTTP port (80) instead, see if that sorts things out:

sudo apt-key adv --keyserver hkp:// --recv 7F0CEB10
share|improve this answer

I faced the same issue as my machine is behind a corporate proxy. Adding the gpg --keyserver-option http-proxy made the trick. Looks like:

sudo apt-key adv --keyserver-options http-proxy=<myProxy> --keyserver --recv 7F0CEB10
share|improve this answer
Thanks! Good that I didn't stop reading at the top... – Moraru Lilian Apr 12 at 13:20

If you are using a proxy, for example companies proxy than probably the only way is to enter this manually, which is very easy. Run:

sudo apt-get update

and get the id of the pub_key. Then go to and search for the key as a hexidecimal, for example if key is 7936A783B, then search for 0x7936A783B. Click on the pup link and copy the keys content and save it to a txt file. Go to terminal and navigate to the file and run:

sudo apt-key add key.txt

If it works, you will get a simple OK feedback. When all keys are added, then you may run:

sudo apt-get update

and there you have it!

share|improve this answer

The second approach mentioned in this link worked for me. Manually download the key and add it. The link provides step by step procedure to fix the error happening due to missing key.

share|improve this answer

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.