How to Upgrade WSL 2 or 1 Ubuntu 20.04 to 22.04 LTS

Ubuntu 22.04 LTS Jammy Jellyfish is the upcoming Long term version of Canonical Linux OS. However, while writing this tutorial it was still in the testing phase and set to roll out in 2022 April. Well, for those who are interested to try it out without losing their existing Ubuntu 20.04, here are the steps.

Warning: Don’t Upgrade your production system because Ubuntu 22.04 is still in the development stage. This is only for testing. And also don’t forget to backup your important data before starting the upgrading process.

 

Upgrade Ubuntu 20.04 LTS to Ubuntu 22.04 LTS (Jammy Jelly Fish)

Here we are using Ubuntu 20.04 Focal fossa that is running on Windows 11 or 10 WSL 2 (Windows Subsystem for Linux), however, this tutorial will also work on a normal 20.04 LTS running on a Virtual machine or PC/Laptop.

System Update

First, of all make sure all the installed software packages on your system are up to date. For this, we just need to run update & upgrade commands:

sudo apt update
sudo apt upgrade

Also, run the below distribution upgrade command to get if any nearest release is available.

sudo apt dist-upgrade

 

Install update-manager-core

Although the update manager core will already be there, however, to confirm just run the given command:

sudo apt install update-manager-core

Edit the release-upgrades configuration file using the below-given command.

sudo nano /etc/update-manager/release-upgrades

After that change the Prompt value from Normal to LTS. However, by default, it will be set to LTS.

Prompt = lts

Save the file by pressing Ctrl+O and then exit the same with Ctrl+X.

 

Upgrade Ubuntu 20.04 (Focal Fossa) to Ubuntu 22.04 (JellyFish)

Finally, the system is prepared to get the latest available long-term version available to install, here for Focal Fossa, it is Jelly Fish.

sudo do-release-upgrade -d

After running the above command, the system will update and replace the system repository and after that, once the system is ready to get upgraded, you will ask finally whether you want to upgrade or not. If you have changed your mind then type ‘n‘ and the system will roll back all the made changes.

Upgrade Ubuntu 20.04 LTS to Ubuntu 22.04 LTS Jammy Jelly Fish

Once the installation of the new Jammy Jelly Fish is completed, remove the obsolete packages to clear some space by pressing Y and hitting the Enter key.

Upgrade Focal fossa to Jelly fish

Once done, the WSL Ubuntu App will ask you to restart the system. However, it has not been started as an init system, so that will not be possible. Therefore, simply close the WSL app window and open it again.

Restart WSL

 

Check Ubuntu 22.04 WSL version

Next, a time when you start the Ubuntu WSL app, check its version to confirm you have the upgraded Ubuntu Jammy Jellyfish 22.01 LTS version (development branch).

WSL Ubuntu 22.04 LTS Jammy Jelly FIsh

 

8 thoughts on “How to Upgrade WSL 2 or 1 Ubuntu 20.04 to 22.04 LTS”

  1. After I upgraded to Ubuntu 22.04 all windows, e.g. nautilus, has Light Theme colors (except gnome-terminal).

    How do I change to default dark theme ?

    Reply
  2. Thanks for this instructions! The upgrade worked very well.

    The described “sudo apt dist-upgrade” didn’t do anything visible for me. Therefor it did worry me for the longtime success.

    Reply
  3. dist-upgrade doesn’t do anything too special; it just prioritizes getting the latest versions of dependencies for the most important programs over other programs that might have held those packages back. Basically it “prepares” your system a little more for doing the actual distribution upgrade after that.

    So if the command didn’t do much, your system was basically already fine to do the upgrade.

    Reply
  4. On the last screenshot, we can see that you are on a non LTS version.
    It’s a bit confusing knowing that in the tutorial, we explicitly define that we want LTS only.

    Thank you for the tutorial.

    Reply

Leave a Comment

This site uses Akismet to reduce spam. Learn how your comment data is processed.