Problem with IPv6 sudo apt-get update/upgrade

I am using Ubuntu 16.04 Beta 2 at the moment and every time I try to update at home via sudo apt-get update or upgrade trough sudo apt-get upgrade I wont get any feedback. Even installing of anything will have the same result. It will just "hang up" on 0% while fetching data.

$ sudo apt-get update
[sudo] password for niclas: 
0% [Connecting to archive.ubuntu.com (2001:67c:1560:8001::11)] [Connecting to archive.canonical.com (2001:67c:1360:8c01::1b)]

I have no idea how to solve the problem. I already tried to ping6 archive.ubuntu.com with 100% packet loss while just ping wont have any loss.

I changed the DNS-Server (IPv4 & IPv6) to Google's one no solution either.


Solution 1:

Thanks to this Unix and Linux post by mmoya on Unix and Linux for the answer.

We can try and force apt to use IPv4 instead.

Try this command set, based off the information in the aforementioned link:

apt-get -o Acquire::ForceIPv4=true update
apt-get -o Acquire::ForceIPv4=true upgrade

This should force IPv4 in place of IPv6.


You can make this persistent for all apt-get in the future (so you don't have to provide the arguments to make this work) by doing the following (also from the other U&L post):

echo 'Acquire::ForceIPv4 "true";' | sudo tee /etc/apt/apt.conf.d/99force-ipv4

This will make a configuration file for apt and apt-get to parse, which will then include the ForceIPv4 true options going forward for all apt-get runs.