Apt and apt-get reporting different lists of packages to be held back/upgraded

Bug #2038490 reported by Eric Reinhardt
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
apt (Ubuntu)
Invalid
Undecided
Unassigned

Bug Description

When running apt-get from a script (or command line), I see a different list of packages to be held back / upgraded vs when I run apt.

I am running Kubuntu 23.04. The version of apt and apt-get I first noticed the problem in is 2.6.0ubuntu0.1
I also see the problem on my servers running Ubuntu 22.04.3 with apt and apt-get version 2.4.10.
I upgraded my copy on Kubuntu 23.04 to 2.7.6 through the launchpad.net ppa deity/sid (actually version 2.7.6+0~202309200852~ubuntu23.04.1) and the problem remains.

I've spent a few hours looking for the correct place to search for this being already reported and have reviewed recent commits at https://salsa.debian.org/apt-team/apt. I'm hesitant but I do not see any other mention of this issue. I have tried deleting my /var/cache/apt and running apt update. To duplicate the issue one needs to have an Ubuntu version that has not yet received the update to linux-headers-6.2.0-34, et al. I attempted to duplicate the issue on a fresh install of Ubuntu Desktop 23.04, but discovered that the system is upgraded to linux 6.2.0-34 during the install process. Please see the output of the apt-get and apt commands below.

$ apt-get update
Hit:1 http://ftp.usf.edu/pub/ubuntu lunar InRelease
Hit:2 http://ftp.usf.edu/pub/ubuntu lunar-updates InRelease
Hit:3 http://ftp.usf.edu/pub/ubuntu lunar-backports InRelease
Hit:4 https://dl.winehq.org/wine-builds/ubuntu lunar InRelease
Hit:5 http://ftp.usf.edu/pub/ubuntu lunar-security InRelease
Hit:6 http://packages.microsoft.com/repos/code stable InRelease
Hit:7 https://repo.steampowered.com/steam stable InRelease
Hit:8 https://pkg.cloudflareclient.com jammy InRelease
Hit:9 https://download.sublimetext.com apt/stable/ InRelease
Get:10 https://pkgs.tailscale.com/stable/ubuntu jammy InRelease
Ign:11 https://repo.vivaldi.com/stable/deb stable InRelease
Hit:12 https://repo.vivaldi.com/stable/deb stable Release
Hit:13 https://download.virtualbox.org/virtualbox/debian jammy InRelease
Ign:16 https://download.webmin.com/download/repository sarge InRelease
Hit:17 https://ppa.launchpadcontent.net/cappelikan/ppa/ubuntu lunar InRelease
Hit:18 https://download.webmin.com/download/repository sarge Release
Hit:21 https://ppa.launchpadcontent.net/teejee2008/foss/ubuntu lunar InRelease
Hit:14 https://packagecloud.io/github/git-lfs/ubuntu lunar InRelease
Hit:15 https://packagecloud.io/eugeny/tabby/ubuntu jammy InRelease
Hit:22 https://ppa.launchpadcontent.net/cubic-wizard/release/ubuntu lunar InRelease
Hit:23 https://repo.waydro.id bullseye InRelease
Hit:24 https://ppa.launchpadcontent.net/deity/sid/ubuntu lunar InRelease
Hit:25 https://ppa.launchpadcontent.net/papirus/papirus/ubuntu lunar InRelease
Fetched 6,557 B in 3s (2,503 B/s)
Reading package lists... Done

$ apt-get upgrade --assume-no
Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
Calculating upgrade... Done
The following packages have been kept back:
  grub-efi-amd64-bin grub-efi-amd64-signed linux-generic linux-headers-generic linux-image-generic
The following packages will be upgraded:
  code freerdp2-x11 libfreerdp-client2-2 libfreerdp-server2-2 libfreerdp2-2 libwinpr2-2
6 upgraded, 0 newly installed, 0 to remove and 5 not upgraded.
Need to get 97.1 MB of archives.
After this operation, 1,480 kB of additional disk space will be used.
Do you want to continue? [Y/n] N
Abort.

$ apt upgrade --assume-no
Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
Calculating upgrade... Done
The following NEW packages will be installed:
  linux-headers-6.2.0-34 linux-headers-6.2.0-34-generic linux-image-6.2.0-34-generic linux-modules-6.2.0-34-generic
  linux-modules-extra-6.2.0-34-generic
The following packages have been kept back:
  grub-efi-amd64-bin grub-efi-amd64-signed
The following packages will be upgraded:
  code freerdp2-x11 libfreerdp-client2-2 libfreerdp-server2-2 libfreerdp2-2 libwinpr2-2 linux-generic linux-headers-generic
  linux-image-generic
9 upgraded, 5 newly installed, 0 to remove and 2 not upgraded.
8 standard LTS security updates
Need to get 225 MB of archives.
After this operation, 688 MB of additional disk space will be used.
Do you want to continue? [Y/n] N
Abort.

Revision history for this message
Julian Andres Klode (juliank) wrote :

This is a feature; not a bug. apt-get is a legacy scripting interface which tries to remain compatible with existing scripts as much as possible, hence when we enabled installing new packages as a third mode for upgrading, we only enabled it by default for apt upgrade whereas apt-get upgrade would not install new packages to enable upgrades.

You can get the same behavior for apt-get as for apt using:

    apt-get upgrade --with-new-pkgs

And inversely you can make apt upgrade hold back upgrades that would install new packages by using:

    apt upgrade --without-new-pkgs

Changed in apt (Ubuntu):
status: New → Invalid
Revision history for this message
Eric Reinhardt (blueknight42) wrote :

Thank you. I'd wondered how something seeingly so significant had gone unnoticed. I apologize for the invalid bug report.

Revision history for this message
Julian Andres Klode (juliank) wrote :

It's fine, it's pretty non-obvious that the two differ in some behaviors and even more so that it's intentional.

To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.