I tend to obsessively want to upgrade everything I can, so I run the Software Updater GUI tool and also sudo apt update && sudo apt full-upgrade
and blindly install everything. It seems the command line often has packages to update when the GUI doesn't. I'm running 20.04.
Is my practice safe or do I stand a chance of breaking something? What's the recommended way of keeping everything as up to date as possible without breaking things?
You should use
sudo apt update && sudo apt upgrade
instead.Most of the differences between
apt
andapt-get
are cosmetic. The major exception is theupgrade
action, which actually behaves in a markedly different way. Withapt
, theupgrade
action is nearly always sufficient, and most of the old advice suggesting otherwise does not apply toapt upgrade
.Unlike
apt-get upgrade
,apt upgrade
can install new packages to satisfy dependencies. Thefull-upgrade
action (anddist-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 synonymdist-upgrade
) is a vestige of a time when there was noapt
command. Commands withfull-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 useapt-get
instead ofapt
to achieve the same effect asapt upgrade
, you can runapt-get upgrade --with-new-pkgs
.To recap, for what you're currently doing, this is the command you probably want:
And if for some reason you preferred to use
apt-get
instead ofapt
, you could use this: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, andfull-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 thatfull-upgrade
/dist-upgrade
would prevent or address. Instead, to uninstall most old kernels from the command-line, you can use: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.