Skip to content
Follow
Ubuntu Linux

Upgrade Ubuntu Linux Without Losing Data

Richard
Written by
Richard
Sep 27, 2021 Updated Sep 15, 2026 5 min read
Enable Automatic Suspension in Ubuntu Linux Easily
Enable Automatic Suspension in Ubuntu Linux Easily

Upgrading Ubuntu Linux moves your operating system to a newer version so you get the latest security updates and features without losing your personal files. Ubuntu Long Term Support (LTS) releases give you 5 years of safety patches, while standard releases give you about 9 months of updates.

Advertisement

Your computer usually shows a pop-up message when a new version is ready to install. If your system is more than 2 versions behind the newest release, you need to update one step at a time to keep your data safe.

⚡ Quick Answer

Update your system using `sudo apt update` and `sudo apt upgrade`. Then, start the release upgrade with `sudo do-release-upgrade -d`. Follow the on-screen prompts to complete the installation.

Advertisement

How to update Ubuntu packages

To update Ubuntu packages before a system upgrade, open Terminal and run the sudo apt update and sudo apt upgrade commands. This process downloads and installs the latest versions of all currently installed software, making sure your system has the newest security patches and bug fixes ready so your upcoming operating system upgrade goes smoothly without software conflicts.

⚠️WarningHeld-back packages in Ubuntu Linux prevent automatic installation, upgrading, or removal.

These held-back packages can cause problems during an operating system upgrade process.

Run the commands below to check whether packages are being held back on your systems.

sudo apt-mark showhold

If packages have a hold on them, run the commands below to release the hold.

Advertisement
sudo apt-mark unhold package_name

Replace package_name with the package's name being held from updates or upgrades.

After that, run the commands below to update and upgrade all installed packages.

sudo apt update
sudo apt upgrade

You may sometimes have to reboot before continuing with the release upgrade.

Next, run the commands below to perform a major upgrade or installed packages.

Advertisement
sudo apt full-upgrade

Next, run the commands below to automatically remove installed package dependencies that are no longer needed on Ubuntu.

sudo apt --purge autoremove

Once the steps above are done, continue below with the upgrade.

How to perform a release upgrade on Ubuntu Linux

To upgrade Ubuntu Linux to a newer release, use either the Software Updater desktop app or run the sudo do-release-upgrade command in Terminal. Both methods safely download and install the next major operating system version while keeping your personal files, settings, and installed applications intact on your hard drive.

You can upgrade from the command line with do-release-upgrade or using the desktop GUI update tool Software Updater. The command line option works for both Ubuntu desktop and server editions.

Advertisement

The Ubuntu upgrade package manages system updates. Install the upgrade package using the command `sudo apt update && sudo apt install update-manager-core` if the package is not already present on your computer. This ensures your system is ready for the next major Ubuntu version.

sudo apt install update-manager-core

After installing the package above, run the commands below to start the upgrade process.

sudo do-release-upgrade -d

The above command will turn off all third-party repositories and change the apt list to the Ubuntu upgrade version repositories. You will be prompted several times to confirm that you want to continue the upgrade.

Follow the on-screen instructions. y = yes and N= No. When prompted whether you wish to upgrade, type y.

Advertisement
Do you want to start the upgrade? 

5 packages are going to be removed. 85 new packages are going to be 
installed. 1168 packages are going to be upgraded. 

You have to download a total of 803 M. This download will take about 
11 minutes with your connection. 

Installing the upgrade can take several hours. Once the download has 
finished, the process cannot be canceled. 

 Continue [yN]  Details [d]

Wait for all the newer packages to be downloaded. This may take a while, depending on your Internet connection speed. After all, packages are downloaded, your system will begin upgrading immediately.

⚠️WarningOnce the new packages are installed, the update tool will ask if you want to remove the obsolete software.

If you have a system that you have customized, you may wish to enter d to view the list, just in case you may need to reinstall.

Remove obsolete packages?

53 packages are going to be removed.

 Continue [yN]  Details [d]y

When asked whether you want the services to be automatically restarted during the upgrade, type y for Yes.

When the upgrade process is complete assuming all went well, you'll be prompted to restart. Type y to restart your computer to finish setting up your system.

Advertisement
Restart required

To finish the upgrade, a restart is required.
If you select 'y' the system will be restarted.

Continue [yN] y

Once your system is restarted, your Ubuntu system has fully upgraded to the next release version. You can run the commands below to check the current version.

lsb_release -a

That should output similar lines as shown below:

No LSB modules are available.
Distributor ID:	Ubuntu
Description:	Ubuntu 21.04
Release:	21.04
Codename:	hirsute

Conclusion:

Upgrading Ubuntu Linux involves several straightforward steps. You can follow the instructions in this guide to successfully perform the Ubuntu Linux upgrade. For any errors or additional information regarding the Ubuntu Linux upgrade, use the comment form provided below the article.

Advertisement

Can I upgrade from Ubuntu 24 LTS to 25?

Ubuntu 24 LTS is a long-term support version. Ubuntu 25 is a short-term release. You typically upgrade from an LTS to the next LTS, not a short-term release. Upgrading directly from 24 LTS to 25 isn't the standard path. You'd usually wait for Ubuntu 26 LTS.

How to upgrade Ubuntu 20.04 to 22.04 terminal?

To upgrade from Ubuntu 20.04 to 22.04 using the terminal, first update your current system with `sudo apt update && sudo apt upgrade`. Then, run `sudo do-release-upgrade` and follow the on-screen prompts to complete the upgrade.

How to update Ubuntu from 18 to latest?

Upgrading directly from Ubuntu 18 to the very latest version often requires intermediate steps. You'll likely need to upgrade to 20.04 first, then to 22.04, and so on, using `sudo do-release-upgrade` after each step.

How do I update all apt?

To update all your installed software packages using apt, open your terminal and type `sudo apt update` to refresh the list of available packages. Then, run `sudo apt upgrade` to install the updates for everything.

Was this guide helpful?

Was this helpful?
Richard

About the Author

Richard

Tech Writer, IT Professional

Richard, a writer for Geek Rewind, is a tech enthusiast who loves breaking down complex IT topics into simple, easy-to-understand ideas. With years of hands-on experience in system administration and enterprise IT operations, he’s developed a knack for offering practical tips and solutions. Richard aims to make technology more accessible and actionable. He's deeply committed to the Geek Rewind community, always ready to answer questions and engage in discussions.

Advertisement

📚 Related Tutorials

How to Install Ubuntu Linux
Ubuntu Linux How to Install Ubuntu Linux
How to Install WildFly on Ubuntu Linux
Ubuntu Linux How to Install WildFly on Ubuntu Linux
How to list Services on Ubuntu Linux
Ubuntu Linux How to list Services on Ubuntu Linux
Working with Sudo and Su Commands in Ubuntu Linux
Ubuntu Linux Working with Sudo and Su Commands in Ubuntu Linux

0 Comments

  • thanks for this, but I could use some clarification

    —–

    > First, make sure that the upgrade package is installed. Run the commands below if it’s not already installed.

    > sudo apt install update-manager-core

    what does update-manager-core actually do? googling didn’t seem to help

    > After installing the package above, run the commands below to start the upgrade process.

    >sudo do-release-upgrade -d

    > The command above will disable all third-party repositories and change the apt list to point to the Ubuntu upgrade version repositories

    How to I re-enable them later? Will their repository sources still be in the /etc/apt/sources.list.d

    Reply

Leave a Comment

Your email address will not be published. Required fields are marked *