microsoft / WSL

Issues found on WSL
https://docs.microsoft.com/windows/wsl
MIT License
17.27k stars 812 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

carlosbornes commented 4 years ago

Same here. I add this working. Today I've tried to open my Ubuntu terminal and I'm having the same problem.

spaceraccoon commented 4 years ago

Same here. Happened when I upgraded to WSL 2.

spaceraccoon commented 4 years ago

@CBornes @k3rst1n Did yall find any fixes for this?

k3rst1n commented 4 years ago

@spaceraccoon No unfortunately not - still not working

afallenhope commented 4 years ago

Not to bump but.... also having this issue. Windows 10.0.19041.264

jankowtf commented 4 years ago

Same here

NicoWde commented 4 years ago

I also have this issue on 2004 Build 20150.1000

donxp commented 4 years ago

Same issue here on Windows version 2004 build 19041.329

chancez commented 4 years ago

I was able to get this resolved by removing the WSL kernel update from programs/features, and then removing the WSL feature, rebooting, and then re-enabling the WSL feature and rebooting. I also deleted my WSL instances during this process.

NicoWde commented 4 years ago

I was able to get this resolved by removing the WSL kernel update from programs/features, and then removing the WSL feature, rebooting, and then re-enabling the WSL feature and rebooting. I also deleted my WSL instances during this process.

Hey @chancez, I tried this at 20150.1000 - it unfortunatly did not help.

simmessa commented 4 years ago

I was able to get this resolved by removing the WSL kernel update from programs/features, and then removing the WSL feature, rebooting, and then re-enabling the WSL feature and rebooting. I also deleted my WSL instances during this process.

Thank You for the info, I've tried this partially, by uninstalling that WSL kernel update because since a couple of reboots ago WSL2 is completely broken... I'm desperate to recover my WSL2 filesystem, hopefully somebody from the dev team can help us here :(

simmessa commented 4 years ago

I'm on build #19592 and my WSL2 only says this: image

I've tried de-registering Ubuntu but it's dead and won't launch... I'm really in need to recover the WSL2 filesystem if there's a way. oh, and btw to make it work again!

Thanks for your time / help.

alminisl commented 4 years ago

The only way I fixed this is by disabling WSL and re-enabling it again, I tried everything.

simmessa commented 4 years ago

The only way I fixed this is by disabling WSL and re-enabling it again, I tried everything.

WSL2 on insider previews has been so unreliable I've gone back to something I can control: an Ubuntu VM made in HyperV which is basically the same, and I'm already feeling the experience is much better.

I now feel confident that no windows update will wipe out my WSL2 distros, as a next step I'm opting out of insider previews, I'm probably done with WSL and evangelizing it, It's a good concept but the execution is so lacking... I don't feel it's really worth it.

Picoseconds commented 4 years ago

insider previews

unreliable

Well, it's not like you weren't warned about it. I don't believe this is a valid reason to hate on WSL2.

simmessa commented 4 years ago

Sure, i was aware of the insider "disclaimer" and that's just my personal opinion.

But I won't deny I'm sick of WSL2, too many things broke at the wrong time, I'm outta here. Enjoy the ride!

danvln commented 4 years ago

Bumping this since it is really an issue and blocked the usage of WSL 2

JosXa commented 3 years ago

Issue still appears in December.

nagarajcruze commented 3 years ago

have anyone found fix for this issue? i was using 2sl2 kali-linux peacefully but today i tried to overwrite the kali-linux.vhdx file, then this problem started for me and i did every fixes posted on other git issues, still i can't find any fix. anyone help me .

qiushiyan commented 3 years ago

the same issue. I tried reinstalling wsl and disabling virtual machine and then enabling it again, didn't work.

CollapsedMetal commented 3 years ago

Same problem here!

As people are suggesting on #5107, I also think that it is related to the absence of vEthernet (WSL) adapter. No matter how much I try reinstalling WSL stuff in different order, there is no way the nic adapter being installed again.

Iv'e also tried to "manually" install the adapter via Hyper-V with no luck.😥

benyaminl commented 3 years ago

Same problem here!

As people are suggesting on #5107, I also think that it is related to the absence of vEthernet (WSL) adapter. No matter how much I try reinstalling WSL stuff in different order, there is no way the nic adapter being installed again.

Iv'e also tried to "manually" install the adapter via Hyper-V with no luck.😥

I Agree, I also having this problem on 20H2, it's frustating Edit :

I fix it using in-place upgrade with latest windows 20H2 and it works. I take sometimes and no data/Apps deleted as like reset windows. It works for me anyway, I could install fedora on WSL now

WassimBenzarti commented 3 years ago

I encountered this issue today. I had Docker Desktop installed, I removed it but no luck starting with WSL Ubuntu :(

jyjwhbk commented 3 years ago

I encountered this issue today. I had Docker Desktop installed, I removed it but no luck starting with WSL Ubuntu :(

exactly same situation as u, and have no idea what to do

Forbzy commented 3 years ago

I wish I hadn't of updated. Everything was working fine util about a week ago. I hope we are getting close to a fix reliable permanent fix.

amchii commented 3 years ago

Same

Dzivo commented 3 years ago

Same here

robertoti commented 3 years ago

I also have this issue on 21H1 Build 19043.1081

mattkotys commented 3 years ago

Me too.

abdilahrf commented 3 years ago

same ;(

Haebuk commented 3 years ago

same..

amirwesthoff commented 3 years ago

same here, on 20H2 Build 19042.1165

merskip commented 3 years ago

I have the same issue. OS Version 10.0.19043 N/A Build 19043.

er-eis commented 3 years ago

Same issue here on Microsoft Windows [Version 10.0.22000.160]

dot1209 commented 2 years ago

I have the same issue on 21H1 Build 19043.1237. I tried wsl --set-default-version 1 and this works for me.

garethm79 commented 2 years 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!)

Zeratoxx commented 2 years ago

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.

I guess that fixed it for me! WSL 2 is working fine again.

averyfreeman commented 2 years ago

I was switching to WPM/WinGet from Chocolatey because I have a bunch of software installed through choco that didn't install shortcuts, thinking winget would be more reliable - then this happened 😂

bmasterc commented 2 years ago

Kaspersky Antivirus disabled WSL from starting when I unknowingly told it to fix running Linux apps from Windows. To enable, lookup how to set LxssManager startup to manual via registry (Access Denied on the GUI)

peterburgs commented 2 years ago

The only way I fixed this is by disabling WSL and re-enabling it again, I tried everything.

I double tried, triple tried but seems like your solution did not work

hguitar commented 2 years ago

for anyone still looking for solution here, try to delete the .wslconfig under your C:\Users\<your username>\.

gibait commented 2 years ago

for anyone still looking for solution here, try to delete the .wslconfig under your C:\Users.

I uninstalled Docker Desktop. Removed Ubuntu install. Disabled and re-enabled WSL. This is what made it work eventually! Thank you

jerrychong25 commented 2 years ago

for anyone still looking for solution here, try to delete the .wslconfig under your C:\Users\<your username>\.

Thanks @hguitar !

This method works for my end!

Durbek-Gafur commented 2 years 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

copapp commented 2 years ago

help, couldnt solve by solution above, I have tried

I thought it was because wuauserv was stopped, but wsl --install was run with wuauserv running. I dont know what else I could try

Edit: problem was solved, vEthernet (WSL) adapter was failed to installed, since vmware blocking hyper-v to install the adapter, I uninstalled it. Problem solved

EricGT commented 2 years ago

Could not find root cause of problem.

What achieved a successful install for me was to forgo using winget and just install from Microsoft Store.

Just to see if that cleared the root cause, used wsl --unregister, rebooted, then tried

winget install -e --id Canonical.Ubuntu

which resulted in

Installer failed with exit code: 0x80070002 : The system cannot find the file specified.

So maybe this is a winget issue and not a WSL issue.


A speculation of mine as to what I did that is the root cause is that I renamed a distribution by editing a distribution name as per https://superuser.com/a/1613251/125532

If you want to rename your WSL distro, you have to:

Stop all instances of WSL
Open Registry Editor and go to HKEY_CURRENT_USER\SOFTWARE\Microsoft\Windows\CurrentVersion\Lxss
Find the distro you want to rename, look for the DistributionName
Change it as you want
Start WSL again, you can also execute wsl.exe -l -v to check if it changes

As per https://github.com/microsoft/winget-cli/issues/1705 using Windows Event Viewer in branch

Applications and Services Logs/Microsoft/Windows/AppXDeployment-Server/Microsoft-Windows-AppXDeploymentServer/Operational

for tab: Details find error: 0x80073cf1

For more on the error code see: Troubleshooting packaging, deployment, and query of Windows apps

Error code: ERROR_INSTALL_PACKAGE_NOT_FOUND Value: 0x80073CF1 Description and possible causes: The package couldn't be found. You may get this error while removing a package that isn't installed for the current user.

Stormholt commented 2 years ago

Same problem here!

As people are suggesting on #5107, I also think that it is related to the absence of vEthernet (WSL) adapter. No matter how much I try reinstalling WSL stuff in different order, there is no way the nic adapter being installed again.

Iv'e also tried to "manually" install the adapter via Hyper-V with no luck.😥

My solution based on CollapsedMetals idea that the problem can be related to missing the vEthernet (WSL) adapter. Was to try and fix its as a missing network adapter. When i made it to windows network reset, what ended up happening was that all my network adapters got corrupted and returned code 56 forever. This error led me to this, which made me update to the latest windows from a USB drive. After the update my internet adapters worked fine, vEthernet (WSL) adapter had returned, and WSL2 worked fine after installing the latest kernel update.

himansh-u commented 1 year ago

wsl --set-default-version 1 seems to work on build 2004

Faniche commented 1 year ago

I got same problem. And I remembered that I uninstalled the VMware Workstation Player before the problem occur. So I tried to reinstall the VMware Workstation Player and it was solved. You could try to install VMware Workstation Player if it helps.

handmade-medium commented 1 year ago

for anyone still looking for solution here, try to delete the .wslconfig under your C:\Users\<your username>\.

This worked for me right away, no reboots or uninstall/reinstall required, thank you!