1

I've tried the steps here for using a ext4.vhdx file to create a new WSL2 instance, but I'm running into a problem.

The referenced answer:

  • Set up WSL, as usual. Make sure you do the wsl --set-default-version 2 step.
  • Install the same distribution from the Microsoft Store that you had on the previous machine
  • Run it for the first time, creating the same username as on the previous computer.
  • Exit WSL
  • wsl --shutdown from PowerShell or CMD
  • Copy the old ext4.vhdx over the newly created one. I'm guessing you know the location, since you backed it up on the old computer, but it's going to be in %userprofile%\AppData\Local\Packages\<distribution_package>\LocalState. If you don't find an ext4.vhdx, and instead find a rootfs folder, then the distribution was created as WSL1.

So, this is what I tried, with one exception, but I get the following error:

The virtual machine or container was forcefully exited.

My one exception is that the previous version installed was Ubuntu 22.04.1.6.0, while my newly installed version is 22.04.1.7.0

Is there a way to get 22.04.1.6.0? Or another fix for my particular error?

The old machine is over-written by the new machine, so doing an wsl --export isn't an option.

NotTheDr01ds
  • 28,025

1 Answers1

1

The virtual machine or container was forcefully exited.

Hmm. From this Github issue there appears to be a lot that could cause that.

One suspect is this comment:

Then I do wsl --shutdown and if I haven't waited long enough, it would tell me that the program is being used by another process. If I tried again after 1 minute or so, it executes the command. After that, if I try running wsl again, it gives me the same error:

Have you tried again with a longer wait after the wsl --shutdown?

Also there's this one:

I launched the bash on Ubuntu shortcut and there was still some setup to be done.

Make sure that the username and password get set fully. I'm guessing this isn't the problem, but it falls in the area that you would be hitting by following my original instructions.


It might be worth it to try the new method I posted today. It's greatly simplified, and updating your WSL probably can't hurt that chances of the underlying being fixed also.

NotTheDr01ds
  • 28,025