This might be a possible bug, but it is something that has been bothering me for a couple of days now.
The difference between apt-get upgrade
and apt-get dist-upgrade
has been both well-known and well-established by now i.e. upgrade installs/upgrades while dist-upgrade
is capable of install/remove/upgrade if package removal happens to be necessary for either an installation or upgrading of another package. The difference in packages can be easily discovered with something like
(the following is a quick and dirty method and will need sudo password to be entered already in the terminal for copy pasting. Also, as I have several packages and drivers I patched myself that I need kept back for functionality, I included the OR in the awk
to extract only those to be installed and those to be upgraded, and not those listed as to be kept back, but the following should work even if those lines are not present in your apt upgrade
outputs) :
$echo -e 'n' | sudo apt-get dist-upgrade | awk '
/be installed|be upgraded/{f=1;next}; /not upgraded|kept back/{f=0}f' | awk '
BEGIN {RS=" ";} {print $0}
' | grep . > apt_get_dist_list
$echo -e 'n' | sudo apt-get upgrade | awk '
/be installed|be upgraded/{f=1;next}; /not upgraded|kept back/{f=0}f' | awk '
BEGIN {RS=" ";} {print $0}
' | grep . > apt_get_upgrade_list
and when I compare the two outputs with:
$diff apt_get_dist_list apt_get_upgrade_list | grep -E '<|>'
in my case I get the following:
< gir1.2-nm-1.0
< libcpupower2
< linux-kbuild-5.2
< blueman
< linux-cpupower
< linux-headers-amd64
< linux-image-amd64
< pdf-parser
Which makes the difference quite clear, especially given the presence of linux-header-*
and linux-image-*
in apt-get dist-upgrade
Now if I repeat the same process for apt upgrade
and apt full-upgrade
$echo -e 'n' | sudo apt upgrade | awk '
/be installed|be upgraded/{f=1;next}; /not upgraded|kept back/{f=0}f' | awk '
BEGIN {RS=" ";} {print $0}
' | grep . > apt_upgrade_list
$echo -e 'n' | sudo apt full-upgrade | awk '
/be installed|be upgraded/{f=1;next}; /not upgraded|kept back/{f=0}f' | awk '
BEGIN {RS=" ";} {print $0}
' | grep . > apt_fullupgrade_list
and compare:
$diff apt_get_dist_list apt_fullupgrade_list | grep -E '<|>'
I get nothing, as expected because apt full-upgrade
and apt-get dist-upgrade
are meant to behave in the same exact way, but when I compare:
$diff apt_get_upgrade_list apt_upgrade_list | grep -E '<|>'
I get the same output as when comparing apt-get upgrade with apt-get dist-upgrade
.
> gir1.2-nm-1.0
> libcpupower2
> linux-kbuild-5.2
> blueman
> linux-cpupower
> linux-headers-amd64
> linux-image-amd64
> pdf-parser
and the only conclusion I can arrive at is that apt upgrade
is exactly the same as apt full-upgrade
which also makes it the same as apt-get dist-upgrade
, which ultimately means that not only is apt upgrade
redundant, but what is also more of a concern is that currently apt
does not allow for the same behavior as apt-get upgrade
.
apt autoremove
afterapt dist-upgrade
? – Martin Braun Mar 29 '22 at 00:44dist-upgrade
will ensure that all install packages are upgraded to the latest versions, if possible, and will remove packages if that is required to reach that state. It won’t clean up packages which are no longer necessary. To do that, you need to runautoremove
afterwards, or specify--autoremove
as an option ondist-upgrade
. – Stephen Kitt Mar 29 '22 at 10:02