Fix result in terminal that package is not upgraded

Sometimes while using terminal and updating packages, you can get result like "0 upgraded, 0 newly installed, 0 to remove and 4 not upgraded", but why 4 packages are not upgraded?

The message "0 upgraded, 0 newly installed, 0 to remove, and 4 not upgraded" indicates that there are packages on your system that have newer versions available, but for some reason, they were not upgraded during the last sudo apt upgrade command.

Here are a few possible reasons for this: 

Dependencies: The newer versions of the packages may have new dependencies that are not installed on your system. In such cases, the package manager may hesitate to upgrade them to prevent breaking other installed software. 

Held Packages: Some packages might be held back due to specific configurations or manual intervention. You can check if any packages are being held with the command apt-mark showhold.

System Stability: The package manager may avoid upgrading certain packages if it believes that doing so could introduce instability to the system. To investigate further, you can use the following command to see the list of upgradable packages and their current status: sudo apt list --upgradable This will show you a list of upgradable packages, and you can then decide whether to upgrade them or investigate any issues that might be preventing their upgrade.  If you want to force the upgrade of all packages, you have two options described below.

1. Install package:

This is first option and option I prefer personally.

Use command below to get package names you need to upgrade: 

sudo apt list --upgradable

When you know package names use following command:

sudo apt install name_of_the_package

2. Dist upgrade

sudo apt dist-upgrade

The dist-upgrade command is more aggressive in handling dependencies and might attempt to upgrade packages that were held back by the regular upgrade. However, be cautious with this command, as it may remove certain packages if necessary for the upgrade. Always review the proposed changes before proceeding.

Author: Aleksandar Vranešević
Published: 11-17-2023
Updated: 11-17-2023