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
  • 17,574
  • 4
  • 44
  • 81
  • Welcome to Super User! Just a heads-up that you can copy the formatting from another post by clicking *Edit* on that post. Even as a brand new user, you'll have access to that. I've gone ahead and done that to make the question more readable since I know you didn't know about that trick ;-). – NotTheDr01ds Nov 22 '22 at 13:29
  • What's your Windows version? 10? 11? 22H2 of either? Thanks! – NotTheDr01ds Nov 22 '22 at 13:38
  • So you get the error about the virtual machine or container being forcefully exited, but what happens after that, are you unable to start the instance at all? If you had not overwritten the original machine `wsl.exe --update --rollback` might have been an option. – Ramhound Nov 22 '22 at 13:38
  • Also a side-note -- I just rewrote my answer to that linked question, but I don't *think* the changes will make a difference in this area. And yet, they may ... – NotTheDr01ds Nov 22 '22 at 23:08

1 Answers1

0

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
  • 17,574
  • 4
  • 44
  • 81