Saturday, September 11, 2010

Apt-get problems and Temporary failure resolving 'us.archive.ubuntu.com'

Experience problems when trying to install or running update with apt-get in Linux, Ubuntu or other distributions?

When running ie. apt-get update you may get error message like:


Temporary failure resolving 'us.archive.ubuntu.com'
Temporary failure resolving 'archive.ubuntu.com'

Err http://archive.ubuntu.com lucid Release.gpg Temporary failure resolving 'archive.ubuntu.com'

W: Failed to fetch http://archive.ubuntu.com/ubuntu/dists/lucid/main/i18n/Translation-en_US.lzma Temporary failure resolving 'archive.ubuntu.com'


The problem is that apt-get can't reach the destination files for some reasons.

One possible answer to this problem is that this is an temporary problem because the servers are not available for the moment.
You may also want to check your source.list @ /etc/apt/sources.list

One possible solution for this problem is to check your iptables configuration so you aren't blocking outgoing connection that are needed to be reached.

I solved the "Temporary failure resolving", apt-get failure on my VPS by adding "-A OUTPUT -p udp -m udp --dport 53 -j ACCEPT" into my iptables configuration.

So making sure that this below are added to your iptables configuration can help and solve the Temporary failure resolving issue.

-A OUTPUT -p udp -m udp --dport 53 -j ACCEPT
-A OUTPUT -p tcp -m tcp --dport 80 -j ACCEPT