Why are upgradable packages not upgraded?

Executing sudo apt update ended with

Reading package lists... Done
Building dependency tree       
Reading state information... Done
2 packages can be upgraded. Run 'apt list --upgradable' to see them.

Executing apt list --upgradable gave me

Listing... Done
onionshare/bionic,bionic 2.2.ppa1-1 all [upgradable from: 2.1-1]
ring-all/unknown 20190927.2.c2af011~dfsg1-1 amd64 [upgradable from: 20190629.2.c07ef23~dfsg1-1]

But executing sudo apt upgrade does not upgrade the upgradable packages:

Reading package lists... Done
Building dependency tree       
Reading state information... Done
Calculating upgrade... Done
0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.
  1. Why is that? Unmet dependencies possibly?
  2. Can I (manually) upgrade the listed packages, and if so: how?

Update: See this pastebin for a full transcript.

Asked By: marianoju

||

In this case “upgradable packages” are actually not upgradable because they have unmet dependencies.

To reproduce: try to update the specific packages in question (see How To Update A Specific Package In Ubuntu) by executing sudo apt-get install --only-upgrade <packagename>. If any package has unmet dependencies, the upgrade will fail due to

E: Unable to correct problems, you have held broken packages.

Upgrading these packages would require to resolve the unmet dependencies. Information on that can be found in the answer to “How do I resolve unmet dependencies after adding a PPA?” and “Fixing Unable to correct problems, you have held broken packages”.

Answered By: marianoju

You can run the command line below for upgrade all upgradable packages and their dependencies:

sudo apt-get dist-upgrade
Answered By: giapvn

I suggest running:

sudo apt-get upgrade

This worked for me. It will tell you how many packages it upgraded, how many new ones were installed, how many were deleted, and how many were not upgraded (kept back).

I had packages that were kept back, so after reading this post, which provides multiple solutions, I ran the following to install the packages that were kept back:

sudo apt-get --with-new-pkgs upgrade

This will also include which packages are no longer needed and could be removed. Per the output’s instructions, I ran the following to remove them:

sudo apt autoremove

Lastly I ran the first code again, just to make sure all was clear and would get the output "0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded."

Answered By: dahiana

After updating and upgrading with sudo apt update && sudo apt upgrade, this is the correct solution that always works:

sudo apt install <list of packages kept back>
Answered By: Wallace Espindola

The missing package NAMES in YOUR case won’t necessarily be the same as in this example. But this shows how to fix the problem. The technique works regardless of what names you see in your output. So substitute the actual file names like ubuntu-advantage-tools or libnfsidmap1 with whatever YOUR computer says needs to be upgraded.

All of these commands need to be run as root. We do this by using sudo to change the user in the terminal without having to actually be logged into a session as root. To do this, type:

sudo su

…and enter your root password when prompted. The su part would switch users. When entered without anything else after it, the default to switch to is root. Now you have permission to dramatically screw up the computer so be ‘root’ carefully!

Otherwise you have to type sudo in front of all of these commands individually. Some linux purists think its wrong to sudo su, but I assure you, it is precisely the same as typing sudo over and over again for each command.

Run:

apt update

and then

apt upgrade

…you might get an output like:

1 upgraded, 0 newly installed, 0 to remove and 8 not upgraded.

…which shows eight packages not upgraded.

Other update related commands might provide a message like:

The following packages have been kept back: evolution evolution-common evolution-plugin-bogofilter evolution-plugin-pstimport evolution-plugins libevolution libnfsidmap1 ubuntu-advantage-tools

You need to fix these listed packages that might be missing dependencies causing them to not be upgraded the easy way. Nobody has thought to include a subroutine in apt upgrade to handle these issues automatically. So we are stuck doing it ourselves.

To list the packages, you should then run:

apt list --upgradable

You should then manually install those listed packages.

apt install evolution evolution-common evolution-plugin-bogofilter evolution-plugin-pstimport evolution-plugins libevolution libnfsidmap1

Notice how you can just enter all the packages with a space in between their names instead of running apt install for each individually. You can copy this list directly in the terminal from the previous not upgraded output. You have to right click and select ‘copy’ or ‘paste’ when dealing with stuff in the terminal. Ctrl C and Ctrl V keyboard commands won’t work on terminal outputs.

Of course doing all of this might still not fix all of them. You might get an output like:

6 upgraded, 0 newly installed, 0 to remove and 2 not upgraded.

or

2 packages can be upgraded. Run 'apt list --upgradable' to see them.

You can then run:

apt-get --with-new-pkgs upgrade

…to show the remaining packages. This should output something like

The following packages have been kept back: libnfsidmap1 ubuntu-advantage-tools

Then you just need to manually install them individually for some ungodly reason. In my case I entered:

apt install ubuntu-advantage-tools

and

apt install libnfsidmap1

Again, the names of what was installed here should be replaced with what YOUR computer says wasn’t upgraded.

This should fix the problem with the remaining two that wouldn’t install when in the list command earlier.
Running apt update and then apt upgrade should then output:

0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.

DONE!

You might also want to run:

sudo apt-get --with-new-pkgs upgrade

and then

sudo apt autoremove

as I have seen suggested elsewhere. But this alone didn’t solve my problem.

Answered By: user28788
Categories: Answers Tags: , , ,
Answers are sorted by their score. The answer accepted by the question owner as the best is marked with
at the top-right corner.