Ubuntu: add-apt-repository hangs

Linux howto's, compile information, information on whatever we learned on working with linux, MACOs and - of course - Products of the big evil....

Ubuntu: add-apt-repository hangs

Postby ^rooker » Wed Mar 18, 2020 9:40 pm

[PROBLEM]
Trying to add a new PPA, using the (already) good-old "add-apt-repository" just hangs and waits forever. Nothing happens. Probably timeout of some kind.
I run into this on every new installation since 18.04, and I keep forgetting what it was. Shame on me...

[SOLUTION]
APT is trying IPv6, but won't get anywhere.

Thanks to Zach Adams fix suggestion (2015), I now now a better way than disabling IPv6 for APT:


1) Open /etc/gai.conf
Make a backup of it before. Just in case. For example copy it to "/etc/gai.conf.org"

2) Uncomment the following line:

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


"This will allow you to still use IPv6 but sets IPv4 as the precedence so that apt-get won’t get stuck."


That's it! :D
Thanks Zach!
  • 0

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!
User avatar
^rooker
Site Admin
 
Posts: 1450
Joined: Fri Aug 29, 2003 8:39 pm
Reputation: 0

Return to Knowledge Base

Who is online

Users browsing this forum: Google [Bot] and 8 guests

Who is online over last 24 hours

Users browsed this forum in the last 24 hours: Google [Bot] and 19 guests

Reputation System ©'