Upgrading your Ubuntu LTS distro in WSL
Note: This post was written after upgrading my Ubuntu 20.04 LTS, so I don't have any relevant screenshots/logs at the moment. Things are subject to change in the future.
I was configuring my git settings when I realized that git's version was an older one (2.25). So I tried to update, but it didn't do that and instead told me that it's already up-to-date. It didn't take long to realize that the newer versions are in the repositories of the newer versions, and so I needed to upgrade my WSL distro. Here are the steps:
- Run
sudo do-release-upgrade
At this stage, you will probably see an error telling you that it couldn't find any release. This is because it is looking for LTS releases but there isn't any (as of writing this), so you need to change some configuration files.- Open the
/etc/update-manager/release-upgrades
, and set thePrompt
fromlts
tonormal
(only do this if you are OK with a non-LTS version). Now you can run the original command again.
- Open the
- It will start pulling the repositories of the newest upgradable release. If you notice that the installer is hanging and then terminating, that is because it's trying to start
snap
. So, for the upgrade to proceed, you need to removesnap
. Don't worry, if you need it, you can install it back after the upgrade (why is snap even in WSL when it doesn't work by default? ¯\\\(ツ)\/¯). Remove thesnap
andsnapd
packages, and you'll be good to go. - Now follow the prompts. At one point it will ask for permission to restart all services. Grant the permission and let it continue.
- BOOM! You have upgraded to a newer version! Hope you enjoy your distro with a breath of fresh air.
I found this on another post by Hugh Rawlinson; however, their Ubuntu version was 18.04 LTS, but the steps are pretty much the same.