apt-get stuck at 0% ( Connecting to archive.ubuntu.com ) on ubuntu 16.04 and doesn’t proceed

Recently we installed ubuntu 16.04 32bit on our laptop. After installation is done, we wanted to install other packages like gimp, vim etc, using apt-get command, but after multiple tries, apt-get install command always got stuck with something like below message,

 0% [Connecting to archive.ubuntu.com (2001:67c:1360:8001::21)] 

Solution for this, is to edit /etc/gai.conf to allow requests to prefer IPv4.

 $ sudo gedit /etc/gai.conf 

and uncomment 54th line ( precedence ::ffff:0:0/96 100 ) as,

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

save this file and run update using below command,

 $ sudo apt-get update 

and now, we can install the packages like vim, gimp etc as,

 $ sudo apt-get install package_name 

3 thoughts on “apt-get stuck at 0% ( Connecting to archive.ubuntu.com ) on ubuntu 16.04 and doesn’t proceed”

Leave a Comment