vanarie's picture

Recently APT-GET started having problems resolving to install packages.

The fix is easy:

1) Add this to the end of file /etc/hosts

2) Restart network from the command line: 

#/etc/init.d/networking restart
Liraz Siri's picture

If Ubuntu ever move the server to another address those IP addresses will be broken so its best to solve this problem by using a reliable DNS server, like Google's:
You can configure the nameserver in the configuration console if you configure your address with a static IP. You can also add it to /etc/resolv.conf but if you later use the configuration console those changes might get overwritten.
JP's picture

Hi all,

  Liraz Siri's comment is important.  I had same problem, and the original solution worked (kudos and thanks to vanarie).

However, the root of the problem was not the network of my server, but the fact that my VPN client had overwritten resolv.conf

Adding proper nameservers like Liraz mentioned solved the root of the problem.




Guest's picture

he thanks for the fix you doing fine .how eo you do that?
Helder's picture

I fix this problem changing the order in the file /etc/nsswitch.conf, line host. Put the option dns in the beginning ( I put after files ).

hosts:          files dns wins mdns4_minimal [NOTFOUND=return] mdns4



Chris's picture

I realize this is a very old thread but this finally fixed my issue.  I moved 'dns' right after 'files' and I can now update and install packages.

Girish S's picture

Hi vanarie

Thanks for your inputs. It helped me fix the same problem in virtualbox setup having ubuntu guest OS.


Girish S

gary's picture

just installed ubuntu lots of problems have to reboot machine several times to get to desktop and when i finally do and download updates it will only install 40% and stops at configuring hpijs tired of messing with it any help befor i strip it off my machine and find something else

Jeremy Davis's picture

Do you mean one of the Ubuntu based Turnkey Linux appliances? If not you're not in the right place... I suggest that you try the Ubuntu forums (or at least start a new forum thread in the 'general' section because it doesn't apply to this thread). TKL appliances don't have a desktop (they are server appliances).

If you do mean TKL then you need to supply a bit more info. perhaps post some screenshots of something.

Jaspreet's picture

thank you . you saved me a lot of time .... :) cheers ..

D. Scott's picture

Solved the problem! Thanks!

mike's picture

This worked for me!! (First solution). I was so scared that something wrong was with my OS...but this saved me. Thanks a bunch!

Emil's picture

I have come across the same error. Unfortunately Vanarie's solution is not working anymore
Jeremy Davis's picture

Better to fix the actual problem (which is likely DNS resolution). As Liraz writes (2nd post in this thread) if you use a reliable DNS server, you shouldn't have these sort of issues anyway...

Add new comment