Ran into this issue today where on a newly made Linode Ubunu 14.04 LTS server I ran
apt-get update
The command started alright however eventually it would reach a point where it got stuck at
Connecting to security.ubuntu.com (2001:67c:1562::16)
And wouldn’t continue no matter what. Turns out this is an issue where connecting over IPv6 on some servers causes them to get stuck at this point. The fix is really simple.
OpenĀ /etc/gai.conf
Uncomment the following line:
# # For sites which prefer IPv4 connections change the last line to # precedence ::ffff:0:0/96 100
This will allow you to still use IPv6 but sets IPv4 as the precedence so that apt-get won’t get stuck.
Let me know if you have any issues!