Is apt full-upgrade safe?
Solution 1:
You should use sudo apt update && sudo apt upgrade
instead.
Most of the differences between apt
and apt-get
are cosmetic. The major exception is the upgrade
action, which actually behaves in a markedly different way. With apt
, the upgrade
action is nearly always sufficient, and most of the old advice suggesting otherwise does not apply to apt upgrade
.
Unlike apt-get upgrade
, apt upgrade
can install new packages to satisfy dependencies. The full-upgrade
action (and dist-upgrade
, which is a synonym) can do this too, but it also can remove packages, including packages marked as having been manually installed.
Most advice to run full-upgrade
(or its synonym dist-upgrade
) is a vestige of a time when there was no apt
command. Commands with full-upgrade
/dist-upgrade
require special care to be used safely, and there's no good reason even for very experienced users to run them routinely.
Furthermore, although using full-upgrade
/dist-upgrade
and closely inspecting what it proposes to do used to be widely recommended, this recommendation was questionable even at the time. If for some reason you do want to use apt-get
instead of apt
to achieve the same effect as apt upgrade
, you can run apt-get upgrade --with-new-pkgs
.
To recap, for what you're currently doing, this is the command you probably want:
sudo apt update && sudo apt upgrade
And if for some reason you preferred to use apt-get
instead of apt
, you could use this:
sudo apt-get update && sudo apt-get upgrade --with-new-pkgs
There is no need to use full-upgrade
/dist-upgrade
for routine installation of updates. In a stable release of Ubuntu (whether LTS or non-LTS), it is uncommon to need to remove packages in order to upgrade other packages. You might occasionally encounter this situation when using PPAs or other third-party repositories, but even then, you should be very careful, and full-upgrade
/dist-upgrade
would still not be something you'd often need.
Finally, note that one major situation where new packages are installed (which apt upgrade
will do) is kernel updates. Most kernel updates install the new kernel as a separate package, so that you can still boot into the older kernel if the new one doesn't work. Especially if you're only updating from the command line, old kernels can gradually accumulate and take up space. That is still not a situation that full-upgrade
/dist-upgrade
would prevent or address. Instead, to uninstall most old kernels from the command-line, you can use:
sudo apt autoremove
What this really does is to remove packages that were installed automatically as dependencies and that are no longer needed. It can, and sometimes will, remove packages other than old kernels. It is generally safe to run, but I do suggest looking at what it says it's going to do before proceeding.