Jnnngs
Home
About
 Admin
  4 minutes

How to fix apt's "the following packages have been kept back" issue

Have you ever run sudo apt-get upgrade, only to be told there are packages that will be kept back? What this warning means is that the dependencies have changed on one of the software packages you have installed, and if upgrading that dependency would cause problems with the standard upgrade, the dependency in question is kept back. 

In other words, it's a precaution to prevent upgrades from breaking. Of course, you can always get around that by issuing the following command: 

sudo apt-get dist-upgrade

However, that can be dangerous, as it may remove packages to resolve rather complex dependency problems. It's an issue that can be tricky to resolve, but not really. There are a couple of ways to resolve this issue. 

The first method would be to manually install the packages listed as kept back. Say you have packages base-files, sosreport, and ubuntu-server being kept back. You could install those packages manually with the command: 

sudo apt-get install base-files sosreport ubuntu-server

That command will install those packages and any dependencies they require. 

A second option is to install aptitude with: 

sudo apt-get install aptitude -y

Also use the safe-upgrade command, as in: 

sudo aptitude safe-upgrade

This command will not remove any packages unless they are unused and will install the kept-back software. 

Either route you take, you'll get those kept-back packages installed. Which route you take will depend on if you want to add more software into the mix or do things manually. Since this is Linux, you always have choices. In this case, make the one that makes the most sense to you.