APT Command Line Equivalent for Update Manager


When I do

sudo apt-get update
sudo apt-get upgrade

Sometimes the Ubuntu GUI Update Manager will still have some items left. e.g. “Complete Generic Linuux kernel”.

I know there's also sudo apt-get dist-upgrade, but that touches other things.

My question is, what's another command line option that I can use that'd update the rest of items shown in GUI update manager (but doesn't touch anything else extra). In other words, I am looking for command line equivalent.

EDIT: This question refers to the update manager which is equivalent to Software Updater in newer versions (e.g. 16.04), as @Eliah Kagan pointed out.

Best Answer

As Flimm commented, the answer really is sudo apt-get dist-upgrade (after running sudo apt-get update, which GUI package management tools automatically do the equivalent of). That is at least the closest thing to running the Software Updater (called Update Manager in older releases).

Running apt-get upgrade will upgrade packages that can be upgraded:

  • without installing any packages that aren't already installed in some version, and
  • without removing any packages.

The Update Manager is capable of doing both these things, so apt-get dist-upgrade is quite close to it.

  • Running sudo apt-get dist-upgrade will not, by itself, upgrade your Ubuntu system to a newer release. In fact, unlike in Debian, apt-get dist-upgrade is not a supported way to upgrade to a new release. In Debian (and in Ubuntu, though it may sometimes fail and is unsupported), changing all the repositories listed in /etc/apt/sources.list to the repositories for the next release and running sudo apt-get dist-upgrade will attempt to upgrade to the next release.

Because apt-get dist-upgrade can remove package (and install new packages you might not want), it's always best to look through the description of what it intends to do before pressing y.

So while running sudo apt-get -y upgrade is usually reasonable, the -y flag should rarely be used with dist-upgrade.

The reason you don't get new kernel versions with sudo apt-get upgrade is because they each are provided by separate, differently named packages. (The kernel version is part off the name.) This is to facilitate keeping an old kernel installed alongside a newer kernel (and being able to select between them in the GRUB menu).

The automatic offering of new kernel packages for installation is accomplished by having a metapackage (like linux-image-generic) installed. When a new kernel comes out for your Ubuntu release, your kernel metapackage is upgraded and the upgraded version fo that metapackage lists the new kernel as a dependency (without preventing the old kernel from continuing to be installed).

If you don't want to use sudo apt-get dist-upgrade, then you can always manually upgrade the individual packages that are listed as held back when you ran sudo apt-get upgrade. To do this, "install" them: sudo apt-get install packagename.

Related Question