apt-get update fails to fetch files, “Temporary failure resolving …” error
Err http://archive.canonical.com natty InRelease
Err http://security.ubuntu.com oneiric-security InRelease
Err http://extras.ubuntu.com natty InRelease
Err http://security.ubuntu.com oneiric-security Release.gpg
Temporary failure resolving ‘security.ubuntu.com’
Err http://archive.canonical.com natty Release.gpg
Temporary failure resolving ‘archive.canonical.com’
Err http://extras.ubuntu.com natty Release.gpg
Temporary failure resolving ‘extras.ubuntu.com’
Err http://gb.archive.ubuntu.com oneiric InRelease
Err http://gb.archive.ubuntu.com oneiric-updates InRelease
Err http://gb.archive.ubuntu.com natty-backports InRelease
Err http://gb.archive.ubuntu.com oneiric Release.gpg
Temporary failure resolving ‘gb.archive.ubuntu.com’
Err http://gb.archive.ubuntu.com oneiric-updates Release.gpg
Temporary failure resolving ‘gb.archive.ubuntu.com’
Err http://gb.archive.ubuntu.com natty-backports Release.gpg
Temporary failure resolving ‘gb.archive.ubuntu.com’
Reading package lists... Done
W: Failed to fetch http://gb.archive.ubuntu.com/ubuntu/dists/oneiric/InRelease
W: Failed to fetch http://gb.archive.ubuntu.com/ubuntu/dists/oneiric-updates/InRelease
W: Failed to fetch http://gb.archive.ubuntu.com/ubuntu/dists/natty-backports/InRelease
W: Failed to fetch http://security.ubuntu.com/ubuntu/dists/oneiric-security/InRelease
W: Failed to fetch http://archive.canonical.com/ubuntu/dists/natty/InRelease
W: Failed to fetch http://extras.ubuntu.com/ubuntu/dists/natty/InRelease
W: Failed to fetch http://archive.canonical.com/ubuntu/dists/natty/Release.gpg Temporary failure resolving ‘archive.canonical.com’
W: Failed to fetch http://security.ubuntu.com/ubuntu/dists/oneiric-security/Release.gpg Temporary failure resolving ‘security.ubuntu.com’
W: Failed to fetch http://extras.ubuntu.com/ubuntu/dists/natty/Release.gpg Temporary failure resolving ‘extras.ubuntu.com’
W: Failed to fetch http://gb.archive.ubuntu.com/ubuntu/dists/oneiric/Release.gpg Temporary failure resolving ‘gb.archive.ubuntu.com’
W: Failed to fetch http://gb.archive.ubuntu.com/ubuntu/dists/oneiric-updates/Release.gpg Temporary failure resolving ‘gb.archive.ubuntu.com’
W: Failed to fetch http://gb.archive.ubuntu.com/ubuntu/dists/natty-backports/Release.gpg Temporary failure resolving ‘gb.archive.ubuntu.com’
W: Some index files failed to download. They have been ignored, or old ones used instead.
This is what I'm seeing when I try to run sudo apt-get update
. I did an update on my instance yesterday and am now experiencing this.
overview
There are two parts to your question:
- fixing temporary resolve messages
- fixing the package management issues
Temporary resolve
It is likely that this issue is either:
- temporary due to your Internet Service Provider not correctly forwarding internet naming (DNS) to either its or external DNS servers, or
- due to a change in your network has similarly blocked this naming - for example, new router/modem, reconfiguring a switch with a new configuration.
Lets look at the possible DNS resolving issues.
First, temporarily add a known DNS server to your system.
echo "nameserver 8.8.8.8" | sudo tee /etc/resolv.conf > /dev/null
Then run sudo apt-get update
.
If this fixes your temporary resolving messages then either wait for 24 hours to see if your ISP fixes the issue for you (or just contact your ISP) - or you can permanently add a DNS server to your system:
echo "nameserver 8.8.8.8" | sudo tee /etc/resolvconf/resolv.conf.d/base > /dev/null
8.8.8.8
is Google's own DNS server.
source
Another example DNS server you could use is OpenDNS - for example:
echo "nameserver 208.67.222.222" | sudo tee /etc/resolvconf/resolv.conf.d/base > /dev/null
package-management issues
In addition to the temporary resolve issues - you have a few package management issues that need to be corrected - I'm assuming you have tried recently to upgrade from one Ubuntu version to the next recommended version - in your case from Natty (11.04) to Oneiric (11.10)
Open a terminal and type
sudo nano /etc/apt/sources.list
Look for lines that have your a different distribution name in the list than you were expecting - in your case - you have upgraded to oneiric
but you have another release name natty
For example, look for lines that look like deb http:/archive.canonical.com/ natty backports
Add a #
to the beginning of the line to comment it out - for example
#deb http:/archive.canonical.com/ natty backports
Save and re-run:
sudo apt-get update && sudo apt-get upgrade
You should not have any more release naming errors.
At the time of writing this, possible common release names include lucid
, maverick
, natty
, oneiric
, precise
, quantal
, raring
, saucy
, trusty
, utopic
and vivid
.
You can comment the unresolved repo from the file sources.list found on dir /etc/apt/
After modifying the sources.list, clean the apt-get repo as
apt-get clean
Then update
apt-get update
The error will gone away
Note that this answer was written for old versions of Ubuntu. Current versions use a local nameserver controlled by D-Bus, for which the diagnosis part of this answer applies, but not the solution. If /etc/resolv.conf
contains nameserver 127.0.1.1
or more generally nameserver 127.X.Y.Z
, don't modify it.
“Temporary failure resolving …” means that your DNS, i.e. the translation from host names to IP addresses, is not working. Did you reconfigure something on your machine recently? If not, this may be a transient error at your ISP.
Does ping -n 8.8.8.8
show lines like 64 bytes from 8.8.8.8: …
? (Press Ctrl+C to stop ping
.)
- If it doesn't, you specifically have an IP connectivity problem. Run
traceroute -n 8.8.8.8
and see where it stops: if it's in your home/office, check your networking equipment. If you can reach your ISP, complain to them. - If it does, you specifically have a DNS problem. Check the contents of
/etc/resolv.conf
; there should be a line likenameserver 1.2.3.4
(possibly more than one of them). If the lines are there, there is probably a transient problem within your ISP, and you may be able to work around it by addingnameserver 8.8.8.8
to that file (this declares an extra DNS server, which is provided free of charge by Google). If the first number afternameserver
is 127, then there is a DNS relay on your machine (this is a good thing), and you must configure that DNS relay rather than modify/etc/resolv.conf
. On modern versions of Ubuntu, there is a DNS relay by default, it's Dnsmasq, and it's controlled by D-Bus.
This issue can also be caused by a wrongly named interface. For example a Temporary failure resolving
error message can be caused by an interface which is not named eth0
but is incorrectly named eml
instead.
Another way to solve the a Temporary failure resolving
error message is by choosing a different update server mirror.
-
Open Software & Updates from the Dash and select Ubuntu Software tab -> from the dropdown menu to the right of Download from: select Other....
-
Click the Select the Select Best Server button to select the best download server.
-
A series of tests will be performed to find the best mirror for your location.
-
Click Choose Server to select the recommended server.