Uncategorized

Windows upgrade – missing WSL machines?

Featured Post Image - Windows upgrade – missing WSL machines?

I was curious as to why I was missing the tabbed experience of Windows explorer, and figured out for some reason I was stuck on Windows 11 21H1. Windows update was up to date, but still was stuck on an old “core version” of Windows 11. So I downloaded the upgrade tool and upgraded my windows to the latest, 24H2. The upgrade went pretty well, but after the upgrade finishes Microsoft has decided to f** up some of your settings for some insane reason. They keep most of your things like they were, but change some things like your background image, startup apps and so on for no other reason than to f** with you.

Those settings are easy to fix, however annoying they are. Something a lot more severe, is that they decided that WSL (Windows Subsystem for Linux) is just not important. I use WSL a lot, and have a rather large old Ubuntu which I use for many things. However, after upgrading, the WSL was basicly reset and even though it had some references to old installations I had, only one new version of Ubuntu was booting, and it was clean/fresh and asked for username and password.

After some googling, I found some references to this happening to others, and that the old files should still be there. Here is how to find them, and get it back up and running:

  1. Find the old files. They should be in “%USERPROFILE%\AppData\Local\Packages” somewhere. Easiest way to find it is by searching for ext4.vhdx. For me, it was located in “CanonicalGroupLimited.Ubuntu20.04onWindows_79rhkp1fndgsc” and the subfolder is LocalState.
  2. Make a copy of the whole folder, as you might want that if the attempt to use it again somehow corrupts it.
  3. Start a command prompt, and install the same Linux distribution with “wsl –install <distro>”. You can see them all with “wsl –list –online”.
  4. After installing, make sure that all the installed instances are shutdown with “wsl –shutdown”.
  5. The new installation should make a new folder under the Packages-folder. Find it, copy the folder name, rename it to something else (like … .new), and then rename your old folder to the new name.
  6. From a command prompt, try to boot it with “wsl -d <distribution>”. If this works, you got it back and only small details remain. If it didn’t work, you have more work ahead of you – but that is outside of the scope of this post. Basicly you need to mount the vhdx-file, either in another distribution, or as a VM in Hyper V or something similar.
  7. To get it to be default when you launch Windows Terminal, start Windows Terminal, and either make a new profile, or change an existing one to use the correct distribution. Then make it default.

I hope that was helpful. I am very happy I got my WSL distro back, and will make sure it gets backed up in the future.

And Microsoft: Please stop fiddling around with our settings unneccessarily. That also includes WSL.

Leave a Reply

Your email address will not be published. Required fields are marked *