How to upgrade Ubuntu 24.04 to 26.04 LTS on a server
Upgrade an Ubuntu 24.04 server to 26.04 LTS in place, then fix what we saw break on a real one, PHP-FPM, PostgreSQL, Python venvs and Docker's repository.
Tested on Ubuntu 24.04 LTS, Ubuntu 26.04 LTS
Before you start
- A server running Ubuntu 24.04 LTS
- Root or a user with sudo
- A snapshot or backup taken just before
- About 5 GB of free disk space
To upgrade Ubuntu 24.04 to 26.04 LTS, take a snapshot, run sudo apt update && sudo apt full-upgrade and reboot, then run sudo do-release-upgrade. Since 26.04.1 came out, 24.04 servers are offered the upgrade; on our test server it took 8 minutes 35 seconds and finished cleanly, but four things needed fixing afterwards: PHP-FPM, PostgreSQL, a Python virtualenv and Docker's repository.
We tested this on 3 December 2026 on a Rack4 Budget server (1 vCPU, 2 GB RAM, NVMe), starting from Ubuntu 24.04.5 LTS with nginx, PostgreSQL 16 with a small database, PHP 8.3 FPM, a Python 3.12 virtualenv, Docker CE from Docker's own repository running one container, and ufw. It ended on Ubuntu 26.04.1 LTS with kernel 7.0. Every command and result below is from that server.
What changes from 24.04 to 26.04
| Ubuntu 24.04 | Ubuntu 26.04 (what we got) | |
|---|---|---|
| Kernel | 6.8 | 7.0 |
| PHP | 8.3 | 8.5 |
| PostgreSQL | 16 | 18 |
| Python | 3.12 | 3.14 |
| nginx | 1.24 | 1.28 |
| OpenSSH | 9.6 | 10.2 |
| OpenSSL | 3.0 | 3.5 |
Ubuntu 24.04 keeps standard security updates until April 2029, so there's no rush for a server that works. Upgrade when you want the newer stack, or plan it in before 2029.
Before you start
- Take a snapshot. There's no downgrade. A snapshot taken right before is the fastest way back if anything goes wrong.
- Check free disk space.
df -h /should show at least 5 GB free; our upgrade grew the disk use from 2.3 GB to 4.4 GB before cleanup. Free some up if needed. - List your third-party repositories. The upgrader turns them off (Docker, PostgreSQL's PGDG, NodeSource, PPAs).
ls /etc/apt/sources.list.d/shows them; check each vendor supports 26.04, codenameresolute. - Keep a second way in. SSH stopped answering for about two minutes in the middle of our upgrade while OpenSSH was replaced. It came back on its own, but if it doesn't, the serial console is how you get in. Make sure you know a password that works there.
Bring 24.04 fully up to date
sudo apt update
sudo apt full-upgrade
sudo rebootdo-release-upgrade won't start while updates are waiting or a reboot is pending, so don't skip this. After the reboot, check that the upgrade is offered:
grep PRETTY_NAME /etc/os-release
sudo do-release-upgrade -cOurs printed Ubuntu 24.04.5 LTS, then New release '26.04.1 LTS' available. If you see No new release found, check that /etc/update-manager/release-upgrades says Prompt=lts.
Run the upgrade
sudo do-release-upgradeIt runs inside screen, so a dropped SSH connection doesn't stop it. In order, it:
- Offers to start a spare SSH server on port 1022. Say yes, and open the port in ufw (
sudo ufw allow 1022/tcp) and in any panel firewall for the duration. - Disables third-party sources. On our server it renamed Docker's
docker.listtodocker.list.disabledand commented out its line. - Shows how many packages it will change and the download size. Answer
y. - Asks about configuration files you've edited, such as
/etc/nginx/nginx.conf. Keeping your version (N) is the safe default;Dshows the difference. - Offers to remove obsolete packages. This is where PHP 8.3 goes: on our server it removed
php8.3-fpm,php8.3-cliand the otherphp8.3-*packages. Answery, then fix PHP as below. - Asks to restart. Answer
y.
If you're disconnected, log back in and run sudo screen -x to reattach, or connect on port 1022 with ssh -p 1022.
Check the upgrade worked
grep PRETTY_NAME /etc/os-release
uname -r
systemctl --failedOurs printed Ubuntu 26.04.1 LTS and 7.0.0-44-generic, with no failed units. nginx, ufw and the Docker container were running. Then check the four things below; on our server each needed a fix.
Fix PHP-FPM: 8.3 is gone, 8.5 has a new socket
After the upgrade, php8.3-fpm was removed and php8.5-fpm was running. The socket moved from /run/php/php8.3-fpm.sock to /run/php/php8.5-fpm.sock, so an nginx site that names the old path answers 502 Bad Gateway.
Point nginx at the new socket (or at /run/php/php-fpm.sock, which follows whichever version is installed):
grep -rn "php8.3-fpm.sock" /etc/nginx/
sudo sed -i 's/php8.3-fpm.sock/php8.5-fpm.sock/' /etc/nginx/sites-available/*
sudo nginx -t && sudo systemctl reload nginxYour old pool settings stay in /etc/php/8.3/fpm/pool.d/ but aren't used. Copy any changes you'd made (pm.max_children, user, socket) into /etc/php/8.5/fpm/pool.d/www.conf, do the same for php.ini, and reinstall the extensions your app needs as php8.5-* packages (php8.5-mysql, php8.5-curl and so on). Then sudo systemctl restart php8.5-fpm.
Upgrade the PostgreSQL cluster from 16 to 18
The upgrade installs PostgreSQL 18 but leaves your data in the version 16 cluster, which keeps running. pg_lsclusters showed ours online on port 5432. Upgrade the cluster when you're ready:
sudo pg_upgradecluster 16 main
pg_lsclustersThis copies the data into a new 18 cluster, moves it to port 5432, and stops the old one on 5433. Our test table's 1,000 rows were all there afterwards, and SHOW server_version returned 18.6. Check your own data and apps, then remove the old cluster and packages:
sudo pg_dropcluster 16 main
sudo apt purge postgresql-16Have a dump as well as the snapshot before you start; restore a PostgreSQL database shows how to use one.
Rebuild Python virtualenvs
A virtualenv points at the Python it was made with. After the move from 3.12 to 3.14, ours failed with ModuleNotFoundError: No module named 'requests', because its packages were installed for 3.12. Rebuild each virtualenv from your requirements:
rm -rf /opt/app/venv
python3 -m venv /opt/app/venv
/opt/app/venv/bin/pip install -r requirements.txtThen restart the service that uses it. Check your dependencies support Python 3.14 first; older pinned versions of some packages won't install.
Turn Docker's repository back on
Docker stayed installed and its container came back after the reboot, but its repository was disabled, so Docker would get no more updates. The upgrader left this note in the file: This file could not be automatically migrated to a .sources file during the upgrade. Docker publishes a resolute repository, so replace the old file with one in the new format:
sudo tee /etc/apt/sources.list.d/docker.sources <<'EOF'
Types: deb
URIs: https://download.docker.com/linux/ubuntu
Suites: resolute
Components: stable
Signed-By: /etc/apt/keyrings/docker.asc
EOF
sudo rm /etc/apt/sources.list.d/docker.list.disabled
sudo apt update
sudo apt full-upgradedocker version reported 29.10.1 afterwards. Do the same for any other vendor repository, using its own 26.04 instructions.
Clean up
sudo apt autoremove --purge
df -h /Close port 1022 again if you opened it (sudo ufw delete allow 1022/tcp). Ours ended at 4.1 GB used.
Troubleshooting
Please install all available updates for your release before upgrading. Run sudo apt update && sudo apt full-upgrade, reboot, and try again.
No new release found. Check Prompt=lts in /etc/update-manager/release-upgrades, and run sudo do-release-upgrade -c to see what's offered. Ubuntu can hold upgrades back for a while after a problem.
502 Bad Gateway on a PHP site. nginx is still pointing at php8.3-fpm.sock. See the PHP-FPM section above.
The upgrade stopped with an error. Run sudo dpkg --configure -a, then sudo apt full-upgrade. The details are in /var/log/dist-upgrade/main.log and apt-term.log.
SSH doesn't answer after the reboot. Use the serial console and check systemctl status ssh.socket and journalctl -u ssh -b.
Next steps
- Coming from 22.04? Go one LTS at a time: upgrade Ubuntu 22.04 to 24.04 first.
- On Debian instead? Upgrade Debian 12 to 13.
- Read the first boot's errors with
journalctl -p err -b, explained in read logs with journalctl.
Doing it on Rack4
Take a snapshot in the panel right before you start; reverting to it undoes the whole upgrade. If SSH doesn't come back, the panel's serial console or browser terminal gets you in. Building a fresh server on Ubuntu 26.04 and moving your data across is the alternative, and often simpler for a server you've changed a lot. It takes about a minute to build on any plan.