Ubuntu LTS releases get five years of standard support. Upgrading in place to the next LTS, for example 22.04 → 24.04 or 24.04 → 26.04, is well supported with do-release-upgrade. Done carefully, it takes 20–60 minutes on a typical VPS. This guide covers preparation, the upgrade itself and what to check afterwards.
Should you upgrade in place or migrate?
- In place: quicker, keeps everything as it is. Good for well-understood servers with standard packages.
- Fresh server + migration: cleaner, with no leftover cruft and an easy rollback (the old server keeps running). Better for old, heavily customised systems, or when you want to change architecture at the same time.
Either way, back up first.
Timing: when is the upgrade offered?
LTS-to-LTS upgrades are offered after the first point release (e.g. 24.04.1), usually about three months after release, when early bugs are fixed. do-release-upgrade won’t offer the new LTS before that unless you force it with -d. Don’t use -d on production.
Check your current version:
lsb_release -a
cat /etc/os-release
You can only upgrade one LTS step at a time (20.04 → 22.04 → 24.04).
1. Prepare
Back up your data and configs off the server: databases (mysqldump, pg_dump), /etc, web roots and app data. See database backup automation.
Fully update the current release:
sudo apt update
sudo apt full-upgrade
sudo apt autoremove --purge
sudo reboot
Check free space. The upgrade downloads several hundred MB to a few GB:
df -h / /boot
Review third-party repositories (ls /etc/apt/sources.list.d/). They’re disabled during the upgrade. Check that each one (PHP PPA, Docker, PostgreSQL, Node) supports the new release before re-enabling it. See PPAs.
Note important versions. The new release ships newer PHP, Python, PostgreSQL, MySQL and OpenSSL. Your apps must be compatible. For example, PHP 8.1 → 8.3 (22.04 → 24.04) can break old code.
2. Run the upgrade (inside tmux)
sudo apt install ubuntu-release-upgrader-core tmux
tmux new -s upgrade
sudo do-release-upgrade
Over SSH, the tool starts an extra sshd on port 1022 as a fallback, in case the main SSH daemon breaks during the upgrade. If you use a firewall, temporarily allow it (sudo ufw allow 1022/tcp), or just rely on tmux and your provider’s VNC console.
If the connection drops, reconnect and run tmux attach -t upgrade. See tmux.
During the upgrade you’ll be asked:
- Continue? Start upgrade? Review the summary of packages to install and remove.
- Restart services automatically? Usually yes.
- Modified configuration files (
sshd_config,nginx.conf,php.ini…): press D to view the diff. Keep your version (N, the default) unless you know you want the maintainer’s. The new version is saved as*.dpkg-distfor later comparison. - Remove obsolete packages? Review the list, then usually yes.
- Restart now? Yes.
3. After the reboot
lsb_release -a # new version
uname -r # new kernel
systemctl --failed # any failed services?
sudo journalctl -p err -b # errors this boot
Check each service and website:
sudo nginx -t && systemctl status nginx
systemctl status php*-fpm mysql postgresql redis-server
curl -I https://example.com
Common follow-ups:
- PHP version changed: the new
php8.x-fpmsocket path differs. Update Nginxfastcgi_passand reinstall the extensions for the new version. See install PHP versions. - Python virtualenvs built with the old Python may break. Recreate them. See Python venv.
- Third-party repositories: re-enable them with the new codename, then run
apt update. - PostgreSQL: the new release installs a new major version alongside the old one. Your data stays on the old cluster until you upgrade it with
pg_upgradecluster. See upgrade PostgreSQL. - Compare config diffs:
find /etc -name '*.dpkg-dist'.
Then clean up:
sudo apt autoremove --purge
sudo ufw delete allow 1022/tcp # if you opened it
Troubleshooting
“No new release found” — the upgrade isn’t offered yet (before the .1 point release), or /etc/update-manager/release-upgrades has Prompt=never. For LTS-to-LTS it should be Prompt=lts.
“Please install all available updates for your release before upgrading” — run apt full-upgrade and reboot first.
Upgrade interrupted: reattach tmux if possible. Otherwise, from the console:
sudo dpkg --configure -a
sudo apt -f install
sudo apt full-upgrade
See dpkg and apt update errors.
Server doesn’t boot after the upgrade: use the VNC console and select the previous kernel under GRUB’s Advanced options. See Linux rescue mode.
Quick reference
| Step | Command |
|---|---|
| Current version | lsb_release -a |
| Update first | apt update && apt full-upgrade && reboot |
| Upgrade | tmux new -s up; sudo do-release-upgrade |
| Reattach | tmux attach -t up |
| Fix interrupted | dpkg --configure -a; apt -f install |
| Failed services | systemctl --failed |
| Config diffs | find /etc -name '*.dpkg-dist' |
Related: Ubuntu vs Debian for servers and upgrade Debian.