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

Ethernet Adapter vEthernet (WSL) missing/can not be created (-SwitchType Private) #6775

Closed
waldyd opened this issue Apr 8, 2021 · 10 comments
Labels

Comments

@waldyd
Copy link

waldyd commented Apr 8, 2021

Environment

Windows build number: [Version 10.0.18363.1440]
Whether the issue is on WSL 2 and/or WSL 1: [WSL2]

Steps to reproduce

  1. Ethernet Adapter vEthernet (WSL) missing/not found using ipconfig
  2. Try to recreate it via powershell comands:
New-VMSwitch "WSL" -NetAdapterName "Ethernet"
set-vmswitch -name WSL -NetAdapterName Ethernet -AllowManagementOS 1
set-vmswitch 'WSL' -SwitchType Private
  1. Hyper-V Switch created without Ethernet Adapter vEthernet (WSL)

image

NIC C4*-*-*-*-*B4 successfully disconnected from port .
The server could not bind to the transport \Device\NetBT_Tcpip_{D7*-*-*-*-*E8} because another computer on the network has the same name.  The server could not start.
The server could not bind to the transport \Device\NetBT_Tcpip_{79*-*-*-*-*9F} because another computer on the network has the same name.  The server could not start.
The server could not bind to the transport \Device\NetBT_Tcpip_{2A*-*-*-*-*05} because another computer on the network has the same name.  The server could not start.
The operation 'Delete' succeeded on nic C4*-*-*-*-*B4 (Friendly Name: WSL).

WSL logs:

wsl-etl.zip

Expected behavior

  1. Ethernet Adapter vEthernet (WSL) created
  2. WSL distro Conversion success

Actual behavior

  1. Error Prompted:
System.InvalidOperationException:
Failed to deploy distro docker-desktop to C:\Users\NW539AL\AppData\Local\Docker\wsl\distro: exit code: -1
stdout: The network was not found.


stderr: 
  at Docker.ApiServices.WSL2.WslShortLivedCommandResult.LogAndThrowIfUnexpectedExitCode(String prefix, ILogger log, Int32 expectedExitCode) in C:\workspaces\master-merge\src\github.com\docker\pinata\win\src\Docker.ApiServices\WSL2\WslCommand.cs:line 146
  at Docker.Engines.WSL2.WSL2Provisioning.<DeployDistroAsync>d__17.MoveNext() in C:\workspaces\master-merge\src\github.com\docker\pinata\win\src\Docker.Engines\WSL2\WSL2Provisioning.cs:line 168
--- End of stack trace from previous location where exception was thrown ---
  at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
  at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
  at Docker.Engines.WSL2.WSL2Provisioning.<ProvisionAsync>d__8.MoveNext() in C:\workspaces\master-merge\src\github.com\docker\pinata\win\src\Docker.Engines\WSL2\WSL2Provisioning.cs:line 77
--- End of stack trace from previous location where exception was thrown ---
  at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
  at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
  at Docker.Engines.WSL2.LinuxWSL2Engine.<DoStartAsync>d__29.MoveNext() in C:\workspaces\master-merge\src\github.com\docker\pinata\win\src\Docker.Engines\WSL2\LinuxWSL2Engine.cs:line 190
--- End of stack trace from previous location where exception was thrown ---
  at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
  at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
  at Docker.ApiServices.StateMachines.TaskExtensions.<WrapAsyncInCancellationException>d__0.MoveNext() in C:\workspaces\master-merge\src\github.com\docker\pinata\win\src\Docker.ApiServices\StateMachines\TaskExtensions.cs:line 29
--- End of stack trace from previous location where exception was thrown ---
  at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
  at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
  at Docker.ApiServices.StateMachines.StartTransition.<DoRunAsync>d__5.MoveNext() in C:\workspaces\master-merge\src\github.com\docker\pinata\win\src\Docker.ApiServices\StateMachines\StartTransition.cs:line 67
--- End of stack trace from previous location where exception was thrown ---
  at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
  at Docker.ApiServices.StateMachines.StartTransition.<DoRunAsync>d__5.MoveNext() in C:\workspaces\master-merge\src\github.com\docker\pinata\win\src\Docker.ApiServices\StateMachines\StartTransition.cs:line 92
  1. Ethernet Adapter vEthernet (WSL) not created
  2. WSL distro Conversion failed
  3. Already tried this: https://docs.microsoft.com/en-us/troubleshoot/windows-client/virtualization/cannot-create-hyper-v-virtual-switch
 wsl  --set-version kali-linux 2
Conversion in progress, this may take a few minutes...
For information on key differences with WSL 2 please visit https://aka.ms/wsl2
The network was not found.
@craigloewen-msft
Copy link
Member

Hello, could you please attach logs for when you're trying to convert WSL?

You downloaded the html version of the log file, please save this file and run logs using it and link them here.

Thank you!

@waldyd
Copy link
Author

waldyd commented Apr 13, 2021

Hi,

This is log file:

wsl-etl.zip

Thank you!

@OneBlue
Copy link
Collaborator

OneBlue commented Apr 13, 2021

@waldyd : WSL internally identifies networks by GUID.

The network you manually created doesn't have the right GUID, but has the same name, WSL.
This causes WSL to think that the network already exists, but fails when the service actually tries to open it because its opened by GUID and not by name.

The 'WSL' network is created when the WSL service start, so the simplest way to fix this would be:

PS C:> Remove-VmSwitch "WSL"
PS C:> Restart-Service lxssmanager

Let us know if that worked for you.

@waldyd
Copy link
Author

waldyd commented Apr 13, 2021

@OneBlue : Restarting the lxssmanager service did not work for creating the Ethernet Adapter vEthernet (WSL) neither the WSL Virtual Switch:

image

The vEthernet adapter is only created for -SwitchType different than Private (External, Internal)

@OneBlue
Copy link
Collaborator

OneBlue commented Apr 13, 2021

@waldyd: Sorry I realized that my previous reply wasn't clear.

The network is created on the first WSL startup, once per service start.

Can you run wsl once and check if that creates the network ?

@waldyd
Copy link
Author

waldyd commented Apr 14, 2021

@OneBlue : NP. All my WSL distros are version 1, except the Docker related ones that are WSL 2:

wsl --list --verbose
  NAME            STATE           VERSION
* Ubuntu-18.04    Stopped         1
  kali-linux      Running         1

Once I start Docker Desktop, the following error is prompted:

System.InvalidOperationException:
Failed to deploy distro docker-desktop to C:\Users\NW539AL\AppData\Local\Docker\wsl\distro: exit code: -1
 stdout: The network was not found.


 stderr: 
   at Docker.ApiServices.WSL2.WslShortLivedCommandResult.LogAndThrowIfUnexpectedExitCode(String prefix, ILogger log, Int32 expectedExitCode) in C:\workspaces\PR-15387\src\github.com\docker\pinata\win\src\Docker.ApiServices\WSL2\WslCommand.cs:line 146
   at Docker.Engines.WSL2.WSL2Provisioning.<DeployDistroAsync>d__17.MoveNext() in C:\workspaces\PR-15387\src\github.com\docker\pinata\win\src\Docker.Desktop\Engines\WSL2\WSL2Provisioning.cs:line 169
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at Docker.Engines.WSL2.WSL2Provisioning.<ProvisionAsync>d__8.MoveNext() in C:\workspaces\PR-15387\src\github.com\docker\pinata\win\src\Docker.Desktop\Engines\WSL2\WSL2Provisioning.cs:line 78
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at Docker.Engines.WSL2.LinuxWSL2Engine.<DoStartAsync>d__26.MoveNext() in C:\workspaces\PR-15387\src\github.com\docker\pinata\win\src\Docker.Desktop\Engines\WSL2\LinuxWSL2Engine.cs:line 104
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at Docker.ApiServices.StateMachines.TaskExtensions.<WrapAsyncInCancellationException>d__0.MoveNext() in C:\workspaces\PR-15387\src\github.com\docker\pinata\win\src\Docker.ApiServices\StateMachines\TaskExtensions.cs:line 29
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at Docker.ApiServices.StateMachines.StartTransition.<DoRunAsync>d__5.MoveNext() in C:\workspaces\PR-15387\src\github.com\docker\pinata\win\src\Docker.ApiServices\StateMachines\StartTransition.cs:line 67
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
   at Docker.ApiServices.StateMachines.StartTransition.<DoRunAsync>d__5.MoveNext() in C:\workspaces\PR-15387\src\github.com\docker\pinata\win\src\Docker.ApiServices\StateMachines\StartTransition.cs:line 92
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at Docker.ApiServices.StateMachines.EngineStateMachine.<StartAsync>d__14.MoveNext() in C:\workspaces\PR-15387\src\github.com\docker\pinata\win\src\Docker.ApiServices\StateMachines\EngineStateMachine.cs:line 69
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at Docker.Engines.Engines.<SwitchDaemonAsync>d__28.MoveNext() in C:\workspaces\PR-15387\src\github.com\docker\pinata\win\src\Docker.Desktop\Engines\Engines.cs:line 333
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at Docker.ApiServices.Services.DesktopService.<SwitchDaemonAsync>d__4.MoveNext() in C:\workspaces\PR-15387\src\github.com\docker\pinata\win\src\Docker.ApiServices\Services\DesktopService.cs:line 36

Docker Error

In conclusion, virtual network interface can not be created.

@OneBlue
Copy link
Collaborator

OneBlue commented Apr 20, 2021

Ok this is interesting.

Can you take another trace after having the 'WSL' network deleted and lxssmanager restarted ?
I'd like to see what happens when WSL tries to create it.

So can you please install a dummy WSL2 distro, set it as default, then run these instructions and share both the output and wsl.etl ?

@ghost
Copy link

ghost commented May 21, 2021

This issue has been automatically closed since it has not had any author activity for the past 7 days. If you're still experiencing this issue please re-open it.

Thank you!

@waldyd
Copy link
Author

waldyd commented Oct 30, 2021

A crash report has been uploaded with diagnostic id:

582E1E1D-A6C2-40DA-A487-C572E949D458/20211029235328

@ghost ghost removed the needs-author-feedback label Oct 30, 2021
@waldyd
Copy link
Author

waldyd commented Feb 28, 2022

Ok this is interesting.

Can you take another trace after having the 'WSL' network deleted and lxssmanager restarted ? I'd like to see what happens when WSL tries to create it.

So can you please install a dummy WSL2 distro, set it as default, then run these instructions and share both the output and wsl.etl ?

@OneBlue. Here are the results:

> wsl --list --online
The following is a list of valid distributions that can be installed.
Install using 'wsl --install -d <Distro>'.

NAME            FRIENDLY NAME
Ubuntu          Ubuntu
Debian          Debian GNU/Linux
kali-linux      Kali Linux Rolling
openSUSE-42     openSUSE Leap 42
SLES-12         SUSE Linux Enterprise Server v12
Ubuntu-16.04    Ubuntu 16.04 LTS
Ubuntu-18.04    Ubuntu 18.04 LTS
Ubuntu-20.04    Ubuntu 20.04 LTS

> wsl --list --verbose
  NAME            STATE           VERSION
* Ubuntu-18.04    Stopped         1
  kali-linux      Stopped         1

> wsl --install -d Debian
Downloading: Debian GNU/Linux
Installing: Debian GNU/Linux
Launching Debian GNU/Linux...
* Ubuntu-18.04    Stopped         1
  Debian          Running         1

> wsl --set-default Debian

> wsl --list --verbose
  NAME            STATE           VERSION
* Debian          Running         1
  kali-linux      Stopped         1
  Ubuntu-18.04    Stopped         1

> git clone https://github.com/microsoft/WSL --depth=1 $env:TMP\WSL
Cloning into 'C:\Users\NW539AL\AppData\Local\Temp\WSL'...
remote: Enumerating objects: 23, done.
remote: Counting objects: 100% (23/23), done.
remote: Compressing objects: 100% (22/22), done.
remote: Total 23 (delta 0), reused 13 (delta 0), pack-reused 0
Receiving objects: 100% (23/23), 7.17 MiB | 10.20 MiB/s, done.

> cd $env:TMP\WSL\diagnostics\

> .\networking.bat
... output added as attachment ...

wsl.zip

This issue was closed.
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

4 participants