20

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.

  • Have you taken a look at this post on Unix and Linux? It seems to me that it can 'force' IPv4 and not IPv6, though I haven't tested. – Thomas Ward Apr 20 '16 at 14:08
  • That might work thank you. Can you explain where in sudo apt-get update I have to put the AcquireIpv4? :S I am relativly new to Linux – Niclas Apr 20 '16 at 14:24
43

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.

  • 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
  • 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
  • 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
  • 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

Your Answer

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Not the answer you're looking for? Browse other questions tagged or ask your own question.