How to Upgrade Ubuntu From the Terminal: APT vs do-release-upgrade for Updating Linux

APT should be used for routine package updates, while do-release-upgrade should be used when moving Ubuntu to a newer release. That is the clean split. APT keeps the current Ubuntu version patched, such as Ubuntu 22.04 staying on 22.04. Ubuntu LTS releases get five years of standard security maintenance, so many servers can safely stay on one base version for a long time before a release upgrade is needed [source: Ubuntu].

TLDR: A system administrator should run sudo apt update && sudo apt upgrade for normal updates, but should run sudo do-release-upgrade to move from one Ubuntu release to another. For example, a web server on Ubuntu 22.04 may get hundreds of security and package fixes through APT without becoming Ubuntu 24.04. In a small office with 25 Ubuntu desktops, APT may handle weekly patching in minutes, while a release upgrade may take 45 to 90 minutes per machine and needs backup time.

What APT Actually Does

APT updates software inside the same Ubuntu release. It checks package lists, downloads newer versions, installs security fixes, and upgrades installed applications. It does not normally change the operating system from one Ubuntu release to another.

The usual APT workflow is simple:

  • sudo apt update refreshes the package index.
  • sudo apt upgrade installs available upgrades without removing packages.
  • sudo apt full-upgrade allows package removals when needed to finish upgrades.
  • sudo apt autoremove cleans unused dependencies.

This is the command set most users need every week or every month:

sudo apt update
sudo apt upgrade
sudo apt autoremove

APT is best for routine maintenance. It is also safer during normal work because it changes fewer core release files. APT pulls packages from repositories already configured for that Ubuntu version. If the system is on Ubuntu 22.04, APT uses 22.04 repositories unless someone has manually edited the sources.

The catch is that APT can give a false sense of completion. A machine may say all packages are up to date while still running an older Ubuntu release. That is not a bug. It only means the system is fully updated within its current release.

What do-release-upgrade Does

do-release-upgrade upgrades Ubuntu itself. It changes the system from one Ubuntu version to the next supported version. It updates repository entries, calculates package changes, removes obsolete packages, installs new base packages, and adjusts critical system components.

A normal command looks like this:

sudo do-release-upgrade

On servers, the update manager core package may be needed first:

sudo apt update
sudo apt install update-manager-core
sudo do-release-upgrade

Before running it, the administrator should check this file:

/etc/update-manager/release-upgrades

The Prompt setting controls upgrade offers:

  • Prompt=lts offers upgrades only to the next LTS release.
  • Prompt=normal offers upgrades to supported interim releases too.
  • Prompt=never disables release upgrade prompts.

For production servers, Prompt=lts is usually the saner choice. Interim releases have shorter support windows and require more frequent upgrades.

APT vs do-release-upgrade: The Practical Difference

Task Use APT Use do-release-upgrade
Install security fixes Yes No
Update installed apps Yes No, except during release change
Move from Ubuntu 22.04 to 24.04 No Yes
Remove obsolete release packages Sometimes Yes
Change repository release names No Yes

It drives people crazy that both tools can install a lot of packages and show similar terminal noise. The difference is still clear. APT patches the current house. do-release-upgrade moves the house to a new foundation.

Recommended Upgrade Order

Before any release upgrade, the administrator should fully update the current release first. This reduces dependency problems and cuts down on strange package conflicts.

  1. Back up important files, databases, and configuration directories.
  2. Check available disk space with df -h.
  3. Update packages with APT.
  4. Reboot if the kernel or system libraries were updated.
  5. Run do-release-upgrade.
  6. Review removed packages and changed config files.
  7. Reboot again after the release upgrade finishes.
sudo apt update
sudo apt full-upgrade
sudo apt autoremove
sudo reboot

After the reboot:

sudo do-release-upgrade

When APT Is the Better Choice

APT is better when the system only needs patches. That includes security fixes, browser updates, driver fixes, library updates, and application updates from configured repositories.

APT is also the better tool when uptime matters. A release upgrade is a bigger event. It can replace core libraries, remove packages, restart services, and ask about config files. On a remote server, that can become stressful fast. If SSH drops during an upgrade, recovery may require console access through a hosting panel.

For a stable workstation, a weekly command is enough:

sudo apt update && sudo apt upgrade

For servers, some administrators prefer:

sudo apt update
sudo apt list --upgradable
sudo apt upgrade

That extra list step gives a quick look before changes happen.

When do-release-upgrade Is the Right Tool

do-release-upgrade is the right tool when Ubuntu itself must move to a newer supported release. This may be needed because hardware support is better, newer software is required, or the current release is getting close to end of support.

It is also safer than manually editing /etc/apt/sources.list and replacing release names by hand. Manual repository edits can work, but they are easier to mess up. One wrong third-party repository can stall the upgrade or leave the package manager stuck. Honestly, it feels like a five-minute shortcut until it costs an hour to fix broken dependencies.

Third-party repositories should be checked before a release upgrade. PPAs, vendor repositories, old database repos, and custom desktop packages can block the process. The upgrader may disable many of them automatically, but the administrator still needs to verify what happened afterward.

Basic Safety Checks Before Upgrading

  • Backups: A release upgrade should never be the first copy of anything important.
  • Disk space: Several gigabytes should be free, especially in / and /boot.
  • Power: Laptops should be plugged in.
  • Remote access: Servers should have console access available.
  • Services: Web, database, VPN, and mail services should be tested after the upgrade.

Best Practice Summary

APT and do-release-upgrade are not rivals. They solve different jobs. APT should be part of regular maintenance. do-release-upgrade should be planned like a small migration.

For most users, the best pattern is plain: keep the system current with APT, stay on LTS releases when stability matters, then use do-release-upgrade when a new LTS release is ready and tested. That approach avoids panic upgrades and keeps Ubuntu predictable.

FAQ

Can APT upgrade Ubuntu to a new release?

No. APT updates packages inside the current Ubuntu release. For a release change, the administrator should use do-release-upgrade.

Should apt upgrade or apt full-upgrade be used?

apt upgrade is safer for routine updates because it avoids removals. apt full-upgrade is useful before a release upgrade because it can resolve deeper dependency changes.

Is do-release-upgrade safe over SSH?

It can be safe, but console access is strongly recommended. If the network or SSH service fails mid-upgrade, recovery may be hard without server console access.

Should backups be made before running do-release-upgrade?

Yes. A release upgrade can remove packages, change config files, and restart services. Backups are mandatory for important systems.

How can the current Ubuntu version be checked?

The administrator can run lsb_release -a or check /etc/os-release with cat /etc/os-release.

How often should APT updates be run?

Desktops can be updated weekly. Internet-facing servers often need faster patch cycles, especially when security updates affect exposed services.

Recommended Articles

Share
Tweet
Pin
Share
Share