Running an apt-get update or an apt-get install occasionally times out on VMs that I am building before I have setup IPv6. Instead of waiting the (seemingly) long time for it to timeout, just add:
-o Acquire::ForceIPv4=true
to the end of the apt-get command to force IPv4.
And to make it permanent:
create /etc/apt/apt.conf.d/99force-ipv4 and put in it:
Acquire::ForceIPv4 "true";