How to upgrade Ubuntu in place on WSL / WSL2

WSL Ubuntu do-release-upgrade made easy!If you’re using Windows Subsystem for Linux (WSL), you may be wondering how to upgrade your flavor of linux in place.

Whether you’re using WSL or WSL2, you could just go to the Windows Store and download the whole new shebang.

In my case, I was using Ubuntu 18.04 LTS, and it’s gonna die in the near future. So, I wanted to do a double-upgrade from 18.04 to 20.04 to 22.04. I’ve got a ton of stuff installed and configured, shell scripts set up, rsync, git, and so on – and I didn’t want to have to redo all of it.

Due to some strange error messages when you try do-release-upgrade, it doesn’t seem like you can do an in-place upgrade in WSL1/2 – but you can!

(more…)