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 18.104.22.168). This time the address looked like version 6.
To force apt-get to use IPv4 exclusively
- Create a file in /etc/apt/apt.conf.d/99force-ipv4
- Add this line to newly created file Acquire::ForceIPv4 true;
- Apt-get will now use IPv4 exclusively
This article on StackExchange helped me find the right answer!
Convince apt-get *not* to use IPv6