WSL icon indicating copy to clipboard operation
WSL copied to clipboard

Can't run WSL2 and it returns Error code: Wsl/Service/CreateInstance/CreateVm/HCS_E_CONNECTION_TIMEOUT

Open Eleron8 opened this issue 1 year ago • 39 comments
trafficstars

Windows Version

Microsoft Windows [Version 10.0.22631.4249]

WSL Version

2.2.4.0

Are you using WSL 1 or WSL 2?

  • [X] WSL 2
  • [ ] WSL 1

Kernel Version

5.15.153.1-2

Distro Version

Can't run any commands within WSL due to connection timeout error. But I have only one distro and it's ubuntu. I'm pretty sure it's 20.04 or 22.04 version

Other Software

No response

Repro Steps

I just got some update for Windows 11 and after that my WSL2 stopped working. I turned on Windows features like Hyper-V, Containers and Windows Subsystem for Linux to try to fix that issue, but it didn't help anyway. Still getting Error code: Wsl/Service/CreateInstance/CreateVm/HCS_E_CONNECTION_TIMEOUT each time

Expected Behavior

I want to be able to run WSL2 without getting timeout error.

Actual Behavior

I run wsl.exe command or run Ubuntu terminal from Windows apps, I'm getting the same result

wsl.exe

The operation timed out because a response was not received from the virtual machine or container.
Error code: Wsl/Service/CreateInstance/CreateVm/HCS_E_CONNECTION_TIMEOUT

Diagnostic Logs

I executed collect-wsl-logs.ps1 script to collect logs. I hope it will be helpful. WslLogs-2024-09-28_10-18-26.zip

Eleron8 avatar Sep 28 '24 09:09 Eleron8

View similar issues

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!

Closed similar issues:

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

Diagnostic information
Detected appx version: 2.2.4.0
Detected user visible error: Wsl/Service/CreateInstance/CreateVm/HCS_E_CONNECTION_TIMEOUT

github-actions[bot] avatar Sep 28 '24 09:09 github-actions[bot]

I am hiving the same issue, also in my case it started after the latest windows 11 update.

gilberto-BE avatar Sep 28 '24 13:09 gilberto-BE

I am hiving the same issue, also in my case it started after the latest windows 11 update.

if you find any solution, let me know. Tried many things but couldn't get any result.

Eleron8 avatar Sep 28 '24 13:09 Eleron8

if you find any solution, let me know. Tried many things but couldn't get any result.

I uninstalled windows update and WSL started to work... but Start button causes critical error now.

pakalnis avatar Sep 28 '24 20:09 pakalnis

Same here, uninstalling the update KB5043145 fixed the issue for me. See also here.

pjacekm avatar Sep 29 '24 01:09 pjacekm

Same issue the WSL2 is broken after some updates, uninstalling the KB5043145 update helps, thanks @pjacekm

mkotyushev avatar Sep 29 '24 10:09 mkotyushev

How did you manage to uninstall the KB5043145, I am so frustrated right now. image I already ran some checks for corrupted file but there was none sfc /scannow DISM /Online /Cleanup-Image /RestoreHealth

daryllmoya avatar Sep 29 '24 10:09 daryllmoya

Screenshot (1) facing the same issue

Rajneesh2008 avatar Sep 29 '24 10:09 Rajneesh2008

How did you manage to uninstall the KB5043145, I am so frustrated right now.

https://support.microsoft.com/en-us/windows/how-to-uninstall-a-windows-update-c77b8f9b-e4dc-4e9f-a803-fdec12e59fb0

pakalnis avatar Sep 29 '24 12:09 pakalnis

How did you manage to uninstall the KB5043145, I am so frustrated right now.

https://support.microsoft.com/en-us/windows/how-to-uninstall-a-windows-update-c77b8f9b-e4dc-4e9f-a803-fdec12e59fb0

I wouldn't be using the terminal for uninstalling it if I haven't tried that already. It will show uninstalled, but after restart, it will still show as installed.

daryllmoya avatar Sep 29 '24 12:09 daryllmoya

Same here, uninstalling the update KB5043145 fixed the issue for me. See also here.

This work ! Thanks

aerkwannasak avatar Sep 29 '24 16:09 aerkwannasak

Same happening here. Rolling back the update seems to have fixed the issue.

MatCast avatar Sep 30 '24 07:09 MatCast

Same here. Almost gave up on it until found this thread. What's going on?

bssrdf avatar Sep 30 '24 17:09 bssrdf

Sharing the instructions I posted #12087. If you hit this issue, please:

  • Reproduce the issue by calling into wsl.exe and waiting about 5 seconds
  • While WSL is booting, open task manager, select "System", right click -> "Create live kernel memory dump file" -> "Change - -
  • memory dump settings" -> select "Capture Hypervisor pages", "include nonessential pages", "Capture user pages"
  • Then go back to "System" -> right click, "Create live kernel memory dump file" -> "full live kernel memory dump"
  • Share that file with us (either via Google Drive, OneDrive, or send to [email protected]

For this to work, the dump must be captured while WSL is in that "hung" state (once the error is displayed, you need to start wsl.exe again)

OneBlue avatar Oct 01 '24 21:10 OneBlue

@OneBlue I was able to reproduce the issue -- I just sent an email

jackheuberger avatar Oct 02 '24 06:10 jackheuberger

Thank you so much @jackheuberger: It hasn't been forwarded to us yet. Would you mind telling the recipient to forward it to the WSL team ?

OneBlue avatar Oct 02 '24 16:10 OneBlue

@OneBlue Will do. I'm also msft internal and can send it to you directly. Feel free to ping me on Teams

jackheuberger avatar Oct 02 '24 18:10 jackheuberger

This was fixed for me by enabling Windows Hypervisor Platform and Windows Machine Platform. It was unchecked after this update was installed. Once I checked it and rebooted I was able to launch my WSL instance.

Go to settings > (search) turn windows feature on / off. Scroll down to "Windows Hypervisor Platform and Windows Machine Platform.

bouncingsoles avatar Apr 21 '25 13:04 bouncingsoles

This was fixed for me by enabling Windows Hypervisor Platform and Windows Machine Platform. It was unchecked after this update was installed. Once I checked it and rebooted I was able to launch my WSL instance.

Go to settings > (search) turn windows feature on / off. Scroll down to "Windows Hypervisor Platform and Windows Machine Platform.

This saves me! Thank you

spking11 avatar Apr 26 '25 16:04 spking11

It's May 2025 and a new Windows 11 update has (After breaking my computer in other frustrating ways for the morning) left WSL with connection timeout, or unexpected. I had to turn on the Hypervisor platform again, but that has still not yet helped.

dannystaple avatar May 21 '25 08:05 dannystaple

I finally found the problem, WSL started, after many attempts to start with diagnostics tools/ Dmesg revealed that the journal was damaged and trying to recover. Almost like this botched update shut down WSL in a forced way. Not cool.

dannystaple avatar May 21 '25 09:05 dannystaple

I'm currently trying to recover my WSL instance after it suddenly stopped working, and it so far seems like the .vhxd has been corrupted on top of it all. Fortunately I have a backup, but this was really not the way I had expected to spend my day off.

OddKMS avatar May 29 '25 09:05 OddKMS

I found that the init was corrupted. Some interplay between a windows update, and a docker desktop update I allowed through - docker desktop has a resource saving mode, which seemed to cause wsl to die every time. I also spent most of a day fixing it, and restoring to a fresh distribution. This has definitely shaken my trust in it's reliability - things are not 100% right.

dannystaple avatar May 29 '25 09:05 dannystaple

@dannystaple @OddKMS Hey I think I'm in a similar boat. Can you guys please share which updates you have installed and which commands you ran to debug this? e.g. how can you tell the init is corrupted?

erikologic avatar May 29 '25 10:05 erikologic

I found that the main thing I had to do was:

  • Export the distribution
  • Remove it
  • Create a new distribution, and then use tar to extract the home folders from the exported one. If you use docker desktop, go to settings->resources and disbale resource saver - as that definitely seems to kill wsl regularly (more than just it's own distro).

In terms of debugging, use the wsl config (either file or ui), to enable the Debug console (under developer in the UI), which shows the startup messages and failures in it. Although if the filesystem has been corrupted, expect the output to be quite choppy before it dies.

dannystaple avatar May 29 '25 10:05 dannystaple

This was fixed for me by enabling Windows Hypervisor Platform and Windows Machine Platform. It was unchecked after this update was installed. Once I checked it and rebooted I was able to launch my WSL instance.

Go to settings > (search) turn windows feature on / off. Scroll down to "Windows Hypervisor Platform and Windows Machine Platform.

Thank you, thank you, thank you @bouncingsoles! I had been pulling my hair out for over a day trying to figure out why my WSL system suddenly started acting wonky. After doing the above (AND, just to be safe, disabling the Docker Desktop "Resource Saver" option), my WSL system has been behaving normally.

bn-afournier avatar May 29 '25 21:05 bn-afournier

same @bn-afournier Thanks @bouncingsoles !

erikologic avatar May 30 '25 07:05 erikologic

I'm glad you got it sorted @erikologic, sorry for not replying sooner

For me I had to downgrade to WSL Version 2.4.13 and re-import from backup to get my system up and running again so I don't think we had the same issue? It's hard to say.

OddKMS avatar May 30 '25 10:05 OddKMS

I have started having the same issue. Yesterday my machine died (blue screen of death) and since then I get this timeout. I noticed, as @bouncingsoles did, that Windows Hypervisor Platform was disabled, re-enabled it and WSL worked once. Now its failing again with the same error. My wsl --version output is:

WSL version: 2.5.7.0
Kernel version: 6.6.87.1-1
WSLg version: 1.0.66
MSRDC version: 1.2.6074
Direct3D version: 1.611.1-81528511
DXCore version: 10.0.26100.1-240331-1435.ge-release
Windows version: 10.0.26100.4061

Then, preparing to re-installed, I did an wsl --export and somehow it started working again. I really cannot explain it - unless there was some filesystem corruption that the export cleaned up.

pvanheus avatar Jun 02 '25 13:06 pvanheus

Hi, if you hit the issue please collect /logs so we can look at them and investigate. Thank you !

OneBlue avatar Jun 02 '25 19:06 OneBlue