HomeBlogUbuntu Upgrade From the Command Line: do-release-upgrade vs APT for Updating Ubuntu

Ubuntu Upgrade From the Command Line: do-release-upgrade vs APT for Updating Ubuntu

Author

Date

Category

For an Ubuntu version upgrade, do-release-upgrade should be used; for routine package updates, APT should be used. That is the clean split. APT keeps Ubuntu current inside the same release, while do-release-upgrade moves the system from one Ubuntu release to the next, such as from 22.04 LTS to 24.04 LTS. Ubuntu LTS releases receive 5 years of standard security maintenance, which is a common reason administrators delay major upgrades until the right maintenance window [source: Ubuntu].

TLDR: apt update and apt upgrade are for installing newer packages on the current Ubuntu version, not for jumping to a new release. do-release-upgrade is the official command-line tool for release upgrades, and it checks upgrade paths, repositories, packages, and prompts. For example, a small office server on Ubuntu 22.04 LTS may receive hundreds of package updates through APT over two years, but it still remains 22.04 until do-release-upgrade moves it to 24.04. In practice, a release upgrade can take 20 to 90 minutes, while a normal APT update may take under 5 minutes on a tidy system.

What APT Actually Does

APT, short for Advanced Package Tool, manages software packages on an installed Ubuntu system. It downloads package lists, installs updates, removes packages, resolves dependencies, and keeps installed software patched.

The usual commands are:

  • sudo apt update refreshes the package index.
  • sudo apt upgrade installs available package upgrades.
  • sudo apt full-upgrade can install or remove packages when dependencies require it.
  • sudo apt autoremove removes packages that are no longer needed.

APT works within the repositories configured for the current Ubuntu release. If the system is running Ubuntu 22.04, APT pulls from 22.04 repositories unless those sources are changed. It does not, by itself, perform a controlled release upgrade to 24.04. That detail trips up many users because apt full-upgrade sounds bigger than it really is.

The catch is that “full-upgrade” still means “full package upgrade,” not “new Ubuntu release.” It may replace kernels, remove obsolete packages, and resolve dependency changes. It will not safely rewrite the system’s release identity, third-party repository state, and upgrade policy.

black and white laptop computer windows update settings screen checking for updates interface system restart notification

What do-release-upgrade Actually Does

do-release-upgrade is built for the larger job. It upgrades Ubuntu from one release to another. It checks whether a new release is available, prepares package sources, disables unsupported third-party repositories, calculates package changes, and runs the upgrade in stages.

It is normally started with:

  • sudo do-release-upgrade for a standard release upgrade.
  • sudo do-release-upgrade -d only when testing a pre-release or development upgrade is intended.

On servers, the tool may run inside a protected session so the upgrade can survive a dropped SSH connection. Still, a console, snapshot, or reliable remote access method is strongly preferred. Honestly, it feels like remote upgrades wait for the worst possible moment to expose a shaky network session.

The tool also respects Ubuntu’s upgrade policy. LTS systems may wait until the first point release of the next LTS before offering the upgrade by default. So a system on 22.04 LTS may not immediately offer 24.04 LTS on release day. That delay is annoying, but it reduces pain from early upgrade bugs.

The Practical Difference

The difference comes down to scope.

Task Best Tool Result
Install security patches apt upgrade Same Ubuntu release, newer packages
Upgrade installed packages with dependency changes apt full-upgrade Same Ubuntu release, possible package removals
Move from 22.04 to 24.04 do-release-upgrade New Ubuntu release
Clean unused packages apt autoremove Frees disk space

APT is routine maintenance. do-release-upgrade is a major operation. One patches the house. The other replaces the foundation, wiring, and plumbing while trying not to knock over the furniture.

Recommended Command-Line Upgrade Flow

Before a release upgrade, the system should already be fully updated. A safe preparation flow looks like this:

  1. sudo apt update
  2. sudo apt upgrade
  3. sudo apt full-upgrade
  4. sudo apt autoremove
  5. Reboot if a kernel or core library update was installed.
  6. sudo do-release-upgrade

This sequence lowers the chance of broken dependencies. It also makes the release upgrader’s job cleaner. A system with 317 pending package updates, old PPAs, and almost no free disk space is asking for a long evening.

Disk space matters. A desktop upgrade may need several gigabytes for downloaded packages and temporary files. On small cloud servers, /boot and /var deserve special attention. Expect to waste time on boring cleanup if old kernels have filled /boot to 100%.

Image not found in postmeta

Why Not Just Edit sources.list and Run APT?

Technically, an administrator can edit /etc/apt/sources.list, replace the release codename, and run APT commands. That method is risky and not recommended for normal Ubuntu systems.

do-release-upgrade handles more than repository names. It includes upgrade rules, package transition logic, prompts for removed packages, checks for obsolete software, and safer handling of third-party sources. Manual source editing skips much of that control.

It is the difference between using a migration tool and doing a live transplant with a text editor. Some experts can recover from the mess. Most production systems should not be used for that experiment.

When APT Is the Right Choice

APT is the right choice when the goal is stability within the current release. It should be used for regular patching, security updates, package installation, and cleanup.

Good APT use cases include:

  • Applying weekly security updates.
  • Updating Nginx, OpenSSL, systemd, or desktop packages within the current release.
  • Installing tools such as curl, git, or htop.
  • Cleaning old dependencies after removals.

For most servers, APT should be part of normal maintenance. Some teams patch weekly. Others patch monthly. Critical security updates may need a faster cycle.

When do-release-upgrade Is the Right Choice

do-release-upgrade is the right choice when the Ubuntu release itself is aging out, when newer software stacks are required, or when a long-term support upgrade is planned.

Good release upgrade triggers include:

  • The current Ubuntu release is near end of standard support.
  • A newer kernel is needed for hardware support.
  • Newer language runtimes are required.
  • The organization wants to standardize on a newer LTS release.

Release upgrades should be scheduled. Backups should be tested first. Snapshots are strongly advised for virtual machines. Databases, containers, web apps, and drivers should be checked before the upgrade starts.

green and black digital device ubuntu upgrade backup snapshot system administrator

Best Practice Summary

  • Use APT often. It keeps the current release patched.
  • Use do-release-upgrade rarely and carefully. It changes the Ubuntu release.
  • Do not treat apt full-upgrade as a release upgrade. The name is misleading.
  • Back up before major upgrades. A successful backup is one that has been restored at least once in testing.
  • Remove stale PPAs. Third-party repositories cause many ugly upgrade failures.
  • Read prompts. Blindly accepting every config file replacement can break services.

FAQ

Can APT upgrade Ubuntu from 22.04 to 24.04?

Not safely in the normal sense. APT can upgrade packages, but do-release-upgrade is the proper tool for moving between Ubuntu releases.

Is apt full-upgrade the same as do-release-upgrade?

No. apt full-upgrade handles package dependency changes inside the current release. do-release-upgrade upgrades the operating system release.

Should APT be run before do-release-upgrade?

Yes. The system should be fully updated first. Running apt update, apt upgrade, and often apt full-upgrade reduces upgrade problems.

Can a release upgrade be done over SSH?

Yes, but it carries risk. A stable connection, a backup session, and console access are strongly preferred for servers.

What should be backed up before upgrading?

Configuration files, user data, databases, web files, application data, and virtual machine snapshots should be backed up. The backup should be tested before the upgrade window.

Why does Ubuntu not offer the next LTS upgrade immediately?

LTS systems often wait until the first point release before the upgrade is offered by default. This delay helps avoid early upgrade bugs and rough package transitions.

Recent posts