SOLVED: The following packages have been kept back

November 27, 2017

After logging in via ssh, you may see 2 lines looking like this:

53 packages can be updated.
25 updates are security updates.

And than you will try to update; upgrade, and see the following error:

The following packages have been kept back

or
0 upgraded, 0 newly installed, 0 to remove and xx not upgraded

There are normally two reasons you may see this message.

If upgrading the program (via sudo apt-get upgrade) would cause packages to be added or removed, then the program will be held back. You can use sudo apt-get dist-upgrade in this case, which will then offer to add or remove the additional programs.

This is pretty common and usually not an issue. Occasionally (particularly during an Ubuntu alpha) a dist-upgrade will offer to remove a lot of other programs, in which case you probably want to cancel it.

If the program depends on packages or versions that are not available, then the program will be held back. You really can’t do anything but wait in this circumstance, since the package is basically uninstallable. This can happen when packages get added to the repository out of order, when a package is renamed, or when a package stops providing a virtual package.

You can also try:

sudo aptitude safe-upgrade.

It’s safer than full-upgrade (originally named dist-upgrade) because “packages will not be removed unless they are unused”.

From man aptitude:

safe-upgrade

Upgrades installed packages to their most recent version. Installed
packages will not be removed unless they are unused /…/ Packages
which are not currently installed may be installed to resolve
dependencies unless the –no-new-installs command-line option is
supplied.