What is the difference between apt dist-upgrade and apt upgrade?

7,231

Solution 1

For reference:

apt upgrade will upgrade all packages that can be upgraded without the need to install additional packages or remove any conflicting installed packages. Basically it will apply all package upgrades that do not include changed dependencies.

apt full-upgrade (the correct equivalent for apt-get dist-upgrade) applies package upgrades as well if they require either the install of new packages or the removal of conflicting installed packages. Basically it will apply all package upgrades including those with changed dependencies.

On stable distro suites, when not adding new APT sources, one will face changed dependencies rarely, hence usually apt full-upgrade is not required or does not apply any additional upgrades compared to apt upgrade, except for Linux image package upgrades. Linux image packages are usually shipped as meta packages, e.g. linux-image-amd64, which then depends on the actual versioned package, e.g. linux-image-4.19.0-9-amd64. When one uses apt upgrade, the Linux image meta package will usually not be upgraded, since it would required to install a new versioned Linux image package. Running apt full-upgrade on the other hand will do the upgrade, furthermore it might remove the old versioned package, if the new one has a related conflict defined (which is usually not the case for Linux image packages, just as example!).

Due to the nature that installed packages can be removed by apt full-upgrade, it should not be called non-interactively. I personally ran into situations while testing the new Raspbian testing suite, where due to unresolved dependencies or conflicting repository updates the whole webserver stack would have been removed. I needed to wait until that repository inconsistency was resolved, before I was able to do the upgrades without causing havoc. However on stable suites I never faced such issue.

Solution 2

Here is a comprehensive explanation.

https://askubuntu.com/questions/194651/why-use-apt-get-upgrade-instead-of-apt-get-dist-upgrade

If you want things to "just work", you probably want apt-get dist-upgrade to ensure dependencies are resolved.

I just use sudo apt-get update followed by upgrade on my Kali machine. It asks occasionally if I wish to delete old packages (Yes) and about monthly I run sudo apt-get autoremove to remove old packages.

My Linux machines are both working well and I keep them up to date.

Share:
7,231
Marwi
Author by

Marwi

Updated on September 18, 2022

Comments

  • Marwi
    Marwi over 1 year

    What exactly is the difference between apt dist-upgrade vs. just apt upgrade? Which one should I use?