Apt-get update not working in Ubuntu 16.04 "temporary failure resolving" [duplicate]

First of all I am new to Linux command line. I never worked with it before. My problem is that the command apt-get update will just return:

Err:1 xenial InRelease Temporary failure resolving 'us.archive.ubuntu.com'
Err:2 xenial-security InRelease Temporary failure resolving 'us.archive.ubuntu.com'
Err:3 xenial-updates InRelease Temporary failure resolving 'us.archive.ubuntu.com'
Reading package lists... Done
W: Failed to fetch Temporary failure resolving 'us.archive.ubuntu.com'
W: Failed to fetch Temporary failure resolving 'us.archive.ubuntu.com'
W: Failed to fetch Temporary failure resolving 'us.archive.ubuntu.com'
W: Some index files failed to download. They have been ignored, or old ones used instead.

My sources.list file looks like this:

#------------------------------------------------------------------------------#
# OFFICIAL UBUNTU REPOS #
#------------------------------------------------------------------------------#
###### Ubuntu Main Repos
deb xenial main restricted universe multiverse
deb-src xenial main restricted universe multiverse
###### Ubuntu Update Repos
deb xenial-security main restricted universe multiverse
deb xenial-updates main restricted universe multiverse
deb-src xenial-security main restricted universe multiverse
deb-src xenial-updates main restricted universe multiverse

My ubuntu version is:

Ubuntu 16.04.2 LTS (GNU/Linux 4.4.0-66-generic x86_64)
4

3 Answers

I had the same issue. The heart of the problem was an inability to resolve DNS. I was missing my /etc/resolv.conf file.

The contents of it should be:

nameserver 8.8.8.8
nameserver 8.8.4.4

Afterwards, restart the correct interface (mine was lo instead of eth0). You can find it in the /etc/network/interfaces file.

3

I had the same issue, caused by incorrect DNS settings:

sudo nano /etc/network/interfaces

In this file set a correct DNS server: dns-nameservers 8.8.8.8

sudo ifdown eth0 && sudo ifup eth0

I had this same issue, but a slightly different error message. This worked for me:

sudo nano /etc/network/interfaces

Find the line for dns-nameserver. If you don't have it, add it like this:

dns-nameserver 208.067.222.222

That is the address for OpenDNS. You can also use 8.8.8.8, which is address for Google Public DNS.

You Might Also Like