Linux and servers · Advanced · 18 min
Upgrade a server from Ubuntu 24.04 LTS to 26.04 LTS
By Padding · Updated 18 Nov 2026
Ubuntu 24.04.5 LTS to 26.04.1 LTS · ubuntu-release-upgrader 26.04
You will take a backed-up Ubuntu 24.04 server through do-release-upgrade to 26.04 LTS over SSH with a fallback login, then confirm services, repositories and language runtimes work on the new release.
On this page
An LTS-to-LTS upgrade replaces most of the operating system while the server is running: a new kernel, a new systemd, new versions of every language runtime and database the archive ships. On a server you look after, the risk is not the upgrade tool itself. The risk is your own changes: a PPA, an edited config file, a virtual environment tied to the old Python, or an SSH session that drops halfway through with no other way in.
This tutorial takes one Ubuntu 24.04 server ("noble") to 26.04 LTS ("resolute") with do-release-upgrade, the upgrader Ubuntu Server ships for this. You prepare a way back, bring 24.04 fully up to date, run the upgrade in a session that survives a dropped connection, keep a second SSH door open, answer the config-file questions on purpose, and then check what changed.
Do it on a copy first if you can. Most providers let you restore a snapshot into a new server, which gives you a rehearsal on identical data with nothing at stake.
Step 1 · Confirm the upgrade is offered and make a way back
Ubuntu offers an LTS-to-LTS upgrade only after the new release's first point release. For 26.04 that is 26.04.1, released in August 2026, so a 24.04 server can now see it. Check that your server is set to look for LTS releases and that it finds one:
cat /etc/os-release | grep PRETTY_NAME
grep '^Prompt' /etc/update-manager/release-upgrades
sudo do-release-upgrade -cThe first line should name Ubuntu 24.04. Prompt=lts is the default on LTS servers and is what you want. If it says Prompt=never, someone turned upgrades off on purpose: find out why before you change it to lts. The last command checks only, and prints something like New release '26.04.1 LTS' available. when the upgrade is on offer.
Now make the way back. Take a snapshot of the whole server in your cloud or hypervisor console, with the server shut down if your provider recommends it for consistent disks. If you cannot snapshot, back up the data that matters (databases dumped, not copied while running, plus /etc, /home and your application folders) to another machine, as in back up a server with restic. A backup you have never restored is a hope, not a backup.
Write down what this server runs, so you can check it afterwards:
systemctl list-units --type=service --state=running --no-pager > ~/pre-upgrade-services.txt
ls /etc/apt/sources.list.d/ > ~/pre-upgrade-sources.txt
apt-mark showhold > ~/pre-upgrade-holds.txt
df -h /Check it worked
do-release-upgrade -c reports a new release, your provider's console shows a snapshot dated today (or your backup tool lists today's backup), and ~/pre-upgrade-services.txt lists the services you expect, such as nginx.service or postgresql@16-main.service. df -h / shows at least 5 GB available.
Step 2 · Bring 24.04 fully up to date and reboot
The upgrader works best from a fully patched system running its newest kernel. Install every pending update, including phased updates that Ubuntu is still rolling out gradually:
sudo apt update
sudo apt full-upgrade -o APT::Get::Always-Include-Phased-Updates=trueLook at the held packages you saved. A hold (apt-mark hold) pins a package at its current version, and held packages can block the release upgrade or leave the system half on each release. Release them unless you know a hold must survive:
cat ~/pre-upgrade-holds.txt
sudo apt-mark unhold <package>Replace <package> with each name from the list, one at a time. Then reboot if the system asks for it:
ls /run/reboot-required && sudo rebootIf the file does not exist, ls prints an error and nothing reboots, which is fine. If it does, reconnect once the server is back.
Check it worked
Run sudo apt update again and then apt list --upgradable. It should list nothing, or only packages held back on purpose. apt-mark showhold prints nothing, and ls /run/reboot-required says the file does not exist.
Step 3 · Open a fallback SSH port and start tmux
When you run the upgrader over SSH it asks whether to continue, then starts a second SSH daemon on port 1022. If the main sshd breaks while its package is replaced, you can still log in on 1022. The upgrader does not open that port in any firewall, so do it now, before you start.
If the server uses UFW:
sudo ufw allow 1022/tcp
sudo ufw statusIf your provider has a cloud firewall or security group in front of the server, add an inbound rule for TCP 1022 from your own IP address there as well. Remove both rules at the end of this tutorial.
Next, start a terminal session that keeps running if your connection drops. On a phone hotspot or prepaid mobile data that cuts out when the bundle runs low, this is the step that saves the upgrade:
sudo apt install -y tmux
tmux new -s upgradeEverything from here until the reboot happens inside this tmux session. If your connection drops, SSH back in and run tmux attach -t upgrade to pick up exactly where you were. The upgrader also wraps itself in GNU screen when screen is installed; that is fine inside tmux, and you only need to remember the tmux command.
Check it worked
The bottom line of your terminal shows a tmux status bar with [upgrade] on the left. sudo ufw status lists 1022/tcp ALLOW. If you use a cloud firewall, its rule list shows TCP 1022.
Step 4 · Run do-release-upgrade
Start the upgrade:
sudo do-release-upgradeThe upgrader downloads the new release's upgrade tool and asks something like Continue running under SSH?. Answer y. It then tells you an additional sshd is running on port 1022. Before you go further, open a second terminal on your own computer and prove the fallback works:
ssh -p 1022 <user>@<server-ip>Replace <user> and <server-ip> with your login and the server's address. If it logs you in, close that session and carry on in the first one. If it does not, stop at the next prompt and fix the firewall rule first.
Next the upgrader checks your package sources. It moves Ubuntu's own sources from noble to resolute and disables any it does not recognise as an Ubuntu mirror: PPAs, Docker's repository, NodeSource, a database vendor's repository. You put those back in step 6. It may also convert old one-line .list files to the newer .sources format.
It then shows a summary: how many packages it will remove, install and upgrade, and how much it will download. Read the list of removals (press d for details). If it plans to remove something your application needs, such as a PHP extension or a database server, answer n, find out why, and start again. Otherwise answer y.
The download and install take from ten minutes to well over an hour depending on the server and your connection. During it you may see questions about restarting services. Allowing restarts without asking each time is fine on most servers.
Check it worked
The upgrader is installing packages: you see lines like Unpacking ... and Setting up ... scroll past, and a second SSH login on port 1022 succeeded. If anything fails here, the full logs are in /var/log/dist-upgrade/.
Step 5 · Answer config-file prompts on purpose
When a package ships a new version of a config file that you have edited, the upgrade stops and asks what to do. It looks something like this for a file handled by dpkg:
Configuration file '/etc/nginx/nginx.conf'
==> Modified (by you or by a script) since installation.
==> Package distributor has shipped an updated version.
What would you like to do about it ? Your options are:
Y or I : install the package maintainer's version
N or O : keep your currently-installed version
D : show the differences between the versions
Z : start a shell to examine the situation
The default action is to keep your current version.Some packages, including the SSH server, show the same choice as a menu instead. Use one rule for every prompt: press D (or choose "show the differences") first, then decide.
- Keep yours when the differences are your own settings and the new version only adds comments or options you do not use. This is the default, and for most of your files it is right.
- Take the maintainer's version when the new file adds settings the new release needs, and your changes are small enough to put back afterwards. A copy of the old file is kept beside it, usually ending in
.dpkg-old, or.ucf-oldfor menu prompts. - Keep yours and merge later when you are not sure. The new version is saved next to yours as
.dpkg-dist(or.ucf-dist), and you can compare the two once the server is up.
For /etc/ssh/sshd_config, keep your version if you have hardened it (key-only logins, a changed port), so you do not lock yourself out on reboot. Note the file names you were asked about; you check them in step 7.
At the end, the upgrader asks whether to remove obsolete packages. Read the list before you answer. On a database server it can include postgresql-16 and postgresql-client-16: they came in with the postgresql metapackage, so they do not feel hand-installed, but your version 16 cluster still needs their binaries to run and for pg_upgradecluster to move it to 18. If the list names postgresql-16 or any other database server package, answer n and remove those packages yourself only after pg_upgradecluster has succeeded (step 7). Otherwise answer y, unless the list includes something you installed by hand and still use. Then it reports System upgrade is complete. and asks to restart. Answer y.
Check it worked
The server reboots and you can log in on the normal SSH port. Then run:
cat /etc/os-release | grep PRETTY_NAME
uname -rThe first line names Ubuntu 26.04 LTS, and the kernel version starts with 7.0. The upgrade only counts as done after this reboot.
Step 6 · Re-enable third-party repositories
List the sources the upgrader turned off:
grep -l 'Enabled: no' /etc/apt/sources.list.d/*.sources
ls /etc/apt/sources.list.d/Compare the output with ~/pre-upgrade-sources.txt. For each repository you still need, first check on the vendor's site that it publishes packages for Ubuntu 26.04 (resolute). If it does not yet, leave it off and use the Ubuntu archive's version or wait.
When it does, open the file:
sudo nano /etc/apt/sources.list.d/<name>.sourcesReplace <name> with the file from the list. Change Suites: noble to Suites: resolute (keep any suffix the vendor uses), and delete the Enabled: no line. Many vendors now give their install steps as a ready-made .sources file; using their 26.04 instructions is often simpler than editing. For a PPA, sudo add-apt-repository ppa:<owner>/<name> adds the right entry for 26.04.
APT 3 on 26.04 no longer has the apt-key command. If a vendor's old instructions use it, find their current ones: keys now go in a file named by Signed-By: in the .sources entry.
Then refresh and upgrade from the re-enabled sources:
sudo apt update
sudo apt full-upgradeCheck it worked
sudo apt update finishes with no Err: or does not have a Release file lines, and the grep -l 'Enabled: no' command no longer lists the repositories you re-enabled. apt policy <package> for a package from that repository shows the vendor's URL with resolute in it.
Step 7 · Check services, runtimes and the changes since 24.04
Start with anything that failed to start:
systemctl --failed
sudo journalctl -b -p err --no-pager | tail -n 50Compare running services with the list you saved:
systemctl list-units --type=service --state=running --no-pager > ~/post-upgrade-services.txt
diff ~/pre-upgrade-services.txt ~/post-upgrade-services.txtA unit that appears only in the old list either failed, was renamed, or was replaced. For reading logs in depth, see search the systemd journal with journalctl.
Then work through the jumps that most often break a server after this particular upgrade:
- Python 3.12 to 3.14. Virtual environments made on 24.04 point at
/usr/bin/python3.12, which is gone. Recreate each one and reinstall its packages from your requirements or lock file. - PHP 8.3 to 8.5. The service is now
php8.5-fpm, with a new socket path under/run/php/. Update any Nginx or Apache config that names the old 8.3 socket, and reinstall the PHP extensions you used under their 8.5 names. - PostgreSQL 16 to 18. Your old cluster keeps running on version 16.
pg_lsclustersshows both versions; plan apg_upgradecluster(after a fresh dump) rather than leaving the old version, which no longer gets updates. - MySQL 8.0 to 8.4. Accounts that use
mysql_native_passwordare locked out by default. Move them tocaching_sha2_password. - sudo-rs. 26.04 uses sudo-rs as its default
sudo, with the original kept assudo.ws. Runsudo --version | head -n 1to see which one your server uses. The password prompt text is different, which breaks scripts that wait for[sudo] password for, and sudo I/O logging andsudoreplayare not supported. - Time sync. New installs use chrony instead of systemd-timesyncd, but upgraded servers keep timesyncd. To match a fresh 26.04 install, run
sudo apt-mark auto systemd-timesyncdand thensudo apt install chrony. - Core utilities. Most commands such as
ls,catandsortnow come from rust-coreutils. If a script depends on an exact GNU behaviour, the GNU versions are there with agnuprefix (gnuls,gnusort). - cgroup v1 is gone. Old container tools or agents that need cgroup v1 will not start; upgrade them.
- OpenSSH 10.2. DSA keys no longer work, and the SSH server no longer reads
~/.pam_environment.
Finally, list packages that no longer come from any repository and clean up. Before you confirm autoremove, read the list it prints: if it names postgresql-16, postgresql-client-16 or another database server package whose cluster you have not yet upgraded, answer n and come back after pg_upgradecluster has succeeded. Removing those binaries first leaves the old cluster unable to start or upgrade.
apt list '?obsolete'
sudo apt autoremoveRemove the fallback firewall rule now that you are done. The extra sshd on port 1022 stopped at the reboot:
sudo ufw delete allow 1022/tcpDelete the TCP 1022 rule from your cloud firewall too. Compare each .dpkg-dist or .ucf-dist file with your kept version (diff /etc/nginx/nginx.conf /etc/nginx/nginx.conf.dpkg-dist), merge what you need and delete the spare copy.
Check it worked
systemctl --failed shows 0 loaded units listed. Your application answers from outside, for example its home page loads in a browser. sudo ufw status no longer lists 1022, and sudo find /etc \( -name '*.dpkg-dist' -o -name '*.ucf-dist' \) prints only files you have chosen to keep for later. Once the server has run cleanly for a few days, delete the pre-upgrade snapshot if your provider charges for it.
Next steps
- Make sure the new release keeps itself patched with automatic security updates on Ubuntu.
- Put a scheduled, tested backup in place before the next big change with back up a server with restic.
- Tighten the firewall again after the upgrade with set up UFW on Ubuntu 26.04.
- Investigate any unit that failed after the reboot with search the systemd journal with journalctl.
Related tutorials
- Write safer Bash scripts with strict mode and trapsYou will build a small Bash release script that stops on the first error, says which line failed, survives file names with spaces and always removes its temporary files.
- Write least-privilege sudo rules with visudoYou will replace blanket sudo access with checked rule files in /etc/sudoers.d that let two operators restart one service and edit one file, give an automation account a password-free command list, and audit what every account can run.
- Find your way around the Linux filesystem: /etc, /var, /usr and the restYou will know what each top-level folder on an Ubuntu 26.04 server is for, find where any file came from with dpkg, which, file and findmnt, and have a map of where Nginx keeps its binary, config, data, logs and unit file.
Need this done for you?
Padding does this work for growing companies, from the first diagnosis to a system that keeps working.
Get new tutorials