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

  1. Take a snapshot. There's no downgrade. A snapshot taken right before is the fastest way back if anything goes wrong.
  2. 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.
  3. 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, codename resolute.
  4. 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

bash
sudo apt update
sudo apt full-upgrade
sudo reboot

do-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:

bash
grep PRETTY_NAME /etc/os-release
sudo do-release-upgrade -c

Ours 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

bash
sudo do-release-upgrade

It runs inside screen, so a dropped SSH connection doesn't stop it. In order, it:

  1. 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.
  2. Disables third-party sources. On our server it renamed Docker's docker.list to docker.list.disabled and commented out its line.
  3. Shows how many packages it will change and the download size. Answer y.
  4. Asks about configuration files you've edited, such as /etc/nginx/nginx.conf. Keeping your version (N) is the safe default; D shows the difference.
  5. Offers to remove obsolete packages. This is where PHP 8.3 goes: on our server it removed php8.3-fpm, php8.3-cli and the other php8.3-* packages. Answer y, then fix PHP as below.
  6. 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

bash
grep PRETTY_NAME /etc/os-release
uname -r
systemctl --failed

Ours 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):

bash
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 nginx

Your 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:

bash
sudo pg_upgradecluster 16 main
pg_lsclusters

This 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:

bash
sudo pg_dropcluster 16 main
sudo apt purge postgresql-16

Have 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:

bash
rm -rf /opt/app/venv
python3 -m venv /opt/app/venv
/opt/app/venv/bin/pip install -r requirements.txt

Then 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:

bash
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-upgrade

docker version reported 29.10.1 afterwards. Do the same for any other vendor repository, using its own 26.04 instructions.

Clean up

bash
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

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.

Ready when you are

Order a server