Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

wsl --set-version <distro> 2 fails with "path not found" #5075

Closed
mazhar10 opened this issue Apr 11, 2020 · 42 comments
Closed

wsl --set-version <distro> 2 fails with "path not found" #5075

mazhar10 opened this issue Apr 11, 2020 · 42 comments

Comments

@mazhar10
Copy link

windows 10 version 2004 build 19041.173.
WSL 1 is working fine.

wsl -l -v returns:
NAME STATE VERSION

  • openSUSE-42 Stopped 1

When I execute wsl --set-version openSUSE-42 2, the command runs for a few minutes then fails with "The system cannot find the path specified."

The same steps executed on another machine with the same version and build of Windows 10 completed fine.
Is there any log or debug switch to see what the failing instance is failing on?

@onomatopellan
Copy link

Has that other machine more RAM?
It's probably same as #4669.

If that distro doesn't have anything important is better to uninstall it and install it again directly as wsl2.

wsl.exe --set-default-version 2

@mazhar10
Copy link
Author

Thanks.

Actually the machine where it works has less RAM than the non-working case. The working machine has 8 GB and the non-working has 16 GB.
I can definitely try uninstalling and reinstalling the distro, I just want to make sure any diagnostic data needed for this issue is captured.

@onomatopellan
Copy link

Conversion process has been improved in latest fast insider builds. That fix won't probably make it to slow ring because version 2004 release is imminent.

@sirredbeard
Copy link
Contributor

Are you trying to install it on a drive other than C:?

@mazhar10
Copy link
Author

The distro is already installed and running fine under WSL 1. Everything is on the C drive. The upgrade from WSL 1 to 2 via the set-version command is what is failing with the "path not found" Error.

@onomatopellan
Copy link

Try disabling real time protection in Windows Defender before converting. Does it always last the same period of time until the error appears?

@mazhar10
Copy link
Author

@onomatopellan , yes, it errors out at the same time.
I removed the distro, set the default version to 2. Now it gives an error " 0x80070003" when trying to install the distro.

@mazhar10
Copy link
Author

Now it seems I am truly wedged. wsl -l -v shows no distros installed, but going into MS store shows my distro as installed. Launching the distro opens a windows that says installing and then fails with the error mentioned above.

@onomatopellan
Copy link

Reboot Windows and try this.

@mazhar10
Copy link
Author

Thanks onomatopellan, I will try the steps in the link you provided. For what it's worth, I removed the WSL feature, reinstalled it, but windows store thinks my distro of opensuse is isntalled while wsl -l -v does not show anything installed. I wonder where that information is kept. It is really bad design that one would install something via the Store but uninstall it via some other way, leaving store thinking the item is installed.

@mazhar10
Copy link
Author

I executed DISM /Online /Cleanup-Image /CheckHealth as stated in the link you provided. It said everything eas clean and no corruption was found. Windows Store still showed the distro as installed. I clicked the shortcut in the start menu for the distro. A window opens up where it says installing, and after a few minutes it fails again with error Error: 0x80070003.
The problem is now I am not sure what else I can remove/reinstall. Any idea where the configuration data stating the disto is installed is stored at? I cannot reinstall the distro through the store because it thinks it is already installed.

@onomatopellan
Copy link

onomatopellan commented Apr 14, 2020

Try to unregister the damaged distro with wslconfig.exe /u distroName.

If nothing works you can definitely erase it with regedit in HKEY_CURRENT_USER\SOFTWARE\Microsoft\Windows\CurrentVersion\Lxss. Each folder it's a distro.

@mazhar10
Copy link
Author

wslconfig.exe /u distroName exits with "There is no distribution with the supplied name.".
At the registry location you mention, there is a value called default version with a value of 2, there are no folders or other values.

@onomatopellan
Copy link

onomatopellan commented Apr 14, 2020

There are no distros installed then.
To uninstall openSuse42 open Start Menu and when you see the openSuse tile do right click on it -> Uninstall.
I can't find that distro on the store so maybe you will need to install openSuse-Leap-15-1 instead.

@mazhar10
Copy link
Author

That worked to uninstall the distro. I was able to right click on the tile and choose uninstall, which then made Windows Store realize it was not installed any longer.
After uninstalling, attempts to install the openSuse-Leap-15-1 distro fail with "Error: 0x80070003".

@onomatopellan
Copy link

onomatopellan commented Apr 14, 2020

Then let's back to square one with wsl.exe --set-default-version 1. Can you install it after that?

@mazhar10
Copy link
Author

That works, I can install the distro fine after setting the default version to 1.

@onomatopellan
Copy link

Ok then. Try again now with wsl --set-version openSuse-Leap-15-1 2
If it stills fails then something is impeding you to convert it to WSL2 in that PC. Supposing you already enabled Virtual Machine Platform feature and you see "virtualization:enabled" in CPU in Performance tab in Task Manager, then try to convert the distro to WSL2 in two steps. Open an elevated PowerShell and enter:

wsl.exe --export  openSuse-Leap-15-1 ./openSuse.tar

mkdir ~/AppData/Local/openSuse

wsl.exe --import openSuse ~/AppData/Local/openSuse ./openSuse.tar --version 2

Tell me if you can at least create the .tar file without errors.

@mazhar10
Copy link
Author

Executing wsl --set-version openSuse-Leap-15-1 2 still failed with "path not found" as in the past.
taskmgr shows virtualization is enabled.
I am performing the export and import steps for the upgrade. Thanks for all your suggestions thus far and I shall keep you informed of how it goes,

@mazhar10
Copy link
Author

The exported tar file was created successfully. Trying to import it with --version 2 now.

@mazhar10
Copy link
Author

The import command fails with "path not found" !

@onomatopellan
Copy link

onomatopellan commented Apr 14, 2020

I guess it doesn't work in any folder?

mkdir C:\test
wsl.exe --import openSuse C:\test ./openSuse.tar --version 2

edit: I just tested it and it works for me. Do you see a vhdx file in ~/AppData/Local/openSuse or C:\test while import is running?

@LaiQE
Copy link

LaiQE commented Apr 15, 2020

I have the same problem,and I solved the problem by reinstall Microsoft-Windows-Subsystem-Linux,you can try it

@mazhar10
Copy link
Author

@onomatopellan I see a file called ext4b.vhdx show up in the target folder. The file gets deleted when the import process fails.
@LaiQE I tried that already as mentioned in the thread above. That did not resolve the problem.

@onomatopellan
Copy link

I think what @LaiQE meant is to reinstall the Windows feature. You can try opening an elevated PowerShell and typing:
dism.exe /online /enable-feature /featurename:Microsoft-Windows-Subsystem-Linux /all /norestart
and reboot.

Definitely something is impeding to fill the vhdx file.
You can follow this in order to create some logs.
The order would be:

  • Start collecting logs.
  • Run wsl.exe --import openSuse ~/AppData/Local/openSuse ./openSuse.tar --version 2 and wait for the error.
  • Stop collecting logs.

then attach the 3 .etl files generated to a new post in this thread so @benhillis or @craigloewen-msft can look what's happening.

@LaiQE
Copy link

LaiQE commented Apr 16, 2020

I solved the problem follow this

  1. remove all Linux operating system
  2. close windows subsystem and Virtual machine platform in control panel(I'm not sure it's called that because of the Chinese system I use)
  3. reboot
  4. reinstall wsl and wsl2 like you first install it

@mazhar10
Copy link
Author

I removed wsl by going into the windows features area of settings and removing wsl from there. Then I rebooted and installed it again. Ran into same problems trying to upgrade to version 2.
I will turn on enhanced logging and collect the logs shortly. Many thanks for the troubleshooting ideas so far.

@mazhar10
Copy link
Author

The import was failing as described above but I noticed that the distro was still installed as version 1 when I was doing the import. I deleted the distro, and now the import fails much quicker and without even creating the vhdx file. I am attaching the logs from this particular run, namely exported distro, deleted distro in wsl (by right clicking the tile and choosing uninstall), and then attempting to import the exported .tar as a version 2.

wsl-event-traces.zip

@onomatopellan
Copy link

If you open C:\windows\System32\lxss\tools can you see the ext4.vhdx.gz file (412KB)?

If something fails when creating the vhdx you could see it in Event Viewer. In Applications and Services Logs - Microsoft - Windows - VHDDMP. Look at the time stamps to know which entries match with the latest import call.

@mazhar10
Copy link
Author

I do see ext4.vhdx.gz in C:\windows\System32\lxss\tools. It is dated 12/07/2019 06:19.
Looking in eventvwr under Applications and Services Logs -> Microsoft -> Windows -> VHDDMP, I see 2 folders, Microsoft-Windows-VHDMP/Operational and Operational. There are no entries in either of the 2 folders nor any in the parent.

@onomatopellan
Copy link

Interesting. Are you on Windows 10 Pro or Home?
Have you ever see a WSL2 distro working on that PC? And a Hyper-V VM?

@mazhar10
Copy link
Author

Windows 10 Pro.
I had never had a need to create a Hyper-V VM on this machine. However, I created a test Hyper-V VM and it errors out when trying to start with a "Path not found" error as well. I suppose that is the root cause here, and now I need to see how to troubleshoot Hyper-V on this machine.

@onomatopellan
Copy link

Please try this #4626 (comment)

@mazhar10
Copy link
Author

I tried what that link suggested, namely setting config guard setting for vmcompute.exe back to system default, but that did not make a difference. One difference between what the link seems to suggest and my setup is that on my machine, vmcompute service is running fine (or at least is running). I did do a net stop vmcompute and then net start vmcompute after making the one change it suggests in windows security.

@onomatopellan
Copy link

onomatopellan commented Apr 16, 2020

See if Hyper-V Virtual Machine Management service (vmms) is running. There are people that can't run Hyper-V because of that. Another example you can try:

https://www.surfacetablethelp.com/2018/10/fix-hyper-v-not-working-after-windows-10-v1809-upgraded.html

@mazhar10
Copy link
Author

vmms is running. I added that additional exe to config guard exception as per the last link you provided. No joy so far.

@mazhar10
Copy link
Author

Solved! Removing the hyper-v feature and re-adding resolved the issue. Now I can start Hyper V VMs and also was able to import the distro with --version 2. Thank you to all for helping!

@keanerickson
Copy link

I don't understand, why is hyper-V needed when we're trying to use WSL2? Doesn't WSL2 make hyper-v completely unnecessary?

@mazhar10
Copy link
Author

WSL V2 introduces the dependency on HyperV, WSL V1 did not require HyperV. More and more things from MS are requiring HyperV. So far I have come across Dockers for Windows and WSL V2. This makes it very difficult to use to VMs where embedded virtualization may not be allowed.

@keanerickson
Copy link

keanerickson commented Jun 23, 2020

Wow, I had no idea. It would be nice for the interface to convey in some way that the "deprecated" hyper-v system is required once more with WSL2. Anyway it seems like the "Hyper-V Host Compute Service" is the only hyper-v service that can't be disabled, I also have both "Windows Hypervisor Program" and "Hyper-V" unchecked in the add / remove windows features menu.

@NicolasDorier
Copy link

I can't explain this but:

wsl --set-version "Ubuntu" 2
There is no distribution with the supplied name.
wsl --set-version Ubuntu 2
Conversion in progress, this may take a few minutes...

@wanfuse123
Copy link

Dependence on hyper-v makes no sense. One can not use nvidia in the container if you install the hyper-v components. At least thats what I have found. Can anyone confirm. Some solutons require to do things that I am afraid will loose access to guests. I cant afford to loose my guests. Can anyone confirm if any of the other solutions will cause loss of access to guests? Thanks in advance!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

7 participants