14

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?

14
  • 2
    What do you mean by "safe"? Software Updater GUI does exactly the same.
    – Pilot6
    Jun 4, 2020 at 12:13
  • 1
    @Pilot6 by safe I mean it won't leave the system or programs in an unusable or unnecessary buggy state.
    – Steve M
    Jun 4, 2020 at 12:20
  • 3
    It depends on what you did before. The command itself is safe on a healthy system.
    – Pilot6
    Jun 4, 2020 at 12:22
  • 1
    @user535733 I have also often experienced the GUI not updating all programs. I quit using it and use aptitude for that reason. I will follow this post and report back when it happens again. Jun 4, 2020 at 12:51
  • 3
    @OrganicMarble I suspect it's ordinary confusion about phased updates, but an example will avoid guessing.
    – user535733
    Jun 4, 2020 at 12:59

1 Answer 1

26

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.

1
  • Your answer is correct - but I understood through other posts that full-upgrade is important to be used in the process to upgrade the complete OS - of course using other commands to accomplish the goal, for example from 18:04 to 20:04 or from 20:04 to 22:04 Jun 6, 2022 at 13:16

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .