sudo apt-get upgrade vs apt upgrade vs full-upgrade: what each one does on a server

Updated November 15, 2026By HostCrust9 min read

sudo apt-get upgrade installs newer versions of the packages you already have. It never installs a new package and never removes one. sudo apt upgrade may also install new dependencies, such as a new kernel. full-upgrade (the same thing as dist-upgrade) may also remove packages.

On a server, run sudo apt update first and simulate with apt-get -s. Use upgrade for routine patching. Keep full-upgrade for a planned window, after you've read which packages it would remove.

What do apt update, upgrade and full-upgrade each do?

Each command goes one step further than the one before it. update only downloads the lists of available packages. upgrade installs newer versions of what's already installed. full-upgrade does the same, but may also install and remove packages to get there.

CommandRefreshes package listsUpgrades installed packagesInstalls new packagesRemoves packages
apt update / apt-get updateYesNoNoNo
apt-get upgradeNoYesNeverNever
apt upgradeNoYesWhen an upgrade needs a new dependencyNever
apt-get --with-new-pkgs upgradeNoYesWhen an upgrade needs a new dependencyNever
apt full-upgrade / apt-get dist-upgradeNoYesYesWhen an upgrade needs it

When upgrade can't install a new version without breaking its own rules, it leaves that package where it is and reports it as kept back. That message has several causes, and only some of them call for full-upgrade. Our guide to packages that have been kept back covers each cause and its fix.

apt update vs apt upgrade

apt update changes no software. It downloads the package indexes from every source in /etc/apt/sources.list and /etc/apt/sources.list.d/, so apt knows which new versions exist. Without it, upgrade works from old lists and misses recent fixes. That's why the two usually run together:

sudo apt update && sudo apt upgrade

The && runs the upgrade only if the update succeeded. In scripts, apt-get update --error-on=any goes further and fails even on a temporary download error, so a job can't carry on with stale lists.

Is apt the same as apt-get?

Nothing replaced apt-get. Both commands use the same libraries and do the same jobs. apt is a newer front end for people at a terminal: it adds a progress bar, colors, and a count of upgradable packages after apt update.

That answers a common question: sudo apt update and sudo apt-get update do the same thing. Both download the package lists from every configured source. Apart from the display, the only difference is that apt update ends by telling you how many packages can be upgraded.

apt also changes a few defaults, and one of them matters on a server:

$ apt-config dump | grep Upgrade-Allow-New
binary::apt::APT::Get::Upgrade-Allow-New "1";

That line makes apt upgrade behave like apt-get upgrade --with-new-pkgs: it installs a new package when an upgrade depends on one. apt-get upgrade doesn't. Neither of them ever removes a package.

The apt manual tells you to use apt-get in scripts, because apt may change its behavior between versions. It already has. apt 3.0 and newer (Debian 13 and Ubuntu 26.04, for example) print a new layout from the apt command, with headings such as Upgrading: and Not upgrading:, and a Summary: block with counts such as Upgrading: 2, Installing: 0. apt-get keeps the older wording. So use apt at the prompt, and apt-get in cron jobs, Ansible tasks and anything that parses output.

Why does apt-get upgrade skip new kernels?

Ubuntu installs each kernel as a new package with the version in its name, such as linux-image-6.8.0-149-generic. The meta-packages that track “the latest kernel” depend on that exact name:

$ apt-cache depends linux-image-generic | head -n 3
linux-image-generic
  Depends: linux-image-6.8.0-149-generic
  Depends: linux-modules-extra-6.8.0-149-generic

When a new kernel comes out, the new linux-image-generic depends on a package that isn't installed yet. apt-get upgrade never installs new packages, so it keeps the kernel meta-packages (such as linux-generic and linux-image-generic) back, and the server never gets the new kernel. apt upgrade, apt-get --with-new-pkgs upgrade and full-upgrade all install it. Debian's linux-image-amd64 works the same way. On our Debian 12 test server, with an older linux-headers-amd64 installed, apt-get upgrade kept it back while apt upgrade installed two new packages. Our kept-back guide shows that output.

Installing a kernel is only half the job. It runs only after a reboot, and until then uname -r still shows the old one. See how to update the kernel on Ubuntu and how to check which kernel is running.

Old kernels pile up in /boot. Since apt 2.1.16, apt full-upgrade (but not apt-get dist-upgrade) also removes kernels that are no longer needed. apt always keeps the kernel you're running plus the newest other one, so there's a fallback if a new kernel won't boot. sudo apt autoremove does the same cleanup, along with other dependencies nothing needs any more.

How do I see what an upgrade will do before running it?

Add -s (simulate). apt works out the whole transaction, prints it, and changes nothing. Run it as root, so apt sees all of its configuration. This is our Ubuntu test server on the day we checked:

$ sudo apt-get -s upgrade
Reading package lists...
Building dependency tree...
Reading state information...
Calculating upgrade...
The following packages were automatically installed and are no longer required:
  libfwupd2 libgusb2
Use 'apt autoremove' to remove them.
The following upgrades have been deferred due to phasing:
  distro-info python3-distro-info
0 upgraded, 0 newly installed, 0 to remove and 2 not upgraded.

Both waiting updates were phased, so a real upgrade would have installed nothing. Our guide to kept-back packages explains phasing and the other reasons apt leaves an update alone. When an upgrade does have work to do, the simulation ends with one line per step. Naming one of those packages shows the format:

$ sudo apt-get -s install --only-upgrade distro-info
...
The following additional packages will be installed:
  python3-distro-info
...
The following packages will be upgraded:
  distro-info python3-distro-info
2 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.
Inst distro-info [1.7build1] (1.7ubuntu0.1 Ubuntu:24.04/noble-updates [amd64])
Inst python3-distro-info [1.7build1] (1.7ubuntu0.1 Ubuntu:24.04/noble-updates [all])
Conf distro-info (1.7ubuntu0.1 Ubuntu:24.04/noble-updates [amd64])
Conf python3-distro-info (1.7ubuntu0.1 Ubuntu:24.04/noble-updates [all])

Here's how to read it:

  • Inst unpacks a package. The version in square brackets is the one being replaced. The parentheses give the new version and the archive it comes from.
  • Conf configures it. That's when the package's own scripts run, and when services may restart.
  • Remv removes a package. On a server, these are the lines to read twice.
  • The summary line counts upgrades, new packages, removals, and packages left at their current version (“not upgraded”).

To check whether full-upgrade would remove anything, filter for those lines: sudo apt-get -s dist-upgrade | grep '^Remv'. No output means no removals. A simulation doesn't lock apt, so run the real command soon afterwards, before the package lists change.

What's a safe order for patching a server?

  1. Make sure you can roll back. Take a snapshot, or check that last night's backup finished. apt has no undo.
  2. Refresh the lists with sudo apt update, and read any errors. A source that failed to download means you're looking at stale data.
  3. See what's waiting with apt list --upgradable. Our guide to checking for security updates shows how to pick out the security fixes and the CVEs they close.
  4. Simulate upgrade and dist-upgrade. Note new packages, removals and anything kept back.
  5. Upgrade with sudo apt upgrade, or apt-get upgrade in a script. Run it inside tmux or screen, so a dropped SSH connection doesn't stop dpkg halfway through.
  6. Read the end of the output. Look for kept-back packages, config file questions and the services that were restarted.
  7. Reboot if asked, then check. If /var/run/reboot-required exists, plan a reboot with our reboot guide. Afterwards, check that your services are running and read their logs.
  8. Clean up last. Run sudo apt autoremove after the server has come back on its new kernel, not before.
sudo apt update
apt list --upgradable
sudo apt-get -s upgrade | tail -n 3
sudo apt-get -s dist-upgrade | grep '^Remv'
sudo apt upgrade
cat /var/run/reboot-required.pkgs 2>/dev/null || echo "no reboot needed"

If that last command names a kernel or libc6, the fix isn't active until you reboot.

What happens to running services during an upgrade?

A daemon keeps running the old code until it restarts. Three things decide what restarts and when:

  • The package's own scripts. Many server packages restart their service when they're upgraded. That happens during the Conf step, in the middle of your upgrade.
  • needrestart on Ubuntu. needrestart runs at the end of each apt transaction and finds services still using replaced libraries. Ubuntu's 24.04 release notes say it now restarts those services automatically, including in non-interactive runs, and it lists any it skipped. Run dpkg -s needrestart to see whether it's installed. To keep a service from being restarted, add it to $nrconf{override_rc} in a file under /etc/needrestart/conf.d/.
  • The kernel and core libraries. Nothing can restart a running kernel. A new kernel needs a reboot, and so do some core library updates. That's what /var/run/reboot-required is for.

Config file questions

If you've edited a package's config file and the new version ships a changed one, dpkg stops and asks which one to keep. In an unattended run, that question can stall the whole upgrade. These options answer it for you:

sudo apt-get -o Dpkg::Options::="--force-confdef" -o Dpkg::Options::="--force-confold" upgrade

--force-confdef takes dpkg's default answer when there is one. --force-confold keeps your existing file when there isn't. dpkg can then save the package's new version beside yours with a .dpkg-dist suffix. Look for those files afterwards and merge any changes you need.

How do I upgrade a single package?

Use install with --only-upgrade:

sudo apt-get install --only-upgrade nginx

--only-upgrade upgrades the package if it's installed and skips it if it isn't, so a typo can't add new software. Both cases, simulated:

$ sudo apt-get -s install --only-upgrade apache2
...
Skipping apache2, it is not installed and only upgrades are requested.
0 upgraded, 0 newly installed, 0 to remove and 2 not upgraded.
$ sudo apt-get -s install --only-upgrade nginx
...
nginx is already the newest version (1.24.0-2ubuntu7.19).

Naming a package has three side effects worth knowing:

  • It brings sibling packages along. Since apt 2.5.2, upgrading one package also upgrades other packages built from the same source if they have the same new version. That's why distro-info pulled in python3-distro-info in the simulation above.
  • It skips phasing. A package you name is installed even if Ubuntu is still phasing it in, which Ubuntu advises against unless you need that update now.
  • It marks the package as manually installed. If it was only a dependency, run sudo apt-mark auto <package> afterwards, so autoremove can still clean it up when nothing needs it.

Simulate first and check that the summary line lists only the packages you expect.

When should you use full-upgrade on a server?

full-upgrade isn't dangerous, but it's the one command here that can remove software without you naming it. Use it when you have a reason and a window:

  • A kept-back package needs a removal or a replacement, and you've read the simulation and agree with it.
  • Before a release upgrade. Ubuntu's release-upgrade guide asks for a fully updated system first and uses sudo apt dist-upgrade -o APT::Get::Always-Include-Phased-Updates=true. Debian's documentation also recommends full-upgrade or dist-upgrade for moving between releases.

Don't pipe -y into full-upgrade on a server you haven't simulated. -y answers yes to apt's question, removals included. It still stops before changing a held package (our kept-back guide shows this) or removing an essential one, but anything else on the list goes. Simulate, read the Remv lines, then run it interactively.

For day-to-day security fixes, let unattended-upgrades do the work, and keep manual runs for everything else.

How we checked this: Ubuntu 24.04.5 LTS server (apt 2.8.4, kernel 6.8.0-149) on 14 Nov 2026 (UTC), with read-only commands and apt-get -s simulations only; Debian 12.15 test server (apt 2.6.2) on 14 Nov 2026 (UTC), where we installed an older linux-headers-amd64 and held a pending OpenSSL update to compare apt-get upgrade with apt upgrade and test -y against a hold, then restored both. The apt 3.0 output format comes from apt's source code, not from a test server. Anything we didn't run ourselves comes from the official documentation listed under Sources.

Check which CVEs are really open on your server

HostCrust Patch Proof compares every installed package with your distribution's own security data. It counts fixes your distro backported and checks the kernel that is actually running, not just the one on disk. Read-only, no root, free.

Run the free check About Patch Proof

Check that auto-patching is really working

unattended-upgrades-check runs 12 read-only checks over SSH on Ubuntu, Debian, AlmaLinux and Rocky Linux servers (unattended-upgrades or dnf-automatic) and gives each server a PASS, WARN or FAIL. Free and open source (Apache-2.0).

Get unattended-upgrades-check

FAQ

What is the difference between sudo apt update and sudo apt-get update?

They do the same job: both download the package lists from every source you have configured, and neither changes any software. apt update shows a friendlier progress display and ends with a count, such as 2 packages can be upgraded. Use apt-get update in scripts, because the apt manual says its behavior may change between versions.

What is the difference between sudo apt update and sudo apt upgrade?

apt update only downloads the lists of available packages, so apt knows what's new. It changes no software. apt upgrade installs the newer versions those lists point to. Run update first, or upgrade works from old lists and misses recent fixes.

Is apt full-upgrade the same as apt-get dist-upgrade?

Yes. full-upgrade is the name the apt command uses, and dist-upgrade is the older apt-get name. Both upgrade everything and may install or remove packages to do it. apt-get full-upgrade also worked on our Ubuntu 24.04 test server (apt 2.8.4), although the apt-get manual only documents dist-upgrade.

Does apt dist-upgrade upgrade Ubuntu to a new release?

No. Despite the name, it upgrades packages within the releases already listed in your apt sources. To move to a new Ubuntu release, Ubuntu recommends do-release-upgrade, after you've fully updated the current release and taken a backup.

Do I need to reboot after apt upgrade?

Only if the upgrade asked for it. Ubuntu and Debian create /var/run/reboot-required when an update, usually a new kernel or a core library, needs a reboot. /var/run/reboot-required.pkgs names the packages. Most other updates take effect when the affected service restarts.

How do I undo an apt upgrade?

apt has no undo. /var/log/apt/history.log records each run, with the old and new version of every package. You can downgrade with sudo apt install package=version only if that version is still in one of your sources (apt-cache policy package lists them), and often only the original release version is left. Downgrading a security update also reopens the hole. A snapshot taken before the upgrade is the reliable way back.

Should I run apt upgrade -y from cron?

For security updates, use unattended-upgrades instead. It's built for unattended runs, installs only the archives you allow, and logs what it did. A cron job with apt-get -y answers yes to every apt question, so with dist-upgrade it would also go ahead with removals that nobody reviewed.

Sources

  1. apt(8) manual, Ubuntu 24.04: update, upgrade, full-upgrade and the advice to use apt-get in scripts
  2. apt-get(8) manual, Ubuntu 24.04: upgrade, dist-upgrade, --simulate, --only-upgrade, --with-new-pkgs
  3. Debian Reference, chapter 2: apt, aptitude and apt-get command equivalents
  4. apt NEWS (Debian): automatic kernel removal on full-upgrade (2.1.16), upgrades by source package (2.5.2)
  5. apt source code: the apt 3.0 output strings such as Not upgrading:
  6. Ubuntu 24.04 LTS release notes: needrestart restarts services after library upgrades
  7. Ubuntu Discourse (Foundations team): needrestart changes in Ubuntu 24.04
  8. dpkg(1) manual, Ubuntu 24.04: --force-confold, --force-confdef and .dpkg-dist files
  9. Ubuntu Server documentation: Upgrade your release (do-release-upgrade)
  10. Ubuntu Server documentation: About apt upgrade and phased updates