microsoft / WSL

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

Error code: Wsl/Service/CreateInstance/CreateVm/ConfigureNetworking/HNS/0x80041002 #12022

Open convergerutley opened 2 months ago

convergerutley commented 2 months ago

Windows Version

Microsoft Windows [Version 10.0.22631.4169]

WSL Version

2.2.4.0

Are you using WSL 1 or WSL 2?

Kernel Version

5.15.153.1-2

Distro Version

Kali

Other Software

No response

Repro Steps

Running wsl, kali, or docker engine

Expected Behavior

WSL distro to start

Actual Behavior

Failed to configure network (networkingMode Nat). To disable networking, set wsl2.networkingMode=None in C:\Users\USER.wslconfig Error code: Wsl/Service/CreateInstance/CreateVm/ConfigureNetworking/HNS/0x80041002 Press any key to continue...

Diagnostic Logs

I have sent my logs to wsl-gh-logs@microsoft.com with the subject line "WslLogs-2024-09-11_12-29-53 GitHub Issue"

github-actions[bot] commented 2 months ago

Logs are required for review from WSL team

If this a feature request, please reply with '/feature'. If this is a question, reply with '/question'. Otherwise please attach logs by following the instructions below, your issue will not be reviewed unless they are added. These logs will help us understand what is going on in your machine.

How to collect WSL logs Download and execute [collect-wsl-logs.ps1](https://github.com/Microsoft/WSL/blob/master/diagnostics/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 script will output the path of the log file once done. If this is a networking issue, please use [collect-networking-logs.ps1](https://github.com/Microsoft/WSL/blob/master/diagnostics/collect-networking-logs.ps1), following the instructions [here](https://github.com/microsoft/WSL/blob/master/CONTRIBUTING.md#collect-wsl-logs-for-networking-issues) Once completed please upload the output files to this Github issue. [Click here for more info on logging](https://github.com/microsoft/WSL/blob/master/CONTRIBUTING.md#8-collect-wsl-logs-recommended-method) If you choose to email these logs instead of attaching to the bug, please send them to wsl-gh-logs@microsoft.com with the number of the github issue in the subject, and in the message a link to your comment in the github issue and reply with '/emailed-logs'.

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!

Open similar issues:

Closed similar issues:

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

convergerutley commented 2 months ago

I have emailed the files.

CatalinFetoiu commented 2 months ago

thanks for reporting the issue. can you please collecting networking logs using instructions below?

download https://github.com/microsoft/WSL/blob/master/diagnostics/collect-networking-logs.ps1 run .\collect-networking-logs.ps1 -RestartWslReproMode $True start WSL stop collect-networking-logs.ps1 share the zip generated by the script

Raven-Singularity commented 2 months ago

Did you by any chance install VMware Workstation?

That broke my WSL networking, even after uninstalling VMware. It left behind a registry key which prevented virtual network adapters from being created.

This is the registry key:

HKEY_LOCAL_MACHINE\SOFTWARE\Classes\CLSID\{3d09c1ca-2bcc-40b7-b9bb-3f3ec143a87b}

After removing this registry key, then clicking Network Reset on the Networking Control Panel page, my system came back up with WSL2 able to start a virtual network again.

Maybe try a Network Reset, and if that doesn't work, check if you have that registry key and remove it, then reboot.

To be clear: the issue is that there is that WSL is unable to create a Hyper-V virtual networking adapter for WSL to connect to the Internet with.

If you don't actually need the Internet, you can disable WSL networking by adding this to C:\Users\YourUserName.wslconfig:

[wsl2]
wsl2.networkingMode=None
MatthewSteeples commented 2 months ago

I was having the same error. Have never had VMWare installed and don't have the registry key mentioned above. I had to tweak the WSL config to say the following (not quite what's written above). Obviously that leaves me without network but that's fine for my use case. I also have the 2024-09 preview installed.

[wsl2]
networkingMode=None
psynyde commented 1 month ago

As a note from a Nix Wsl user. if anyone facing the same issue and want internet to work with it: