Ubuntu: APT waits forever connecting to repo over IPv6

Linux howto's, compile information, information on whatever we learned on working with linux, MACOs and - of course - Products of the big evil....
Post Reply
User avatar
^rooker
Site Admin
Posts: 1483
Joined: Fri Aug 29, 2003 8:39 pm

Ubuntu: APT waits forever connecting to repo over IPv6

Post by ^rooker »

[PROBLEM]
Suddenly, from one day to another my apt stopped working:
When updating the repository cache, it just stopped, waiting to connect to an up-and-running server - forever...

Like this:

Code: Select all

Hit:1 http://ppa.launchpad.net/kdenlive/kdenlive-stable/ubuntu xenial InRelease
Ign:3 https://mediaarea.net/repo/deb/ubuntu xenial InRelease
Hit:4 https://mediaarea.net/repo/deb/ubuntu xenial Release
Hit:6 http://ppa.launchpad.net/me-davidsansome/clementine-dev/ubuntu xenial InRelease
0% [Connecting to at.archive.ubuntu.com (2a00:1860:1:2::101)]
As the output shows, it tries to connect to "at.archive.ubuntu.com" using its IPv6 address. I must admit I don't know (yet) if my provider even supports IPv6 already, but anyways: it didn't work :(

[SOLUTION]
Quick hack/workaround is to disable IPv6 in APT.
1) Edit/create "/etc/apt/apt.conf.d/99force-ipv4"
2) Enter the following there, and save it:

Code: Select all

Acquire::ForceIPv4 "true";
Now your repository handling should be fine again:
$ apt update
Thanks to Xiao Guo-An's article about "How to Disable IPv6 on Ubuntu" (on linuxbabe.com)!
Jumping out of an airplane is not a basic instinct. Neither is breathing underwater. But put the two together and you're traveling through space!
Post Reply