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 is not starting #9075

Closed
1 of 2 tasks
gilbmporto opened this issue Oct 27, 2022 · 30 comments
Closed
1 of 2 tasks

WSL is not starting #9075

gilbmporto opened this issue Oct 27, 2022 · 30 comments

Comments

@gilbmporto
Copy link

gilbmporto commented Oct 27, 2022

Version

22621.755

WSL Version

  • WSL 2
  • WSL 1

Kernel Version

5.15.68.1

Distro Version

2004.2022.1.0

Other Software

No response

Repro Steps

Trying to open the WSL2 enviroment through windows terminal and through VS Code.

Expected Behavior

WSL2 should be initialized.

Actual Behavior

It's not being initialized through any means at all. Not through windows terminal, or VS Code, or Linux subsystem. I already tried everything, it simply doesn't initialize.
screenshot-01
screenshot-02
screenshot-03

Diagnostic Logs

No response

@OneBlue
Copy link
Collaborator

OneBlue commented Oct 27, 2022

/logs

@ghost
Copy link

ghost commented Oct 27, 2022

Hello! Could you please provide more logs to help us better diagnose your issue?

To collect WSL logs, download and execute collect-wsl-logs.ps1 in an administrative powershell prompt:

Invoke-WebRequest -UseBasicParsing "https://raw.githubusercontent.com/microsoft/WSL/master/diagnostics/collect-wsl-logs.ps1" -OutFile collect-wsl-logs.ps1
Set-ExecutionPolicy Bypass -Scope Process -Force
.\collect-wsl-logs.ps1

The scipt will output the path of the log file once done.

Once completed please upload the output files to this Github issue.

Click here for more info on logging

Thank you!

@gilbmporto
Copy link
Author

@ghost ghost removed the needs-author-feedback label Oct 27, 2022
@OneBlue
Copy link
Collaborator

OneBlue commented Oct 27, 2022

Thank you @gilbmporto.

I'm not seeing any wsl logs in the file you share. Does wsl start if you just run cmd.exe in a command prompt ?

@gilbmporto
Copy link
Author

It doesn't start anywhere at all. After a really long time, inside the windows terminal, this appeared:

The operation could not be started because a necessary resource was not installed.
Error code: Wsl/Service/CreateInstance/CreateVm/HCS_E_SERVICE_NOT_AVAILABLE

[process closed with the code 4294967295 (0xffffffff)]

@gilbmporto
Copy link
Author

I want to say, as well, that until yesterday, it was working normally. After the automatic windows update, which was made yesterday at night, this issue started.

@OneBlue
Copy link
Collaborator

OneBlue commented Oct 28, 2022

Interesting. I wonder if the virtual machine platform feature got in a bad state.

Can you try to disable the Virtual Machine Platform feature in optionalfeatures.exe, then reboot, then enable it again, reboot and see if that solves the issue ?

@gilbmporto
Copy link
Author

Yes, just did it right now and it still does not start. ):

@CuttlefishJones
Copy link

CuttlefishJones commented Oct 28, 2022

I have encountered exactly the same issue. After the latest update WSL will not start. But I have noticed that if I open WSL immediately after a fresh boot then it will be OK. If I leave it for a few minutes after a fresh boot then it become unresponsive.

@CuttlefishJones
Copy link

FYI this entry is appearing in the event log:

Failed to map guest I/O buffer for read access with status 0xC00000A1.

@gilbmporto
Copy link
Author

I have encountered exactly the same issue. After the latest update WSL will not start. But I have noticed that if I open WSL immediately after a fresh boot then it will be OK. If I leave it for a few minutes after a fresh boot then it become unresponsive.

I see. In my case, it doesn't start whatsoever. It just keeps loading, until it terminates itself a very long time then.

@OneBlue
Copy link
Collaborator

OneBlue commented Oct 28, 2022

Thank you @gilbmporto. I'd be curious to see logs right after startup.

Can you please try to:

  • reboot the machine
  • Start a new log collection before running any wsl command
  • Then run wsl.exe in a terminal and wait until you see the error you shared below
  • Stop the collection
  • Share the log file on this issue

/logs

@ghost
Copy link

ghost commented Oct 28, 2022

Hello! Could you please provide more logs to help us better diagnose your issue?

To collect WSL logs, download and execute collect-wsl-logs.ps1 in an administrative powershell prompt:

Invoke-WebRequest -UseBasicParsing "https://raw.githubusercontent.com/microsoft/WSL/master/diagnostics/collect-wsl-logs.ps1" -OutFile collect-wsl-logs.ps1
Set-ExecutionPolicy Bypass -Scope Process -Force
.\collect-wsl-logs.ps1

The scipt will output the path of the log file once done.

Once completed please upload the output files to this Github issue.

Click here for more info on logging

Thank you!

@gilbmporto
Copy link
Author

gilbmporto commented Oct 28, 2022

There it goes:
WslLogs-2022-10-28_16-25-56.zip
The one up above is just before opening the anything associated with the linux subsystem.

WslLogs-2022-10-28_16-30-47.zip
Now, this one above is just after this error down below appears at windows terminal (which is configured to open Ubuntu)

Captura de tela 2022-10-28 165833

PS: This language is brazilian portuguese, but I suppose that, what matters anyway is the error code.

@ghost ghost removed the needs-author-feedback label Oct 28, 2022
@AleksandrHovhannisyan
Copy link

AleksandrHovhannisyan commented Oct 29, 2022

I'm having the same issue. I restarted my computer but am still getting the error below (same error code as OP):

The virtual machine or container with the specified identifier is not running.
[process exited with code 4294967295 (0xffffffff)]

wsl -lv output:

  NAME            STATE           VERSION
* Ubuntu-18.04    Stopped         2
  • Windows version: 10.0.19044 Build 19044
  • WSL version: 2

Unfortunately the diagnostic script itself fails for me, so I can't run that.

get-acl : Cannot find path 'C:\ProgramData\Microsoft\Windows\WindowsApps' because it does not exist.
At C:\WINDOWS\system32\collect-wsl-logs.ps1:35 char:1
+ get-acl "C:\ProgramData\Microsoft\Windows\WindowsApps" | Format-List  ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : ObjectNotFound: (:) [Get-Acl], ItemNotFoundException
    + FullyQualifiedErrorId : GetAcl_PathNotFound_Exception,Microsoft.PowerShell.Commands.GetAclCommand

However, what did work for me is to just go into command prompt and run wsl. It was not working when I tried running Windows Terminal or the distro itself, but the CLI did work. With WSL running from command prompt, I was then able to launch Windows Terminal and access my distro.

@CuttlefishJones
Copy link

CuttlefishJones commented Oct 31, 2022

I have managed to get WSL to restart by force killing the WslService process:

sc queryex WslService

I grabbed the PID from the output of the above and then:

taskkill /PID "PID" /F

This force restarted the WSL service and I was able to regain access.

@gilbmporto
Copy link
Author

I have managed to get WSL to restart by force killing the WslService process:

sc queryex WslService

I grabbed the PID from the output of the above and then:

taskkill /PID "PID" /F

This force restarted the WSL service and I was able to regain access.

Tried this here... Didn't work. :(

@gilbmporto
Copy link
Author

I'm having the same issue. I restarted my computer but am still getting the error below (same error code as OP):

The virtual machine or container with the specified identifier is not running.
[process exited with code 4294967295 (0xffffffff)]

wsl -lv output:

  NAME            STATE           VERSION
* Ubuntu-18.04    Stopped         2
  • Windows version: 10.0.19044 Build 19044
  • WSL version: 2

Unfortunately the diagnostic script itself fails for me, so I can't run that.

get-acl : Cannot find path 'C:\ProgramData\Microsoft\Windows\WindowsApps' because it does not exist.
At C:\WINDOWS\system32\collect-wsl-logs.ps1:35 char:1
+ get-acl "C:\ProgramData\Microsoft\Windows\WindowsApps" | Format-List  ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : ObjectNotFound: (:) [Get-Acl], ItemNotFoundException
    + FullyQualifiedErrorId : GetAcl_PathNotFound_Exception,Microsoft.PowerShell.Commands.GetAclCommand

However, what did work for me is to just go into command prompt and run wsl. It was not working when I tried running Windows Terminal or the distro itself, but the CLI did work. With WSL running from command prompt, I was then able to launch Windows Terminal and access my distro.

I see. In my case, I tried that as well, but it didn't work here too.

@OneBlue
Copy link
Collaborator

OneBlue commented Nov 4, 2022

Thank you for the logs @gilbmporto.

Looking at the logs, this looks like a control flow guard related error.

Can you share the output of both (in an elevated powershell):

  • Get-ProcessMitigation -System
  • Get-ProcessMitigation | Where-Object { $_.ProcessName.contains("vmcompute") } l ?

@tomcon
Copy link

tomcon commented Nov 5, 2022

Same problem here, I have to always restart the machine after first turning it on in the morning
after first turning it on wsl just gives a blank screen
after restart always works
fairly recent situation so it appears some update has caused this

@mdbooth
Copy link

mdbooth commented Nov 11, 2022

I have also just started seeing this. I can no longer launch WSL. I use it daily and have not made any intentional change to it, so most likely related to an update.

All wsl commands seem to hang, not just attempting to start it. Running wsl.exe from powershell hangs. wsl --status hangs. wsl -lv hangs.

@OneBlue
Copy link
Collaborator

OneBlue commented Nov 11, 2022

After investing this issue we found a bug in vmcompute.exe that prevents the service from starting in Control Flow guard is disabled at the system level (you can see if that's the case by running (Get-ProcessMitigation -System).CFG.Enable in an elevated powershell.

If the output is OFF then you might be hitting this issue. Until the fix is serviced via Windows Update, you can work around the bug by re-enabling CFG via Set-ProcessMitigation -System -Enable CFG

@mdbooth
Copy link

mdbooth commented Nov 14, 2022

> (Get-ProcessMitigation -system).CFG


OverrideCFG            : False
OverrideStrictCFG      : False
Enable                 : NOTSET
SuppressExports        : NOTSET
StrictControlFlowGuard : NOTSET

Does NOTSET also trigger the issue?

Incidentally, after sacrificing a goat under the full moon and a few reboots I did get WSL to start on this machine 😅

@OneBlue
Copy link
Collaborator

OneBlue commented Nov 14, 2022

Interestingly, NOTSET shouldn't, but there was indeed an issue in vmcompute.exe that the logs were pointing to.

Closing since the issue is resolved.

@OneBlue OneBlue closed this as completed Nov 14, 2022
@rxgoa
Copy link

rxgoa commented Mar 2, 2024

After investing this issue we found a bug in vmcompute.exe that prevents the service from starting in Control Flow guard is disabled at the system level (you can see if that's the case by running (Get-ProcessMitigation -System).CFG.Enable in an elevated powershell.

If the output is OFF then you might be hitting this issue. Until the fix is serviced via Windows Update, you can work around the bug by re-enabling CFG via Set-ProcessMitigation -System -Enable CFG

There is NO WAY your response with only 1 like is the answer for something i've been losing my mind over the past 2 days hahah thank you very much!!

for anyone wondering the build i was getting this problem:

  • Windows 11 Pro
  • Version: 10.0.22631 Build 22631

@beber89
Copy link

beber89 commented May 9, 2024

After investing this issue we found a bug in vmcompute.exe that prevents the service from starting in Control Flow guard is disabled at the system level (you can see if that's the case by running (Get-ProcessMitigation -System).CFG.Enable in an elevated powershell.

If the output is OFF then you might be hitting this issue. Until the fix is serviced via Windows Update, you can work around the bug by re-enabling CFG via Set-ProcessMitigation -System -Enable CFG

I run wsl --export then I had to stop it by pressing ctrl + c because the vhdx size was about to explode my SSD. I ended up with the same problem. Made all the attempts we know and mentioned here. And in the end that fix got it working again for me.

@piyushyadav1617
Copy link

After investing this issue we found a bug in vmcompute.exe that prevents the service from starting in Control Flow guard is disabled at the system level (you can see if that's the case by running (Get-ProcessMitigation -System).CFG.Enable in an elevated powershell.

If the output is OFF then you might be hitting this issue. Until the fix is serviced via Windows Update, you can work around the bug by re-enabling CFG via Set-ProcessMitigation -System -Enable CFG

I am still not able to resolve the issue. I can access the wsl as a root user by wsl -u root but not as any other user, just getting the non responsive blank screen

@CosmicHazel
Copy link

After investing this issue we found a bug in vmcompute.exe that prevents the service from starting in Control Flow guard is disabled at the system level (you can see if that's the case by running (Get-ProcessMitigation -System).CFG.Enable in an elevated powershell.

If the output is OFF then you might be hitting this issue. Until the fix is serviced via Windows Update, you can work around the bug by re-enabling CFG via Set-ProcessMitigation -System -Enable CFG

This was the answer... Set-ProcessMitigation -System -Enable CFG

I'm pretty sure this bug regressed. Can we re-open this issue?

@Kuanch
Copy link

Kuanch commented Jun 6, 2024

I can't launch my WSL after a windows update I think, by typing wsl in cmd it just freezes forever, none of the solutions above work, and when it hangs, I need to restart the computer to make wsl commands work again(on working distro).

Fortunately the ext4.vhdx seems fine, and I can mount it on another working distro with wsl --mount --vhd D:\ubuntu20.04\ext4.vhdx, and the files are still there.

so I try something like wsl --import Ubuntu20.04new E:\Ubuntu20.04new D:\ubuntu20.04\ext4.vhdx --vhd to build a new distro with the legacy vhd, and the problem remains, it hangs forever, so for me this is still unsolved, it's pretty frustrating.

And I wonder if there is any command like wsl --verbose to see the full logs of starting vm? It might help me to dive in the problem

@dhruvmsheth
Copy link

finally fixed it. nothing in the comments above helped me. I navigated to the .wslconfig files placed in /Users/<username>/ and opened .wslconfig file with a text editor and removed a line which redirected the kernel to a non-existent directory. Make sure the config file only says [wsl2]

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

No branches or pull requests