15

I have a package being kept back whilst trying to upgrade:

$ sudo apt upgrade
Reading package lists... Done
Building dependency tree       
Reading state information... Done
Calculating upgrade... Done
The following packages have been kept back:
  mesa-opencl-icd:i386
0 to upgrade, 0 to newly install, 0 to remove and 1 not to upgrade.

After I run apt list --upgradable I see:

"There are 2 additional versions. Please use the '-a' switch to see them."

So I run apt list --upgradable -a and I see:

Listing... Done
mesa-opencl-icd/focal-updates,focal-security 21.2.6-0ubuntu0.1~20.04.2 i386 [upgradable from: 21.0.3-0ubuntu0.3~20.04.5]
mesa-opencl-icd/now 21.0.3-0ubuntu0.3~20.04.5 i386 [installed,upgradable to: 21.2.6-0ubuntu0.1~20.04.2]
mesa-opencl-icd/focal 20.0.4-2ubuntu1 i386

After searching I see various methods of attempting to fix this, but they involve sudo apt-get dist-upgrade and I believe that can cause problems. Also sudo apt-get install <list of packages kept back> but I dont want to forcefully install something that my system is preventing me from installing.

I'd prefer to find out why this is happening and fix the problem with dependencies or conflicts.

I'm on Xubuntu 20.04.4 LTS

Could someone advise on how to best fix this particular problem?

Edit, no luck after sudo apt dist-upgrade

Reading package lists... Done
Building dependency tree       
Reading state information... Done
Calculating upgrade... Done
The following package was automatically installed and is no longer required:
  libclang-common-12-dev
Use 'sudo apt autoremove' to remove it.
The following packages have been kept back:
  mesa-opencl-icd:i386
0 to upgrade, 0 to newly install, 0 to remove and 1 not to upgrade.


$ sudo apt autoremove
Reading package lists... Done
Building dependency tree       
Reading state information... Done
The following packages will be REMOVED
  libclang-common-12-dev
0 to upgrade, 0 to newly install, 1 to remove and 1 not to upgrade.
After this operation, 65.6 MB disk space will be freed.
Do you want to continue? [Y/n] y
(Reading database ... 301137 files and directories currently installed.)
Removing libclang-common-12-dev (1:12.0.0-3ubuntu1~20.04.5) ...


$ sudo apt update
Hit:1 http://archive.canonical.com/ubuntu focal InRelease
Reading package lists... Done
Building dependency tree       
Reading state information... Done
2 packages can be upgraded. Run 'apt list --upgradable' to see them.


$ apt list --upgradable
Listing... Done
mesa-opencl-icd/focal-updates,focal-security 21.2.6-0ubuntu0.1~20.04.2 i386 [upgradable from: 21.0.3-0ubuntu0.3~20.04.5]
rsync/focal-updates,focal-security 3.1.3-8ubuntu0.3 amd64 [upgradable from: 3.1.3-8ubuntu0.2]


$ sudo apt upgrade
Reading package lists... Done
Building dependency tree       
Reading state information... Done
Calculating upgrade... Done
The following packages have been kept back:
  mesa-opencl-icd:i386
The following packages will be upgraded:
  rsync
1 to upgrade, 0 to newly install, 0 to remove and 1 not to upgrade.
1 standard security update
Need to get 318 kB of archives.
After this operation, 4,096 B of additional disk space will be used.
Do you want to continue? [Y/n] y
Get:1 http://gb.archive.ubuntu.com/ubuntu focal-updates/main amd64 rsync amd64 3.1.3-8ubuntu0.3 [318 kB]
Fetched 318 kB in 0s (2,728 kB/s)
(Reading database ... 300703 files and directories currently installed.)
Preparing to unpack .../rsync_3.1.3-8ubuntu0.3_amd64.deb ...
Unpacking rsync (3.1.3-8ubuntu0.3) over (3.1.3-8ubuntu0.2) ...
Setting up rsync (3.1.3-8ubuntu0.3) ...
Processing triggers for man-db (2.9.1-1) ...
Processing triggers for systemd (245.4-4ubuntu3.15) ...


$ sudo apt update
Hit:1 http://ppa.launchpad.net/libretro/stable/ubuntu focal InRelease
Reading package lists... Done
Building dependency tree       
Reading state information... Done
1 package can be upgraded. Run 'apt list --upgradable' to see it.

$ sudo apt upgrade
Reading package lists... Done
Building dependency tree       
Reading state information... Done
Calculating upgrade... Done
The following packages have been kept back:
  mesa-opencl-icd:i386
0 to upgrade, 0 to newly install, 0 to remove and 1 not to upgrade.

$ sudo apt dist-upgrade
Reading package lists... Done
Building dependency tree       
Reading state information... Done
Calculating upgrade... Done
The following packages have been kept back:
  mesa-opencl-icd:i386
0 to upgrade, 0 to newly install, 0 to remove and 1 not to upgrade.
6
  • 1
    You shouldn't use dist-upgrade all the time, but this would be an appropriate time to use it. See: askubuntu.com/q/81585
    – Nmath
    Commented Mar 28, 2022 at 20:53
  • I tried it, multiple times... but still no joy. I updated the OP
    – Johnny5ive
    Commented Apr 1, 2022 at 20:09
  • 4
    try this sudo apt-get install aptitude -y ; sudo aptitude safe-upgrade
    – lnee
    Commented Apr 1, 2022 at 20:14
  • Yes, it fixed it, now: 0 to upgrade, 0 to newly install, 0 to remove and 0 not to upgrade. Thank you.
    – Johnny5ive
    Commented Apr 1, 2022 at 20:22
  • Your sources seem incomplete: focal-updates and focal-security are missing. Check apt-cache policy on the kept-back packages before jumping to a force-install solution; there might be a good reason the packages are kept back.
    – user535733
    Commented Aug 3, 2022 at 12:24

3 Answers 3

22

This solved the problem for me:

sudo apt-get install aptitude 
sudo aptitude safe-upgrade
2
  • 4
    Fixed it for me, even though apt dist-upgrade didn't.
    – Dakkaron
    Commented Aug 12, 2022 at 8:01
  • after I did do-release-upgrade in 20.04 and restarted in 22.04 even though exit code 1. this solved my issue with apt Commented Mar 27, 2023 at 0:33
22

On my system, I had multiple kept-back packages as well. In my case, the packages were not updated (sudo apt-get dist-upgrade) since the updates were phased updates.

Phased updates are a safety feature: They are not introduced to all users at the same time; only some users receive them at the beginning to report potential issues (see this answer for more information).

You can check if your kept-back PackageA contains a phased update by running apt-cache policy PackageA. Phased updates are indicated in the "Version table" by a phased percentage.

4
  • Note that the phased upgrades progress page seems to be nonfunctional. You have to use apt-cache policy <package_names> to see the phasing progres of the packages. --- If you really-really need to override the phasing (not recommended) you can upgrade the packages explicitly. For example: sudo apt dist-upgrade <package_names> Commented Oct 19, 2022 at 9:23
  • 5
    Okay... IMHO if Ubuntu is doing phased updates they should not count or show those updates by default. I had no idea this was now a thing and I couldn't understand why everything I tried seemed to be ignored without any shred of feedback. Either you hide the phased updates, only showing them when an explicit option is used (thus making sure whoever sees them knows what's happening) or give a damn clear error message "packages are held back because are phased. Wait for your turn" or something. This is confusing as hell from an end user perspective.
    – Bakuriu
    Commented Dec 16, 2022 at 22:21
  • 1
    I agree with @Bakuriu, and I wish nala, being a more modern take, could figure this out and keep even further in front of apt and friends.
    – thoni56
    Commented Jan 30, 2023 at 21:22
  • 1
    Phased updates causing sigsegv in Gnome Shell on Ubuntu 22.04. Forcing the packages to upgrade with dist-upgrade resolved it. The way these phased updates are implemented is beyond moronic. I wasted 30 minutes searching for a fix for this.
    – Fibbs
    Commented Jul 30, 2023 at 0:01
1

You may try to use your existing tools already installed. For me worked:

sudo apt full-upgrade
1
  • Your answer could be improved with additional supporting information. Please edit to add further details, such as citations or documentation, so that others can confirm that your answer is correct. You can find more information on how to write good answers in the help center.
    – Community Bot
    Commented Mar 24, 2023 at 17:39

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .