Ubuntu 18.04.6 LTS(Bionic Beaver)升级问题求助
Hey there! I’ve gone through Ubuntu LTS upgrades multiple times, so let’s break down your problem and fix it step by step.
First, why did you get that error with sudo do-release-upgrade -d?
The -d flag tells Ubuntu to upgrade to the development/unstable pre-release version (usually the latest non-LTS beta). Since your system is an LTS release (18.04), the default upgrade policy only allows moving to the next LTS version (not non-LTS builds)—hence that confusing error message. That flag isn’t what you need for a standard LTS upgrade.
Here’s the correct step-by-step upgrade process:
Before starting, BACK UP YOUR DATA FIRST—whether it’s a server snapshot, copying files to an external drive, or using tar to archive important directories. Upgrades usually go smoothly, but it’s always safe to have a fallback.
Update your current system to the latest patch level
Run these commands to ensure all existing packages are up-to-date before upgrading:sudo apt update sudo apt upgrade -y sudo apt dist-upgrade -y sudo apt autoremove -y && sudo apt cleanReboot your server if any kernel updates were installed:
sudo rebootVerify your LTS upgrade channel is enabled
Ubuntu LTS versions default to only upgrading to other LTS releases, but let’s double-check the config file:sudo nano /etc/update-manager/release-upgradesMake sure the line
Prompt=is set tolts(it should be the default, but sometimes it gets changed). Save and exit nano by pressingCtrl+O, thenEnter, thenCtrl+X.Start the LTS upgrade
For server systems, run the standard release upgrade command (without the-dflag):sudo do-release-upgradeFollow the on-screen prompts: you’ll be asked to confirm the upgrade, agree to package removals if needed, and confirm when the upgrade is complete.
Upgrade to the latest LTS (22.04) if needed
Ubuntu doesn’t support jumping directly from 18.04 to 22.04—you need to first upgrade to 20.04 LTS, then repeat the above steps to upgrade from 20.04 to 22.04 LTS.
Post-upgrade checks
After the upgrade finishes and you reboot:
- Run
lsb_release -ato confirm you’re on the new LTS version. - Check that all your essential services (like web servers, databases) are running correctly.
- Run
sudo apt update && sudo apt upgradeagain to apply any post-upgrade patches.
备注:内容来源于stack exchange,提问作者Mohamed Nazar S.M.




