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 
Android Android Commands Android Java Applications Application Libraries Bash / Shell Scripts Bluetooth driver Build Frameworks Commands and Packages Core Kernel C Programs Development Environment Setup Documents / Books Errors & Failures File Systems Framebuffer / Display Driver git Go Language Programs Hardware Platforms Home JAVA Programs Kernel & Device Drivers Kernel Booting and Porting Linux, OS Concepts and Networking Linux Device Drivers Linux Host, Ubuntu, SysAdmin Linux Kernel Linux Networking Middleware Libraries, HAL NDK / Middleware / HAL Network Driver OS Concepts PHP Procfs Filesystem Programming Languages RaspberryPi Scripting and Automation Search Engine Optimisation ( SEO ) Socurce Code Management ( SCM ) System Administration, Security Testing and Debugging Uncategorized Userspace Utilities Web design and development Wordpress Yocto / Bitbake / Openembedded

Leave a Reply