I have a 12.04 LTS VPS that no longer seems to be able to apt-get
anything. It connects ok for security patches, but on installing anything just hangs at 0%
trying to connect to us.archive.ubuntu.com
. I tried pinging us.archive.ubuntu.com
and that's working. Anyone know how to solve this?
2 Answers
Having the same issue led me to another post on forcing apt-get to acquire IPv4 connection which resolved my issue. I have quoted the answer from the other forum for convenience.
Add
-o Acquire::ForceIPv4=true
when running apt-get.If you want to make the setting persistent just create /etc/apt/apt.conf.d/99force-ipv4 and put
Acquire::ForceIPv4 "true";
in it.Config options Acquire::ForceIPv4 and Acquire::ForceIPv6 were added to version 0.9.7.9~exp1 (see bug 611891) which is available in Ubuntu Saucy (released in october 2013) and Debian Jessie (not released yet).
Source: https://unix.stackexchange.com/questions/9940/convince-apt-get-not-to-use-ipv6-method
Updating this for future readers, I found out I could fix it by switching to prefer v4 over v6 using /etc/gai.conf.
wget --debug http://us.archive.ubuntu.com/ubuntu/project/trace/pepo.canonical.com
do?