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

Error code: Wsl/Service/CreateInstance/CreateVm/ConfigureNetworking/HNS/ERROR_UNHANDLED_EXCEPTION #11389

Closed
1 of 2 tasks
alohith opened this issue Mar 27, 2024 · 26 comments
Closed
1 of 2 tasks
Labels

Comments

@alohith
Copy link

alohith commented Mar 27, 2024

Windows Version

Microsoft Windows [Version 10.0.19045.4170]

WSL Version

2.1.5.0

Are you using WSL 1 or WSL 2?

  • WSL 2
  • WSL 1

Kernel Version

5.15.146.1-2

Distro Version

Ubuntu (22.04)

Other Software

No response

Repro Steps

I was trying to setup LAN Network Bridge in 'Network and Sharing Center' again after hardware change forced windows 10 reset, then suddenly lost networking ability in WSL. I've tried suggested fixes from the following issue#: #10709 #10495 #10755 #10764, none of which have worked besides creating a .wslconfig file, and setting networkingMode=none

[experimental]
autoMemoryReclaim=gradual  # gradual | dropcache | disabled
networkingMode=none       # mirrored | NAT | None 
#dnsTunneling=false
#firewall=false
#autoProxy=true
#[wsl2]  # omit that if you already have it. 
#networkingMode=bridged
#vmSwitch=wsl_switch

Expected Behavior

image

Actual Behavior

image

Diagnostic Logs

No response

Copy link

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 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
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.

@alohith
Copy link
Author

alohith commented Mar 27, 2024

Log is 35MB, exceeding Github's 25MB limit

@alohith
Copy link
Author

alohith commented Mar 27, 2024

Log is 35MB, exceeding Github's 25MB limit

@OneBlue
Copy link
Collaborator

OneBlue commented Mar 27, 2024

@alohith: If the log file is too big for github, you can use google drive or onedrive.

@alohith
Copy link
Author

alohith commented Mar 27, 2024

@alohith: If the log file is too big for github, you can use google drive or onedrive.

here you go: https://drive.google.com/file/d/1YoBleuiy5Z--mBYkcbMlTTHwg2GZuv-1/view?usp=drive_link

@OneBlue
Copy link
Collaborator

OneBlue commented Mar 27, 2024

This indeed looks like something is crashing when trying to create the WSL network. @keith-horton: How could we root cause this ?

@keith-horton
Copy link
Member

@OneBlue , sorry, I don't know hvsocket architecture very well. maybe we should talk internally with the owning teams.

@OneBlue
Copy link
Collaborator

OneBlue commented Mar 27, 2024

@keith-horton: We're seeing the failure come from here:

Microsoft.Windows.Lxss.Manager	Error	03-27-2024 12:16:42.151	"	"	"code: 	
failurecount: 	180
file: 	D:\a\1\s\src\windows\wslcore\lib\NatNetworking.cpp
function: 	
hr: 	0x8007023E
linenumber: 	883
message: 	""HcnCreateNetwork {""""Success"""":false,""""Error"""":""""{Application Error} The exception s (0x"""",""""ErrorCode"""":2147942974}""
threadid: 	16216
type: 	0
wslVersion: 	2.1.5.0"	D:\a\1\s\src\windows\wslcore\lib\NatNetworking.cpp			17520	16216	2		00000000-0000-0000-0000-000000000000		

I don't think this is related to hvsocket. It looks like something is failing inside HNS

@keith-horton
Copy link
Member

@OneBlue , my mistake. I was thinking this was a different issue. looking into it.

@keith-horton
Copy link
Member

@alohith , this wasn't the networking trace - but this looks like a pattern we've seen where vswitch is unable to create a NAT switch from the underlying network configuration. Did this start failing once you bridged 2 network adapters? It looks like something between vswitch and netsetup is failing.

@alohith
Copy link
Author

alohith commented Mar 27, 2024

I haven't successfully bridged the 2 NICs, every time I try to, I get some "we can't do this" type error dialog box without any helpful resolution path, so I've just reset all the networking to 'default' (2 LAN connections +1 WLAN connection) but WSL networking i guess is broken now...

Some context, I was having failing RAM issues, for which I did a replacement with a new kit of RAM, which in turn somehow disconnected my NVME boot and corrupted it. I fixed all that and ended with a 'fresh' install of win10, but with all my files. So I've just been over last couple weeks bringing back online all the settings and programs I had before the win10 reset. Just so happens that trying to do the LAN connection bridge, broke WSL's ability to ANY networking.

My current Device Manager pane for network adapters looks like this:

image

@keith-horton
Copy link
Member

If you are getting errors trying to create an L2 bridge, there is something wrong very low in the stack. That's something NDIS support would probably have to look at :(

Did you do a full network reset? (Settings -> Network & Internet -> Network reset)
That might break your Cisco solution though (looks like a Cisco VPN). But that would definitely clear out stale settings.
(you might have to reinstall that software)

@keith-horton
Copy link
Member

One other option that might just solve it, in Device Manager, click on the "View" menu item and click on "Show hidden devices". if you see any Hidden device under Network Adapters, I would remove them.

For some configurations, we have seen those "ghost" adapters break a lot of things.

@alohith
Copy link
Author

alohith commented Mar 27, 2024

One other option that might just solve it, in Device Manager, click on the "View" menu item and click on "Show hidden devices". if you see any Hidden device under Network Adapters, I would remove them.

For some configurations, we have seen those "ghost" adapters break a lot of things.

thanks for these solutions:
I'm fine with reinstalling the VPN (mostly used to access campus resources anyhow). I actually forgot about resetting network settings, i'll try that now.

I don't see any 'hidden devices' in device manager under network adapters, so i guess that may not be it.

@alohith
Copy link
Author

alohith commented Mar 27, 2024

@OneBlue @keith-horton I just did the network reset (after changing the networkingMode= NAT), and it doesn't seem to have fixed the WSL network connection, still:

image

@alohith
Copy link
Author

alohith commented Mar 27, 2024

If you are getting errors trying to create an L2 bridge, there is something wrong very low in the stack. That's something NDIS support would probably have to look at :(

Did you do a full network reset? (Settings -> Network & Internet -> Network reset) That might break your Cisco solution though (looks like a Cisco VPN). But that would definitely clear out stale settings. (you might have to reinstall that software)

where would I submit a support ticket to find a resolution at NDIS?

@zcobol
Copy link

zcobol commented Mar 28, 2024

@alohith in an elevated session run hnsdiag reset all to delete all instances of WSL networking objects. You're basically resetting your WSL networking connections.

@alohith
Copy link
Author

alohith commented Mar 28, 2024

@zcobol Do you mean elevated session of Powershell? or disable networkingMode with .wslconfig run this hnsdiag reset all as sudo, restart wsl?

If the former, it didn't seem to do anything:

image

@alohith
Copy link
Author

alohith commented Mar 28, 2024

@zcobol @keith-horton @OneBlue So following the elevated hnsdiag reset all cmd in powershell, then restart, seems to erase all netowrking on my system, so uninstalled all my LAN drivers, restarted, then installed them again, and now with basic windows LAN back I have the approprate number of connections in Network Connections:

image

But it looks like Ubuntu on WSL still doesn't have any networking, throwing the same error that i've been seeing the whole time
logs: https://drive.google.com/file/d/1QnxFNRZKPxvt7x7qhfVLWMYZHwpwYaSz/view?usp=sharing

I don't want to go the 'nuclear' resolution and reset windows again starting from scratch all my setup for the second time...

@kohded
Copy link

kohded commented Mar 31, 2024

@alohith, Were you able to get this resolved? I'm no expert on this, but I'll share a couple things that worked for me. Hopefully it helps someone. In both these solutions I have the following Windows features enabled: Hyper-V, Virtual Machine Platform, and Windows Subsystem for Linux. As a side note, I also have NordVPN running and both the following solutions still worked.

This documentation helped me, WSL Networking Documentation

Host Machine: Window 11 23H2 22631.3296

My wsl

wsl --version
WSL version: 2.1.5.0
Kernel version: 5.15.146.1-2
WSLg version: 1.0.60
MSRDC version: 1.2.5105
Direct3D version: 1.611.1-81528511
DXCore version: 10.0.25131.1002-220531-1700.rs-onecore-base2-hyp
Windows version: 10.0.22631.3296

My .wslconfig. - Your config doesn't need all these setting, but add them as needed.

[wsl2]
dnsTunneling=true
firewall=true
networkingMode=mirrored # bridged, mirrored, nat, none, virtioproxy
# vmSwitch=Hyper-V # Required with networkingMode=bridged 

[experimental]
autoMemoryReclaim=gradual  # disable, dropcache, gradual
sparseVhd=true
  1. Solution - Mirrored
[wsl2]
networkingMode=mirrored
wsl --shutdown
wsl
  1. Solution - Bridged
  • This should work for Windows 10 and 11 host machine, but I'm unable to test on Windows 10.
  • Create Hyper-V Virtual Switch.
    virtual-switch-name
  • .wslconfig set networkingMode=bridged and vmSwitch=YOURSWITCHNAME (Named mine Hyper-V)
[wsl2]
networkingMode=bridged
vmSwitch=YOURSWITCHNAME
wsl --shutdown
wsl

@alohith
Copy link
Author

alohith commented Apr 3, 2024

@kohded Thanks for the suggestions. unfortunately WSL in win 10 with your .wslconfig parameters returns the following for the first option

image

for the second option, when I try to open (as Administrator) the 'Virtual Switch Manager' from the Hyper-V manager to set up the vmSwitch as you describe I get the following, so little lost on what resolution I can actually do.

image

And applying the .wslconfig settings as described without futzing in the virtual switch manager, I get the following:

image

.wslconfig settings set as following:

[experimental]
autoMemoryReclaim=gradual  # gradual | dropcache | disabled
sparseVhd=true
#autoProxy=true

[wsl2]  # omit that if you already have it. 
vmSwitch=Hyper-V
networkingMode=bridged      # mirrored | NAT | None 
#dnsTunneling=True
#firewall=true

@keith-horton
Copy link
Member

Sorry, it looks like your Hyper-V configuration is in some broken state. I would recommend removing all Hyper-V related features, then adding them back to get into a known working state. This does mean that if you have VMs, you'll want to ensure they are backed up correctly first.

Same with your Linux distros. (always good to have backups!)

That would mean removing the optional components for Hyper-V, Virtual Machine Platform, Windows Sandbox, Microsoft Defender Application Guard, Windows Subsytem for Linux.

@alohith
Copy link
Author

alohith commented Apr 10, 2024

@keith-horton Thanks for the suggestions about removing the optional windows components and then bringing them back. After doing that, i went an extra step and unregistered Ubuntu before installing it again, (while .wslconfig had [wsl2] networkingMode=None, then after changing to NAT, Ubuntu is able to launch like normal and i was able to ping google so 🤞 its all solved?

Thanks for all your help on this.

@keith-horton
Copy link
Member

@alohith that's great - glad you're up and running :)

@OneBlue
Copy link
Collaborator

OneBlue commented Apr 10, 2024

Closing since the issue is resolved.

@mistu01
Copy link

mistu01 commented Jul 4, 2024

@alohith, Were you able to get this resolved? I'm no expert on this, but I'll share a couple things that worked for me. Hopefully it helps someone. In both these solutions I have the following Windows features enabled: Hyper-V, Virtual Machine Platform, and Windows Subsystem for Linux. As a side note, I also have NordVPN running and both the following solutions still worked.

This documentation helped me, WSL Networking Documentation

Host Machine: Window 11 23H2 22631.3296

My wsl

wsl --version
WSL version: 2.1.5.0
Kernel version: 5.15.146.1-2
WSLg version: 1.0.60
MSRDC version: 1.2.5105
Direct3D version: 1.611.1-81528511
DXCore version: 10.0.25131.1002-220531-1700.rs-onecore-base2-hyp
Windows version: 10.0.22631.3296

My .wslconfig. - Your config doesn't need all these setting, but add them as needed.

[wsl2]
dnsTunneling=true
firewall=true
networkingMode=mirrored # bridged, mirrored, nat, none, virtioproxy
# vmSwitch=Hyper-V # Required with networkingMode=bridged 

[experimental]
autoMemoryReclaim=gradual  # disable, dropcache, gradual
sparseVhd=true
1. Solution - Mirrored


* [Host machine must be Windows 11 for mirrored.](https://github.com/microsoft/WSL/issues/11359#issuecomment-2016683175)

* .wslconfig set networkingMode=mirrored. All I needed for it to work.
[wsl2]
networkingMode=mirrored
wsl --shutdown
wsl
2. Solution - Bridged


* This should work for Windows 10 and 11 host machine, but I'm unable to test on Windows 10.

* Create Hyper-V Virtual Switch.
  ![virtual-switch-name](https://private-user-images.githubusercontent.com/11213315/318233384-649e32ea-fe72-4703-aaef-97ad884774a8.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3MjAwNTUxNjUsIm5iZiI6MTcyMDA1NDg2NSwicGF0aCI6Ii8xMTIxMzMxNS8zMTgyMzMzODQtNjQ5ZTMyZWEtZmU3Mi00NzAzLWFhZWYtOTdhZDg4NDc3NGE4LnBuZz9YLUFtei1BbGdvcml0aG09QVdTNC1ITUFDLVNIQTI1NiZYLUFtei1DcmVkZW50aWFsPUFLSUFWQ09EWUxTQTUzUFFLNFpBJTJGMjAyNDA3MDQlMkZ1cy1lYXN0LTElMkZzMyUyRmF3czRfcmVxdWVzdCZYLUFtei1EYXRlPTIwMjQwNzA0VDAxMDEwNVomWC1BbXotRXhwaXJlcz0zMDAmWC1BbXotU2lnbmF0dXJlPTZmOWNmMzNlMjc0Yjk5ZDAyZTc5YTg5NDBhZDMwYzY5ZmRiNjgwOTUyMjhkYmE0ZjA4NGUwZWM4YTFiNDY4N2YmWC1BbXotU2lnbmVkSGVhZGVycz1ob3N0JmFjdG9yX2lkPTAma2V5X2lkPTAmcmVwb19pZD0wIn0.MD1rhLZuXBmE6XpxNmD8raX_VHzWPRA56Rv-sDHSP8A)

* .wslconfig set networkingMode=bridged and vmSwitch=YOURSWITCHNAME (Named mine Hyper-V)
[wsl2]
networkingMode=bridged
vmSwitch=YOURSWITCHNAME
wsl --shutdown
wsl

Solution - Mirrored

saved my life! Thanks

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

No branches or pull requests

7 participants