Take the 2-minute tour ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free, no registration required.

I have a Ubuntu 11.10 server that I just installed fresh. Now if I try to do anything with apt-get, it tries to connect to archive.ubuntu.com .. It stays at [Connecting to archive.ubuntu.com (2001:67c:1360:8c01::1a)] phase for like 2 minutes, after which it actually starts to communicate and download stuff ...

Eventually it always connects, but in waits at the [Connecting to archive.ubuntu.com (2001:67c:1360:8c01::1a)] phase everytime for like 2 minutes !

I didn't have this problem previously on Ubuntu 11.10, right after reinstalling the OS ..

Any ideas on what the problem might be ?

share|improve this question
    
I wonder if it has to do with the fact you're using IPv6. Are you on an IPv6 network? –  Thomas W. Mar 26 '13 at 20:28
    
No I don't think so. I haven't configured any such thing .. –  Ahmad Mar 26 '13 at 20:36
    
The IPs in your included messages is IPv6. That suggests it's using IPv6, and if I"m not mistaken there aren't that many IPv6 servers for the archive. –  Thomas W. Mar 26 '13 at 20:46
1  
@Ahmad Since you've solved your problem and have written the solution, please post it as an answer (and then you can edit it out of your question, too). Please note that you do not need to wait to do this; only users with less than 100 reputation must wait before answering their own questions. You can even mark your own answer as accepted (though for that you must wait until two days after you posted the question have passed). –  Eliah Kagan Mar 26 '13 at 22:15
    
Done .. Now I just have to wait for 22 hours in order to be able to accept my own answer :) –  Ahmad Mar 27 '13 at 21:32

2 Answers 2

I solved this on 12.10 by editing /etc/gai.conf and uncommenting the line:

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

This lets you keep IPv6 enabled, but sets the order of precedence to prefer IPv4 over IPv6.

share|improve this answer
4  
Im not supposed to write ty as a comment but i think it ought be said ur my hero tytytytytyty –  James Andino Nov 12 '13 at 2:25
    
Confirmed on Ubuntu 13.10 as well. –  Jeremy Fishman Apr 9 at 14:49
    
This is the answer –  jkurtisr32 Jul 17 at 11:21
    
Works on Linux Mint 17 as well, thanks. –  user1291235 Nov 4 at 17:08

Solution:

I figured out the problem. I had to disable IPv6 connectivity, as The Lord Of Time pointed out.

Running the following command in Terminal tells if IPv6 is enabled or not:

cat /proc/sys/net/ipv6/conf/all/disable_ipv6

0 means its enabled, while 1 means its disabled.

To disable IPv6 from within Terminal, enter the following:

echo "#disable ipv6" | sudo tee -a /etc/sysctl.conf
echo "net.ipv6.conf.all.disable_ipv6 = 1" | sudo tee -a /etc/sysctl.conf
echo "net.ipv6.conf.default.disable_ipv6 = 1" | sudo tee -a /etc/sysctl.conf
echo "net.ipv6.conf.lo.disable_ipv6 = 1" | sudo tee -a /etc/sysctl.conf
sudo sysctl -p

Re-run the first command, and it should be 1 now.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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