Request for clarification: apt dist-upgrade versus apt-get dist-upgrade

rosmaniac

Member
Jun 7, 2021
8
3
23
56
Ok, after a bit of Reddit fun, I'd like to see a bit of clarification in the documentation regarding updates versus upgrades. The documentation is contradictory in a few places.

In the current host system administration documentation at https://pve.proxmox.com/pve-docs/chapter-sysadmin.html#system_software_updates we read that for updating the host system from the CLI the following commands are used:
Code:
apt-get update
apt-get dist-upgrade

For version upgrades, a different set of commands are used, one of which uses an undocumented command option (from https://pve.proxmox.com/wiki/Upgrade_from_8_to_9 ):
Code:
apt update
apt dist-upgrade

The apt dist-upgrade command is undocumented; you will not find it in the apt man page, and the helpful command apt --help tells you this:
Code:
root@pve:~# pveversion
pve-manager/9.1.1/42db4a6cf33dac83 (running kernel: 6.17.2-1-pve)
root@pve:~# apt --help
apt 3.0.3 (amd64)
Usage: apt [options] command

apt is a commandline package manager and provides commands for
searching and managing as well as querying information about packages.
It provides the same functionality as the specialized APT tools,
like apt-get and apt-cache, but enables options more suitable for
interactive use by default.

Most used commands:
  list - list packages based on package names
  search - search in package descriptions
  show - show package details
  install - install packages
  reinstall - reinstall packages
  remove - remove packages
  autoremove - automatically remove all unused packages
  update - update list of available packages
  upgrade - upgrade the system by installing/upgrading packages
  full-upgrade - upgrade the system by removing/installing/upgrading packages
  edit-sources - edit the source information file
  modernize-sources - modernize .list files to .sources files
  satisfy - satisfy dependency strings

See apt(8) for more information about the available commands.
Configuration options and syntax is detailed in apt.conf(5).
Information about how to configure sources can be found in sources.list(5).
Package and version choices can be expressed via apt_preferences(5).
Security details are available in apt-secure(8).
                                        This APT has Super Cow Powers.
root@pve:~# man apt | grep dist-upgrade
root@pve:~#

What you will find in the apt source (cmdline/apt.cc specifically) is the following code:
C:
static std::vector<aptDispatchWithHelp> GetCommands()            /*{{{*/
{
   // advanced commands are left undocumented on purpose
   return {
      // query
      {"list", &DoList, _("list packages based on package names")},
      {"search", &DoSearch, _("search in package descriptions")},
      {"show", &ShowPackage, _("show package details")},

      // package stuff
      {"install", &DoInstall, _("install packages")},
      {"reinstall", &DoInstall, _("reinstall packages")},
      {"remove", &DoInstall, _("remove packages")},
      {"autoremove", &DoInstall, _("automatically remove all unused packages")},
      {"auto-remove", &DoInstall, nullptr},
      {"autopurge", &DoInstall, nullptr},
      {"purge", &DoInstall, nullptr},

      // system wide stuff
      {"update", &DoUpdate, _("update list of available packages")},
      {"upgrade", &DoUpgrade, _("upgrade the system by installing/upgrading packages")},
      {"full-upgrade", &DoDistUpgrade, _("upgrade the system by removing/installing/upgrading packages")},

      // history stuff
      {"history-list", &DoHistoryList, _("show list of history")},
      {"history-info", &DoHistoryInfo, _("show info on specific transactions")},
      {"history-redo", &DoHistoryRedo, _("redo transactions")},
      {"history-undo", &DoHistoryUndo, _("undo transactions")},
      {"history-rollback", &DoHistoryRollback, _("rollback transactions")},

      // misc
      {"edit-sources", &EditSources, _("edit the source information file")},
      {"modernize-sources", &ModernizeSources, _("modernize .list files to .sources files")},
      {"moo", &DoMoo, nullptr},
      {"satisfy", &DoBuildDep, _("satisfy dependency strings")},
      {"why", &DoWhy, _("produce a reason trace for the current state of the package")},
      {"why-not", &DoWhy, _("produce a reason trace for the current state of the package")},

      // for compat with muscle memory
      {"dist-upgrade", &DoDistUpgrade, nullptr},
      {"showsrc", &ShowSrcPackage, nullptr},
      {"depends", &Depends, nullptr},
      {"rdepends", &RDepends, nullptr},
      {"policy", &Policy, nullptr},
      {"build-dep", &DoBuildDep, nullptr},
      {"clean", &DoClean, nullptr},
      {"distclean", &DoDistClean, nullptr},
      {"dist-clean", &DoDistClean, nullptr},
      {"autoclean", &DoAutoClean, nullptr},
      {"auto-clean", &DoAutoClean, nullptr},
      {"source", &DoSource, nullptr},
      {"download", &DoDownload, nullptr},
      {"changelog", &DoChangelog, nullptr},
      {"info", &ShowPackage, nullptr},

      {nullptr, nullptr, nullptr}};
}
So it's handled by the apt code for 'muscle memory compatibility' reasons. There's a slightly-dated discussion about this at https://askubuntu.com/questions/770135/apt-full-upgrade-versus-apt-get-dist-upgrade

So my question is, since it appears that for the apt command dist-upgrade == full-upgrade, why the use of an undocumented option to apt and not the documented option to apt-get? I have seen several posts over the years here in the forums from Proxmox staff recommending a mix of apt full-upgrade, apt dist-upgrade, and apt-get dist-upgrade and I've seen online pages that claim a difference between apt dist-upgrade and apt-full-upgrade when the actual apt source code says they execute the same code. Now, I do know that apt dist-upgrade and apt-get dist-upgrade can do different things due to different default options in the more interactive-use oriented apt, but I'm wondering about the rationale for the different and undocumented usage in the Proxmox documentation.

So, Proxmox staff, why the undocumented apt dist-upgrade and not apt full-upgrade or apt-get dist-upgrade for version upgrades? I understand the documented recommendation for in-version updates; no confusion or contradiction there, since conflicting packages are handled differently by apt-get dist-upgrade and apt full-upgrade.

For what it's worth, I have always used the Debian process after running pveXtoY --full, which is a two-step of a Minimal System Upgrade followed by a Full System Upgrade which looks like this:
Bash:
apt upgrade --without-new-pkgs
apt full-upgrade
and then follow with the Proxmox-documented apt autoremove.

I've not run into any problems in the past with that process, but I always reserve the right to be wrong.
 
Last edited:
it doesn't really make much of a practical difference. "apt-get" was the "stable" interface, and "apt" the "nice" one, but going forward apt will get versioned interfaces as well, and apt-get will likely be dropped/just exist as a compat layer for that.

doing just "apt upgrade" first is not tested much with PVE, and if we (or one of the Debian package maintainers) miss a package relationship constraint somewhere it might go wrong. usually that is fixable, but it might cause extra work, so I would just go straight to "apt full-upgrade".
 
  • Like
Reactions: Stoiko Ivanov
it doesn't really make much of a practical difference. "apt-get" was the "stable" interface, and "apt" the "nice" one, but going forward apt will get versioned interfaces as well, and apt-get will likely be dropped/just exist as a compat layer for that.

First, thank you for taking the time to reply. My major concern was actually the use of an undocumented command option to apt, and clearing that up.

doing just "apt upgrade" first is not tested much with PVE, and if we (or one of the Debian package maintainers) miss a package relationship constraint somewhere it might go wrong. usually that is fixable, but it might cause extra work, so I would just go straight to "apt full-upgrade".
This was what I suspected, but with recent discussions and with so much misinformation out there about the differences between dist-upgrade and full-upgrade it's good to see that just using apt full-upgrade is staff-recommended.