Friday, March 21, 2014

Connecting to archive.ubuntu.com takes a long time?

Each time I add new repositories to my Elementary OS(Ubuntu based) I need to update the package lists. So normally I have to apply the following command:
sudo apt-get update
Each time I do this though, the terminal gets stuck at a certain point.
100% [Connecting to security.ubuntu.com (2001:67c:1360:8c01::19)]
 After looking around a little bit I found out that there is a problem with what protocol does the system use IPv4 or IPv6. It is better to let it chose by itself. The remedy for this would be to modify a small config file. The file I'm talking about is situated in the /etc folder and it's called gai.conf.

This file though is not modifiable by the user. To fix this you can just paste the following command in the terminal:
sudo chmod 777 /etc/gai.conf
Now just go and open the file with your favorite text editor and uncomment the precedence line:
#
#    For sites which prefer IPv4 connections change the last line to
# 
precedence ::ffff:0:0/96 100  

Now everything should run smoothly. Enjoy installing new stuff again! 

No comments:

Post a Comment