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 Application Stack / User Interface Bash / Shell Scripts Commands and Packages Compilation Content Management System - CMS Core Kernel C Programs Development & Build Development Environment Setup Errors & Failures Flutter git Go Language Programs Hardware Platforms HTML JAVA Programs Kernel & Device Drivers Linux, OS Concepts and Networking Linux Device Drivers Linux Host, Ubuntu, SysAdmin Linux Kernel Linux Networking Middleware Libraries, HAL Monetization / Google AdSense NDK / Middleware / HAL OS Concepts PHP Programming Languages RaspberryPi Scripting and Automation Search Engine Optimisation ( SEO ) Social Media Socurce Code Management ( SCM ) System Administration, Security Testing and Debugging Uncategorized User Interface Userspace Utilities Web design and development Wordpress Yocto / Bitbake / Openembedded

3 Comments

  1. Saloni April 30, 2019
  2. Vikas May 15, 2019
    • lynxbeedev May 16, 2019

Leave a Reply / Ask Question