How To: Upgrade Packages that Were Kept Back

Now and then you may notice that apt-get upgrade command keeps a few packages back, meaning they don’t get upgraded. This quick post shows what you can do about it and how to get all the packages upgraded.

How apt-get Keeps Packages Back

This is how keeping packages back will look like:

greys@xps:~ $ sudo apt-get upgrade
Reading package lists... Done
Building dependency tree
Reading state information... Done
Calculating upgrade... Done
The following packages have been kept back:
linux-generic linux-headers-generic linux-image-generic
0 to upgrade, 0 to newly install, 0 to remove and 3 not to upgrade.

Why Packages Are Kept Back by apt-get

Most likely reason for keeping packages back is that upgrading them means installing new packages or removing existing ones. apt-get upgrade strictly upgrades existing packages, without removing or installing anything.

Since the command you’re giving to apt-get is upgrade and not to install new packages, packages that require some old packages removed or new packages installed are kept back.

How To Upgrade Packages That Were Kept Back

Simply use the dist-upgrade option of apt-get, which will resolve dependencies and install/remove dependent package as needed:

greys@xps:~ $ sudo apt-get dist-upgrade
Reading package lists... Done
Building dependency tree
Reading state information... Done
Calculating upgrade... Done
The following NEW packages will be installed
linux-headers-5.0.0-20 linux-headers-5.0.0-20-generic linux-image-5.0.0-20-generic linux-modules-5.0.0-20-generic
linux-modules-extra-5.0.0-20-generic
The following packages will be upgraded:
linux-generic linux-headers-generic linux-image-generic
3 to upgrade, 5 to newly install, 0 to remove and 0 not to upgrade.
Need to get 67.0 MB of archives.
After this operation, 334 MB of additional disk space will be used.
Do you want to continue? [Y/n] y

That’s it for todat, enjoy!

See Also




Keep Learning

Follow me on Facebook, Twitter or Telegram:
Recommended
I learn with Educative: Educative
IT Consultancy
I'm a principal consultant with Tech Stack Solutions. I help with cloud architectrure, AWS deployments and automated management of Unix/Linux infrastructure. Get in touch!

Recent Tweets