Kept back packages in apt-get

I faced the following error/message in Ubuntu 14.04 LTS while updating my softwares through apt-get command:

The following packages have been kept back:
libglib2.0-0:i386 libhwloc-plugins
0 upgraded, 0 newly installed, 0 to remove and 2 not upgraded.

After some googling and reading some posts which were either inappropriate or risky/dangerous, I came up with the following solution that works every time and is safe.

This error or message simply means that there are some changes in packages dependencies and probably some packages should be removed, so we should install the new packages and ultimately safely remove unnecessary ones.

At first you are better to update the apt-get:

sudo apt-get update

Then you need to know the list of “kept back” packages, if you don’t remember simply re-run the upgrade command:

sudo apt-get upgrade

The following packages have been kept back:
libglib2.0-0:i386 libhwloc-plugins
0 upgraded, 0 newly installed, 0 to remove and 2 not upgraded.

Now you simply copy the names of “kept back” applications from the error and list them in front of install command for apt-get:

sudo apt-get install libglib2.0-0:i386 libhwloc-plugins

If everything goes smooth, which majority of time it does since it is the standard procedure in Ubuntu and it’s variants, then you can re-run the upgrade command to see the packages that are unnecessary:

sudo apt-get upgrade

After this you will see a message as below:

Reading package lists… Done
Building dependency tree
Reading state information… Done
Calculating upgrade… Done
The following packages were automatically installed and are no longer required:
linux-headers-3.13.0-58 linux-headers-3.13.0-58-generic
linux-image-3.13.0-58-generic linux-image-extra-3.13.0-58-generic
linux-signed-image-3.13.0-58-generic
Use ‘apt-get autoremove’ to remove them.
0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.

As apt-get suggests it self, you should just run the autoremove command to safely remove the unnecessary packages:

sudo apt-get autoremove

Leave a Reply

Your email address will not be published. Required fields are marked *

This is new type of CAPTCHA, make the puzzle please !WordPress CAPTCHA