36

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.

David Foerster
  • 36,900
  • 56
  • 98
  • 152
Niclas
  • 365

1 Answers1

61

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.

Thomas Ward
  • 80,112
  • Okay so I just tried your last suggestion. Is that one here normal? niclas@ThinkPad:~$ sudo apt-get update [sudo] password for niclas: Reading package lists... Done E: Could not get lock /var/lib/apt/lists/lock - open (11: Resource temporarily unavailable) E: Unable to lock directory /var/lib/apt/lists/ – Niclas Apr 20 '16 at 17:10
  • Do you have a package manager open, or another update process (such as automated updates) running in the background? Something is currently using the apt lists, so it's eitiher dpkg or another apt/apt-get, or a package manager (Ubuntu Software Center, for example) or automatic updates – Thomas Ward Apr 20 '16 at 17:14
  • 1
    Other answers mentioned changes to /etc/gai.conf, but did not work out. This did though. Not sure why gai.conf doesn't. – Gauthier Oct 30 '16 at 21:21
  • 1
    Great thanks, but this still doesn't explain why it doesn't work over IPv6. Why can't Canonical just fix this server? – Adam Spiers Nov 26 '16 at 18:24
  • @AdamSpiers It very likely doesn't have to do with Canonical servers. In many more frequent cases it has to do with "bad" IPv6 handling on wherever your system is. This happens to me frequently at my home where IPv6 is "available" from the ISP but is not configured internally on the network or is otherwise being filtered. Forcing IPv4 usually solves that problem. – Thomas Ward Nov 26 '16 at 23:56
  • 4
    @ThomasWard Definitely not in my case - my ISP is a world leader in IPv6 which has been providing an IPv6 service for over 14 years, during which time they have vigorously tested compliance of devices at every hop of the network path, in many cases pushing hardware and software vendors to fix breakages. – Adam Spiers Nov 30 '16 at 17:40
  • Definitely this problem consists further and it must be caused by archive.canonical.com and ipv6. For me it occurs always while trying downloading flashplugin-installer:amd64 via ipv6. This takes up to 10 minutes to get connection but works then. – Axel Richter Feb 07 '18 at 05:01
  • @AxelRichter use a different mirror then, different mirrors are faster or slower sometimes. – Thomas Ward Feb 07 '18 at 16:38