apt-get stuck connecting to security.ubuntu.com

ubuntu_logo_81x81If you are using IPv6, you might find a hung

$ sudo apt-get update

when it tries to connect to security.ubuntu.com servers.

At the moment there are problems connecting to some  of the servers over IPv6. Till it gets fixed, the workaround is to give preference to IPv4 over IPv6.

Edit /etc/gai.conf and change the following line:

#    For sites which prefer IPv4 connections change the last line to
#precedence ::ffff:0:0/96  100


precedence ::ffff:0:0/96  100

Here’s the relevant bug to check the status.

Leave a Reply

Your email address will not be published. Required fields are marked *