Ubuntu apt-get Hangs At 0%

Ubuntu apt-get Hangs At 0%

apt-get-stuck-0-percent

I had an issue where I installed Ubuntu 14.04 in VirtualBox and apt-get kept hanging at 0%.

I noticed it was automatically attempting to use IPv6 because normally apt-get says connecting to us.archive.ubuntu.com the IPv4 address (eg 0% connecting to us.archive.ubuntu.com 111.111.111.111). This time the address looked like version 6.

To force apt-get to use IPv4 exclusively

  1. Create a file in /etc/apt/apt.conf.d/99force-ipv4
  2. Add this line to newly created file Acquire::ForceIPv4 true;
  3. Apt-get will now use IPv4 exclusively

 

This article on StackExchange helped me find the right answer!
Convince apt-get *not* to use IPv6