Apt and apt-get reporting different lists of packages to be held back/upgraded
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~
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:/
$ apt-get update
Hit:1 http://
Hit:2 http://
Hit:3 http://
Hit:4 https:/
Hit:5 http://
Hit:6 http://
Hit:7 https:/
Hit:8 https:/
Hit:9 https:/
Get:10 https:/
Ign:11 https:/
Hit:12 https:/
Hit:13 https:/
Ign:16 https:/
Hit:17 https:/
Hit:18 https:/
Hit:21 https:/
Hit:14 https:/
Hit:15 https:/
Hit:22 https:/
Hit:23 https:/
Hit:24 https:/
Hit:25 https:/
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-
The following packages will be upgraded:
code freerdp2-x11 libfreerdp-
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-
linux-
The following packages have been kept back:
grub-
The following packages will be upgraded:
code freerdp2-x11 libfreerdp-
linux-
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.
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