How To Upgrade Existing WSL/WSL2 Ubuntu 18.04 to 20.04

19

WSL isn’t new to this audience, and with the new improvements over WSL2 Microsoft has enabled access to Linux from Windows to even greater audiences. While you can download multiple distributions of Linux from the Microsoft Store on Windows 10. If you are an existing WSL user, chances are you don’t want to download a separate new version of the existing Linux that you already have installed.

In this guide we will show you how to upgrade your existing Ubuntu 18.04 TLS to 20.04 TLS without installing a separate instance of Ubuntu so you can keep all your existing OS and all it’s configuration the way is.

2020 09 27 21 59 11 Window 600x312 - How To Upgrade Existing WSL/WSL2 Ubuntu 18.04 to 20.04

You can install the latest Ubuntu 20.04 from the Microsoft Store, however, if you already have a previous version installed this will become a separate instance, unless you want to have two Ubuntu 18.04 and 20.04 side by side. There is no need to download a separate distribution. The best way to upgrade to the latest is by upgrading the existing Ubuntu version.

Assuming you have 18.04 LTS Ubuntu installed with WSL or WSL2.

 lsb_release -a

Upgrade to 20.04 won’t be much hassle.

No LSB modules are available.
Distributor ID: Ubuntu
Description:    Ubuntu 18.04.4 LTS
Release:        18.04
Codename:       bionic

First, we confirm that you are on the latest 18.04 LTS distribution, follow the guide here step by step closely.

sudo apt update
sudo apt list --upgradable
sudo apt upgrade

Next we want to clean up the package source and remove any unused packages.

sudo apt --purge autoremove

It’s important to install this update manager core package this will trick the system to think there is a new LTS available and allow you to do an in place upgrade.

sudo apt install update-manager-core

If you attempt upgrade now you might ran into the follow message.

sudo do-release-upgrade

Don’t worry you can still proceed with the -d

Checking for a new Ubuntu release
There is no development version of an LTS available.
To upgrade to the latest non-LTS develoment release 
set Prompt=normal in /etc/update-manager/release-upgrades.

This should trigger the upgrade.

sudo do-release-upgrade -d

Accept all packages you have to download, and it will take a while depends on your disk speed mostly.

2020 09 27 21 53 47 Window 600x411 - How To Upgrade Existing WSL/WSL2 Ubuntu 18.04 to 20.04

With any luck you will be prompt a few times during the in place upgrade you need to accept all and the last step will prompt you to clean up and remove few packages before you are prompt for the message “System upgrade is complete. Restart required” Press Y to continue.

2020 09 27 22 41 59 Window 600x528 - How To Upgrade Existing WSL/WSL2 Ubuntu 18.04 to 20.04

Note, you do not need to reboot your host (Windows) machine, you will wait for the Ubuntu Linux daemon to reboot, close all Ubuntu terminals and restart.

Check the version again you should see something like this below.

2020 09 27 22 48 46 Window - How To Upgrade Existing WSL/WSL2 Ubuntu 18.04 to 20.04

Congratulation now you have successfully upgraded to the latest version of Ubuntu with your WSL/WSL2.


Was this article Helpful?

Thank you for the feedback!

19 COMMENTS

  1. When I do the last step, I get:
    Checking package manager
    Reading package lists… Done
    Building dependency tree
    Reading state information… Done
    Hit http://archive.ubuntu.com/ubuntu bionic InRelease
    Hit http://archive.ubuntu.com/ubuntu bionic-updates InRelease
    Hit http://security.ubuntu.com/ubuntu bionic-security InRelease
    Hit http://archive.ubuntu.com/ubuntu bionic-backports InRelease
    Hit https://download.docker.com/linux/ubuntu bionic InRelease
    Fetched 0 B in 0s (0 B/s)
    Reading package lists… Done
    Building dependency tree
    Reading state information… Done

    Restoring original system state

    Aborting
    Reading package lists… Done
    Building dependency tree
    Reading state information… Done
    === Command terminated with exit status 1 ===

  2. You might need to do a “wsl.exe –shutdown” if you are told that “You have not rebooted after updating a package which requires a reboot”.

  3. Awesome! This worked!

    One note, I had to edit this file:

    /etc/update-manager/release-upgrades

    and change this line to have “normal”, not “lts”:

    Prompt=normal

  4. You may need to remove snapd if you get the message:
    “There is no development version of an lts available”.

    So run the command:
    sudo apt autoremove –purge snapd

LEAVE A REPLY

Please enter your comment!
Please enter your name here