microsoft / WSL

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

Error Wsl/0x80070422 starting WSL (Worked fine a week or two ago) #11273

Closed GrahamDo closed 7 months ago

GrahamDo commented 8 months ago

I tried to start Docker Desktop yesterday, and it gave me an error relating to WSL not being started properly. It suggested I run wsl --shutdown (I think that's the command) or restart my computer. It was working fine... maybe 2/3 weeks ago.

At that point, I didn't really understand Docker for Desktop's dependency on WSL. I've learnt a lot since then.

I launched PowerShell and tried to run a variety of different "wsl" commands, but each one of them comes back with "The service cannot be started, either because it is disabled or because it has no enabled devices associated with it. Error code: Wsl/0x80070422"

I've done a lot of Googling, and one of the first things I found was an article (I think it was actually an issue on this Github) talking about how the LxssManager service was stopped and set to Manual. That fit my scenario, so I started my service and set it to Automatic (I had to do this via an administrative command prompt, because the Services app wouldn't let me change the startup type: "Access Denied").

It didn't solve my problem, though.

While i was in Services, I noticed the "Windows Subsystem for Linux" service was stopped. I tried to start it, but it starts and then immediately stops. And I can't find any entries in the Event Log about it.

I found another article online about how to completely remove all Linux distros and all WSL packages from my machine. I did that, restarted, ran wsl --install, and it installed Ubuntu and asked for the reboot. But immediately after the reboot I got a console window saying "WslRegisterDistribution failed with error: 0x80070422" followed by the same error.

Again, this was working fine a couple of weeks ago, and I remember a recent batch of Windows updates, so perhaps that broke it?

(Unfortunately, I no longer have the restore point from before those updates were installed)

I'm running Windows 11 Home.

Can anyone make a suggestion as to what the problem might be?

github-actions[bot] commented 8 months ago

Hi I'm an AI powered bot that finds similar issues based off the issue title.

Please view the issues below to see if they solve your problem, and if the issue describes your problem please consider closing this one and thumbs upping the other issue to help us prioritize it. Thank you!

Open similar issues:

Closed similar issues:

Note: You can give me feedback by thumbs upping or thumbs downing this comment.

GrahamDo commented 8 months ago

Hi I'm an AI powered bot that finds similar issues based off the issue title.

Please view the issues below to see if they solve your problem, and if the issue describes your problem please consider closing this one and thumbs upping the other issue to help us prioritize it. Thank you!

Nope. None of them solve my problem. Although I have seen a couple of them already during my searching.

OneBlue commented 8 months ago

/logs

GrahamDo commented 8 months ago

Hi,

Thanks for that. I've attached the logs.

I ran the command, and when it asked me to reproduce the problem, and then press any key to save the logs, I ran two commands: wsl start, and also wsl --install

Both the start and the install command produced the error code 0x80070422, but the install command also produced a WslRegisterDistribution error as well, so hopefully that'll give you a bit more information.

WslLogs-2024-03-13_07-12-51.zip

Thanks!

fantinodavide commented 8 months ago

Hi @GrahamDo,

I had the exact same issue, tried many suggested solutions, including making sure windows is updated, set the automatic start of the LxssManager service, nothing of that helped me, but running wsl --update and then wsl --install -d ubuntu fixed it!

Let me know if this helps!

GrahamDo commented 8 months ago

@fantinodavide Thanks for the suggestion, but unfortunately no luck:

image

I do, however, see that my machine needs a reboot to finish installing updates. If this problem was in fact caused by a Windows Update, then perhaps that'll fix it.

Can't reboot right now, though. I'll do it this afternoon and see if it helps.

EDIT: Sorry, the screenshot doesn't show it, but I did the --update first. It said "The most recent version of Windows Subsystem for Linux is already installed."

OneBlue commented 8 months ago

Thank you @GrahamDo. based on the logs it looks like wslservice is disabled. Does the following command solve the issue (elevated command prompt):

 sc.exe config wslservice start= demand
fantinodavide commented 8 months ago

@fantinodavide Thanks for the suggestion, but unfortunately no luck:

image

I do, however, see that my machine needs a reboot to finish installing updates. If this problem was in fact caused by a Windows Update, then perhaps that'll fix it.

Can't reboot right now, though. I'll do it this afternoon and see if it helps.

EDIT: Sorry, the screenshot doesn't show it, but I did the --update first. It said "The most recent version of Windows Subsystem for Linux is already installed."

sadly, I also started to get the same error again. which seems to have been fixed with the command given by OneBlue

GrahamDo commented 8 months ago

Thank you @GrahamDo. based on the logs it looks like wslservice is disabled. Does the following command solve the issue (elevated command prompt):

 sc.exe config wslservice start= demand

Oh, damn! Who knew there was more than one service? I've been checking the Windows Subsystem For Linux service. I didn't know there was a second service. :-D

True enough, it was disabled. I ran your command, and was able to start wsl and ubuntu, and my Docker Desktop started working again!

That is, until I rebooted to install that update I mentioned earler, and immediately thereafter, the service was disabled again so I had to run the command again.

Why does Windows keep disabling that service? And is there any way I can tell it not to?

EDIT: It's not just on Windows Update. It's on any reboot. I just rebooted again, and that service was disabled again. :-(

OneBlue commented 7 months ago

EDIT: It's not just on Windows Update. It's on any reboot. I just rebooted again, and that service was disabled again. :-(

Hmm that's really weird. Do you have any antivirus software running ? I'm wondering if it could be doing that.

GrahamDo commented 7 months ago

I do: AVG. Maybe you're right. I'll do some searching and see if I can find anything specifically about AVG disabling the WSL Service on every boot (because that is still happening).

GrahamDo commented 7 months ago

OK, that settles it. It was AVG.

I set the service to Manual, then went into AVG and added "C:\Program Files\WSL\wslservice.exe" to the list of allowed apps, then rebooted, and it stayed Manual.

For anyone else reading this, if you have anti-virus or personal firewall software installed, you should do the same.

Caveats commented 5 months ago

As above - but also add Docker and WSL to exceptions list to Anti Virus Software - also restore Docker to Factory Default settings *(nuclear option to wipe both data and settings)

Freakazoid1305 commented 5 months ago

Thank you @GrahamDo. based on the logs it looks like wslservice is disabled. Does the following command solve the issue (elevated command prompt):

 sc.exe config wslservice start= demand

Had same issue like the OP, but no antivirus installed. Ur solution helped me run Docker again but after i reboot pc docker is broken again, same error occurs. From that point ur solution does not help me anymore. I have win11 home. What can it be? I also added wslservice.exe in windows security exclusions.

OfficiallyCrazy commented 4 months ago

Thank you @GrahamDo. based on the logs it looks like wslservice is disabled. Does the following command solve the issue (elevated command prompt):

 sc.exe config wslservice start= demand

Had same issue like the OP, but no antivirus installed. Ur solution helped me run Docker again but after i reboot pc docker is broken again, same error occurs. From that point ur solution does not help me anymore. I have win11 home. What can it be? I also added wslservice.exe in windows security exclusions.

Same here. WSL is being set to disabled automatically. From aditional reserach I did it seems like some program is running on port 53 and that is preventiong WSL to start

wandiro commented 2 months ago

Thank you @GrahamDo. based on the logs it looks like wslservice is disabled. Does the following command solve the issue (elevated command prompt):

 sc.exe config wslservice start= demand

thanks you save my live

Olney1 commented 2 months ago

AVG was installed in my issue too. The command sc.exe config wslservice start= demand worked for me running from PowerShell with elevated permissions.

Farzane2630 commented 1 month ago

I ran into the same error and tried out the entire solutions on the internet and the error still was there. But at the end of the day I came up with this command and it works!😉 wsl --install -d Debian --web-download

Apparently, there was some problems with my windows and for some reason I was not able to download this distribution from MS. I hope this works for you guys too.