Upgrade Ubuntu on WSL2Janne Kemppainen |
If you search for Ubuntu distributions on the Microsoft Store you’ll notice that only the long term support LTS releases are included. In this post I’ll show you how you can upgrade to the latest release, if you need to.
Before we do that though, let’s quickly review how the Ubuntu release cycle works so that you know what you’re getting into.
Ubuntu release cycle
Each Ubuntu release comes with new features such as newer kernel versions and libraries that you might need. During its lifespan a release receives only bug and security fixes, and no new features. So if something is not included in the LTS version you may have to upgrade to an interim release.
New Ubuntu releases come out every six months. The first two numbers of a release tell the year, and the two numbers after the dot tell the month of the release. For example, Ubuntu 21.10 was released in October 2021.
New LTS releases come out every two years and they are supported for five years. The interim releases between LTS versions are supported for only nine months after their release date. This means that have to keep upgrading more often in order to stay on a supported version.
Do release upgrade
Now that you know how the releases work, it’s time to start the upgrade.
Open the Ubuntu terminal on WSL. First, make sure that everything is up to date:
$ sudo apt update $ sudo apt dist-upgrade
If you want to upgrade to an interim release you’ll need to change the upgrade policy first. Open the
/etc/update-manager/release-upgrades file in the editor of your choice with
sudo permissions, I like to use
vim but you could switch it to
nano if that’s your preferred editor.
$ sudo vim /etc/update-manager/release-upgrades
Change the prompt value from
normal to allow interim releases. Keep the value as
lts if you only want to upgrade to a long term support release.
# Default behavior for the release upgrader. [DEFAULT] # Default prompting and upgrade behavior, valid options: # # never - Never check for, or allow upgrading to, a new release. # normal - Check to see if a new release is available. If more than one new # release is found, the release upgrader will attempt to upgrade to # the supported release that immediately succeeds the # currently-running release. # lts - Check to see if a new LTS release is available. The upgrader # will attempt to upgrade to the first LTS release available after # the currently-running one. Note that if this option is used and # the currently-running release is not itself an LTS release the # upgrader will assume prompt was meant to be normal. Prompt=normal
Because of a compatibility issue with snap on WSL Ubuntu you may need to uninstall the snap daemon before continuing with the upgrade. When
snapd is installed the
do-release-upgrade process fails with this message:
Aborting Reading package lists... Done Building dependency tree Reading state information... Done === Command terminated with exit status 1 (Sun Feb 6 12:43:03 2022) ===
$ sudo apt remove snapd
Finally, run this command to start the upgrade process:
$ sudo do-release-upgrade
The installer asks if you want to continue. Confirm by typing
y and answer other possible questions from the installer. After a while you should be running the latest release. You can verify the release number with this command:
$ lsb_release -a No LSB modules are available. Distributor ID: Ubuntu Description: Ubuntu 21.10 Release: 21.10 Codename: impish
No go on and do awesome things!