Server Fault is a question and answer site for system and network administrators. 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 have a ubuntu 12.04 server. Running sudo apt-get update on it produces errors like this:

    W: Failed to fetch  Something wicked happened resolving '' (-5 - No address associated with hostname)

I am able to ping all the other hosts on the network and also Google's DNS But am unable to ping

So, I'm guessing something is wrong with my DNS setup, but not sure what.

I use static IP and my /etc/network/interfaces looks like this:

    auto eth0
    iface eth0 inet static

My /etc/resolv.conf and /etc/resolvconf/resolv.conf.d/base are both empty and my /etc/resolvconf/resolv.conf.d/original says:


Any help would be greatly appreciated.

P.S. I've googled it a bit and the common resolution is to switch to DHCP which I don't want to do since this is my home server.

Thanks Srini

share|improve this question
Update: Other searches ( suggest updating the DNS settings using Gnome. Since I don't have a GUI, I'm not sure which conf files that updates. – Srini Oct 14 '12 at 8:47
up vote 2 down vote accepted

Add your own (or a public) name server address to /etc/resolvconf/resolv.conf.d/base and run resolvconf -u to update the configuration.

Are the two addresses and from your network configuration the name servers you're supposed to use? In that case add those to the base file.

share|improve this answer
This is great. Thanks a lot. – Srini Oct 14 '12 at 14:02

Edit /etc/resolv.conf ; add:


(this will use opendns)

restart networking: /etc/init.d/networking restart

share|improve this answer
When the package resolvconf is installed, the file /etc/resolv.conf is auto-generated. Manual changes will be dropped without warning. – Ansgar Wiechers Oct 14 '12 at 12:52
Yes, the contents of /etc/resolv.conf re-affirms this. – Srini Oct 14 '12 at 14:02
Ok, seems I'm no longer up to date. I upvoted your solution :-) – johanvdw Oct 14 '12 at 15:33

DNS operation in Ubuntu 12.04 has changed substantially and in my opinion is slightly incomplete however it is an improvement, it's only lacking a local dns cache and can be installed manually.


How to correctly add static entries to resolv.conf is open up your terminal.

sudo nano /etc/resolvconf/resolv.conf.d/base

add two public and your local if you have one

nameserver [your_local]
  • Backup your existing resolv.conf

    cp /etc/resolv.conf ~/resolv.conf_backup

Now make sure /etc/resolv.conf is a symlink to /run/resolvconf/resolv.conf

sudo ln -s /run/resolvconf/resolv.conf /etc/resolv.conf

Reconfigure resolvconf package

sudo dpkg-reconfigure resolvconf

When asked "Prepare /etc/resolv.conf for dynamic updates?" select "yes" and follow instructions.


You can run into a situation where the default timeout can impede performance (delays of 5 seconds on name resolution can be quite costly especially to database / http services)

There are 3 ways you can resolve this problem:

  • add the name entries to your hosts file, This is more of a work around than a fix

    Edit your /etc/hosts and add static entries for the hosts. Please note this can prolong debugging later

  • alter the default timeout in resolvconf package

    sudo echo "options timeout:2" >> /etc/resolvconf/resolv.conf.d/tail

  • add a dns cache

    There are a few options I'm not going to cover.

share|improve this answer
Thanks for the detailed explanation. Great answer – Srini Oct 14 '12 at 14:03

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.