Fix for apt-get: Could not resolve 'archive.ubuntu.com'

vanarie's picture

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

The fix is easy:

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

91.189.88.46    archive.ubuntu.com
91.189.88.46    security.ubuntu.com

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:
nameserver 8.8.8.8
nameserver 8.8.4.4
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.

 

cheers,

JP

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

Thanks

Helder

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.

/Br

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!

Post new comment