microsoft / WSL

Issues found on WSL
https://docs.microsoft.com/windows/wsl
MIT License
17.56k stars 823 forks source link

Installing any distro fails with "WslRegisterDistribution failed with error: 0x80070002 Error: 0x80070002 The system cannot find the file specified." #4959

Open k3rst1n opened 4 years ago

k3rst1n commented 4 years ago

Hi,

After installing Windows 10 on my desktop, I installed the Debian distribution. Right after installation, it loaded and worked fine, however after closing the shell and re-opening it, it got stuck while loading and my CPU usage increased to 100% - in the services I could see around 8 processed called "init" that were running and using up all cpu resources. I wasn't able to kill the processes, only a reboot helped. As the processes came back every time I opened the Debian shell, I eventually deinstalled the disto. Now, when I try to install any distro, I always end up with the same error:

Installing, this may take a few minutes...
WslRegisterDistribution failed with error: 0x80070002
Error: 0x80070002 The system cannot find the file specified.

Press any key to continue...

I tried all possible combinations of deinstalling, reboot, etc. wsllist never shows any of the Distros, even if they show up in the installed programs.

wsl --list --all
Windows Subsystem for Linux has no installed distributions.
Distributions can be installed by visiting the Microsoft Store:
https://aka.ms/wslstore

Attached you can find my logs - I was collecting them while I tried to install the Ubuntu distribution.

logs.zip

Windows version: Win 10 Pro, Version 1909 Build 18363.657.

Please let me know if you require anything else!

Thank you, Kerstin

sumitNITS commented 1 year ago

Error: 0x80070002 The system cannot find the file specified error

Here's how I fixed it today! Thanks, everyone for this wonderful discussion above, it did help me to fix it!

  1. Install the free version of CCleaner and use it to fix the issues present in your system. I've used v6.09 at the time of doing CCleaner

  2. Check whether Windows feature windows subsystem for Linux is on. If not then turn it ON and restart your machine Windows feature

  3. From the windows store get your desired Ubuntu version and run it. Set your username and password. That's all. Now it will work. solved

Erokos commented 1 year ago

I just managed to fix this, but am unsure of the exact underlying issue, or what caused it (the original issue was Docker Desktop failing to start with various random errors).

Firstly I noticed the comment above about a possible link to network adapters. I noticed I had a "VMWare Bridge Protocol" attached to my ethernet adapter, probably left over from an old VMWare Player install, but I was unable to remove/uninstall it (0x8007007E error).

I then did a Network Reset in Windows, which broke all my networking, the adapters had the error "Windows is still setting up the class configuration for this device, Code 56" which is relatively obscure, and again apparently related to an incompatible underlying driver. This error seems to be impossible to solve by a user (ie. through the normal Windows UI) except by a system restore or something. I was only able to fix it by running the CCleaner software (free version), and accepting all it's recommendations in the registry clean section.

After a reboot all the networking worked fine again, and I was able to install WSL2 and then reinstall Docker Desktop (which is what started me on the trail of fixing it all!)

Thank you, from all the proposed solutions only this one worked for me! You're a life saver!

nasNasa commented 1 year ago

I just managed to fix this, but am unsure of the exact underlying issue, or what caused it (the original issue was Docker Desktop failing to start with various random errors).

Firstly I noticed the comment above about a possible link to network adapters. I noticed I had a "VMWare Bridge Protocol" attached to my ethernet adapter, probably left over from an old VMWare Player install, but I was unable to remove/uninstall it (0x8007007E error).

I then did a Network Reset in Windows, which broke all my networking, the adapters had the error "Windows is still setting up the class configuration for this device, Code 56" which is relatively obscure, and again apparently related to an incompatible underlying driver. This error seems to be impossible to solve by a user (ie. through the normal Windows UI) except by a system restore or something. I was only able to fix it by running the CCleaner software (free version), and accepting all it's recommendations in the registry clean section.

After a reboot all the networking worked fine again, and I was able to install WSL2 and then reinstall Docker Desktop (which is what started me on the trail of fixing it all!)

i wanna just say thanks for your sharing. it help me to solve my mind blowing problem.

Francis-Ferri-personal commented 1 year ago

I just managed to fix this, but am unsure of the exact underlying issue, or what caused it (the original issue was Docker Desktop failing to start with various random errors).

Firstly I noticed the comment above about a possible link to network adapters. I noticed I had a "VMWare Bridge Protocol" attached to my ethernet adapter, probably left over from an old VMWare Player install, but I was unable to remove/uninstall it (0x8007007E error).

I then did a Network Reset in Windows, which broke all my networking, the adapters had the error "Windows is still setting up the class configuration for this device, Code 56" which is relatively obscure, and again apparently related to an incompatible underlying driver. This error seems to be impossible to solve by a user (ie. through the normal Windows UI) except by a system restore or something. I was only able to fix it by running the CCleaner software (free version), and accepting all it's recommendations in the registry clean section.

After a reboot all the networking worked fine again, and I was able to install WSL2 and then reinstall Docker Desktop (which is what started me on the trail of fixing it all!)

I just had to use CCleaner to remove the registry

yuuki798 commented 1 year ago

注册表问题,用CCcleaner解决。

Leonezz commented 11 months ago

Same issue suddenly occurs, and none of the above solutions work for me.

ecotner commented 10 months ago

wsl --set-default-version 1 seemed to "work" temporarily for me, but ended up creating a new distribution with none of my existing files. So I eventually had to wipe WSL (not just the distro, like all of WSL) and reinstall it. Make sure to back up your filesystem before deleting/uninstalling anything by backing up C://Users/<your user>/AppData/Local/Packages/<your distro>/LocalState/ext4.vhdx, then copying the backup to the original location once you're reinstalled everything. In my case (using the Ubuntu-20.04 distro) the <your distro> folder was called CanonicalGroupLimited.Ubuntu20.04LTS_79rhkp1fndgsc.

rz1027 commented 10 months ago

I just managed to fix this, but am unsure of the exact underlying issue, or what caused it (the original issue was Docker Desktop failing to start with various random errors).

Firstly I noticed the comment above about a possible link to network adapters. I noticed I had a "VMWare Bridge Protocol" attached to my ethernet adapter, probably left over from an old VMWare Player install, but I was unable to remove/uninstall it (0x8007007E error).

I then did a Network Reset in Windows, which broke all my networking, the adapters had the error "Windows is still setting up the class configuration for this device, Code 56" which is relatively obscure, and again apparently related to an incompatible underlying driver. This error seems to be impossible to solve by a user (ie. through the normal Windows UI) except by a system restore or something. I was only able to fix it by running the CCleaner software (free version), and accepting all it's recommendations in the registry clean section.

After a reboot all the networking worked fine again, and I was able to install WSL2 and then reinstall Docker Desktop (which is what started me on the trail of fixing it all!)

Ok I have to confess, I thought I caused this problem for myself by blindly deleting huge vhdx's and uninstalling docker desktop. But just before this problem I coincidentally installed VMware Workstation. It seems interestingly unrelated but solved my problem like charm, despite trying tons of other solution. Cheers bro, you're a magician

bnbncch commented 9 months ago

I just managed to fix this, but am unsure of the exact underlying issue, or what caused it (the original issue was Docker Desktop failing to start with various random errors). Firstly I noticed the comment above about a possible link to network adapters. I noticed I had a "VMWare Bridge Protocol" attached to my ethernet adapter, probably left over from an old VMWare Player install, but I was unable to remove/uninstall it (0x8007007E error). I then did a Network Reset in Windows, which broke all my networking, the adapters had the error "Windows is still setting up the class configuration for this device, Code 56" which is relatively obscure, and again apparently related to an incompatible underlying driver. This error seems to be impossible to solve by a user (ie. through the normal Windows UI) except by a system restore or something. I was only able to fix it by running the CCleaner software (free version), and accepting all it's recommendations in the registry clean section. After a reboot all the networking worked fine again, and I was able to install WSL2 and then reinstall Docker Desktop (which is what started me on the trail of fixing it all!)

Using CCleaner and cleaning registry helped me. Thanks

It really works! I tried to solve this problem all day and you really saved me.

Definelymes commented 9 months ago

I tired many things over past 24 hours, and the only thing that worked for me was removing the whole wsl and then re-installing it.

hiedt commented 8 months ago

I just managed to fix this, but am unsure of the exact underlying issue, or what caused it (the original issue was Docker Desktop failing to start with various random errors).

Firstly I noticed the comment above about a possible link to network adapters. I noticed I had a "VMWare Bridge Protocol" attached to my ethernet adapter, probably left over from an old VMWare Player install, but I was unable to remove/uninstall it (0x8007007E error).

I then did a Network Reset in Windows, which broke all my networking, the adapters had the error "Windows is still setting up the class configuration for this device, Code 56" which is relatively obscure, and again apparently related to an incompatible underlying driver. This error seems to be impossible to solve by a user (ie. through the normal Windows UI) except by a system restore or something. I was only able to fix it by running the CCleaner software (free version), and accepting all it's recommendations in the registry clean section.

After a reboot all the networking worked fine again, and I was able to install WSL2 and then reinstall Docker Desktop (which is what started me on the trail of fixing it all!)

After years of development, this WSL2 issue still hit my computer today. I tried all solutions proposed here and installing CCleaner was the only way. Thank you very much.

Cameron-Nguyen1 commented 3 months ago

I just managed to fix this, but am unsure of the exact underlying issue, or what caused it (the original issue was Docker Desktop failing to start with various random errors). Firstly I noticed the comment above about a possible link to network adapters. I noticed I had a "VMWare Bridge Protocol" attached to my ethernet adapter, probably left over from an old VMWare Player install, but I was unable to remove/uninstall it (0x8007007E error). I then did a Network Reset in Windows, which broke all my networking, the adapters had the error "Windows is still setting up the class configuration for this device, Code 56" which is relatively obscure, and again apparently related to an incompatible underlying driver. This error seems to be impossible to solve by a user (ie. through the normal Windows UI) except by a system restore or something. I was only able to fix it by running the CCleaner software (free version), and accepting all it's recommendations in the registry clean section. After a reboot all the networking worked fine again, and I was able to install WSL2 and then reinstall Docker Desktop (which is what started me on the trail of fixing it all!)

After years of development, this WSL2 issue still hit my computer today. I tried all solutions proposed here and installing CCleaner was the only way. Thank you very much.

CCleaner -> Tools -> Registry -> Scan -> Apply Fix (Works for Windows 10 home edition ubuntu 22.04 in August, 2024)

Thanks for sharing, hieudtrung.

msuzuki55 commented 1 month ago

I occurred 0x80070002 because C:\Program Files\WSL\system.vhd was not found. I restored system.vhd using the steps below and the problem was resolved. https://github.com/microsoft/WSL/issues/11069#issuecomment-2055653578

Trimatix commented 1 month ago

My company had deployed the latest version of the Microsoft Defender for Endpoint plugin for WSL via Intune. This failed to install on multiple PCs, causing this error when launching WSL:

Installing, this may take a few minutes... WslRegisterDistribution failed with error: 0x80070002 Error: 0x80070002 The system cannot find the file specified.

Or one of these errors when launching docker desktop:

checking if isocache exists: CreateFile \wsl$\docker-desktop-data\isocache\: The filename, directory name, or volume label syntax is incorrect.

Or:

checking if isocache exists: CreateFile \wsl$\docker-desktop-data\isocache\: The network name cannot be found.

I resolved the issue on computer by repairing the plugin installation from control panel, as described in the documentation: https://learn.microsoft.com/en-us/defender-endpoint/mde-plugin-wsl#installation-steps:~:text=If%20you%20see%20an%20error%20on%20launching%20WSL%2C%20such%20as%20%22A%20fatal%20error%20was%20returned%20by%20plugin%20%27DefenderforEndpointPlug%2Din%27%20Error%20code%3A%20Wsl/Service/CreateInstance/CreateVm/Plugin/ERROR_FILE_NOT_FOUND%22%2C%20it%20means%20the%20Defender%20for%20Endpoint%20plug%2Din%20for%20WSL%20installation%20is%20faulty.%20To%20repair%20it%2C%20follow%20these%20steps%3A