microsoft / WSL

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

WslRegisterDistribution failed with error: 0xe000020b when launching Ubuntu #9909

Open dmytroettcdw opened 1 year ago

dmytroettcdw commented 1 year ago

Windows Version

Microsoft Windows [Version 10.0.19042.2728]

WSL Version

1.1.3.0, but i'm not on Store version, I installed it via podman

Are you using WSL 1 or WSL 2?

Kernel Version

5.15.90.1

Distro Version

Ubuntu 22.04 LTS, but honestly it happens with any distro

Other Software

Podman version 4.4.4

Repro Steps

Run following command: wsl --install "Ubuntu-22.04"

Expected Behavior

Ubuntu is getting installed and working

Actual Behavior

wsl --install "Ubuntu-22.04" Installing: Ubuntu 22.04 LTS Ubuntu 22.04 LTS has been installed. Launching Ubuntu 22.04 LTS... Installing, this may take a few minutes... WslRegisterDistribution failed with error: 0xe000020b Error: 0xe000020b (null) Press any key to continue...

Diagnostic Logs

WslLogs-2023-04-04_16-18-37.zip

benhillis commented 1 year ago

Looks like an issue creating the virtual network, can you share the output of hnsdiag list all?

dmytroettcdw commented 1 year ago

@benhillis Sure,

hnsdiag list all
////////////////////////NETWORKS///////////////////////

///////////////////////ENDPOINTS///////////////////////

//////////////////////NAMESPACES///////////////////////

Namespace        : 910f7d92-ba2d-4c3f-98ae-7c0ac590d2dc

/////////////////////LOADBALANCERS/////////////////////
mariorecinos commented 1 year ago

This seems to be similar to another issue

https://github.com/microsoft/WSL/issues/6089

dmytroettcdw commented 1 year ago

This seems to be similar to another issue

https://github.com/microsoft/WSL/issues/6089

I tried steps in that issue without any luck. So any other advises are appreciated

mariorecinos commented 1 year ago

Have you tried running the wsl --install command with administrator privileges

dmytroettcdw commented 1 year ago

This seems to be similar to another issue

6089

I tried steps in that issue without any luck. So any other advises are appreciated

Wanted to expand on it I did

netsh winsock reset
netcfg -d

it didn't help.

Have you tried running the wsl --install command with administrator privileges

@mariorecinos tried right now, result is the same :(

mariorecinos commented 1 year ago

Try resetting the WSL service by opening a PowerShell terminal with administrative privileges and running the following

command:

Get-Service LxssManager | Restart-Service

Try unregistering any existing Ubuntu distributions by running the following command in PowerShell with administrative privileges:

wsl.exe --unregister Ubuntu-22.04

and then running the installation command again.

If none of the above steps work, you could try resetting the WSL installation entirely by following the instructions in this Microsoft article: https://docs.microsoft.com/en-us/windows/wsl/troubleshooting#resetting-your-installation-of-wsl.

Resetting the installation may help in case anything is corrupted or not setup correctly I hope these commands help!

dmytroettcdw commented 1 year ago

Hi @mariorecinos sorry for late reply,

So I tried Get-Service LxssManager | Restart-Service

Didn't help. I noticed that LxssManager wasn't even running before I run that command.

Unregistering didn't help either:

PS C:\Users\dmytett> wsl.exe --unregister Ubuntu-22.04
Unregistering.
There is no distribution with the supplied name.
Error code: Wsl/Service/WSL_E_DISTRO_NOT_FOUND

I run wsl --list, and it appears no distros are registered at all:

PS C:\Users\dmytett> wsl.exe --list
Windows Subsystem for Linux has no installed distributions.

Use 'wsl.exe --list --online' to list available distributions
and 'wsl.exe --install <Distro>' to install.

Distributions can also be installed by visiting the Microsoft Store:
https://aka.ms/wslstore
Error code: Wsl/WSL_E_DEFAULT_DISTRO_NOT_FOUND

So it looks like distro is not even registering. But I see this in "apps and features"

image

Any other thoughts?

mariorecinos commented 1 year ago

Thank you for sharing so try uninstalling ubuntu from "apps and features" then restart your computer and after restart go to the Microsoft store and re install wsl Ubuntu again like mentioned in the commands

https://aka.ms/wslstore

dmytroettcdw commented 1 year ago

@mariorecinos The link is not opening on the machine I'm trying to install it to.

I tried to reinstall ubuntu, alas the same error. I tried to completely reinstall WSL (remove WSL feature from "turn windows features on and off), with same outcome.

Switching to wsl1 helped, but it seems WSL1 has issues with podman. Rootless is not working and I can't launch any container.

Your kernel does not support pids limit capabilities or the cgroup is not mounted. PIDs limit discarded. Error: error creating network namespace for container 24c13dfae069e458138e6bb7d66b00c19a51c87c76cb8113139e155ac7a1a514: failed to create namespace: failed to bind mount ns at /run/netns/cni-93ee72dd-e8dd-1a47-9265-d8d3d24b8649: invalid argument

I tried openSUSE Leap distro, rootless podman still doesn't work. But the issue is different when I try to run a container:

Error: filesystem type 0x53464846 reported for /var/lib/containers/storage is not supported with 'overlay': backing file system is unsupported for this graph driver

dmytroettcdw commented 1 year ago

@mariorecinos I was able to find some useful traces for this issue in event viewer:

5:46:04, Host-Network-Service, event id 1055, event: RPC request received. Type: 'Create', Entity: 'Network', Id: '{b95d0c5e-57d4-412b-b571-18a81a16e005}', Access Level: 'Administrator', Data: '{"Name":"WSL","Type":"ICS","IsolateSwitch":true,"Flags":9}'

Then there are a bunch of entries from Hyper-V-VmSwitch, couple of most interest:

5:47:05, Hyper-V-VmSwitch, event id 67, event: Port 44A32E0B-7D45-42BD-8AD9-A9B0086F814F (Friendly Name: WSL) successfully created on switch 44A32E0B-7D45-42BD-8AD9-A9B0086F814F (Friendly Name: WSL). 5:47:05, Hyper-V-VmSwitch, event id 233, event: The operation 'Create' succeeded on nic 44A32E0B-7D45-42BD-8AD9-A9B0086F814F (Friendly Name: WSL). 5:47:05, Hyper-V-VmSwitch, event id 232, event: NIC 44A32E0B-7D45-42BD-8AD9-A9B0086F814F (Friendly Name: WSL) successfully connected to port 44A32E0B-7D45-42BD-8AD9-A9B0086F814F (Friendly Name: WSL) on switch 44A32E0B-7D45-42BD-8AD9-A9B0086F814F(Friendly Name: WSL). 5:47:05, Hyper-V-VmSwitch, event id 9, event: Switch 44A32E0B-7D45-42BD-8AD9-A9B0086F814F (Friendly Name: WSL) successfully initialized.

Then a bunch of verbose logs which I don't understand. Next logs indicate that switch was deleted. I assume something went wrong, thus system decided to clean up the switch:

5:47:05, Hyper-V-VmSwitch, event id 234, event: NIC 44A32E0B-7D45-42BD-8AD9-A9B0086F814F successfully disconnected from port 44A32E0B-7D45-42BD-8AD9-A9B0086F814F. 5:47:05, Hyper-V-VmSwitch, event id 69, event: Port 44A32E0B-7D45-42BD-8AD9-A9B0086F814F (Friendly Name: WSL) successfully deleted - switch 44A32E0B-7D45-42BD-8AD9-A9B0086F814F (Friendly Name: WSL). 5:47:05, Hyper-V-VmSwitch, event id 71, event: Delete complete for port 44A32E0B-7D45-42BD-8AD9-A9B0086F814F (Friendly Name: WSL). 5:47:05, Hyper-V-VmSwitch, event id 233, event: The operation 'Delete' succeeded on nic 44A32E0B-7D45-42BD-8AD9-A9B0086F814F (Friendly Name: WSL). 5:47:05, Hyper-V-VmSwitch, event id 62, event: Switch 44A32E0B-7D45-42BD-8AD9-A9B0086F814F (Friendly Name: WSL) successfully deleted. 5:47:05, Hyper-V-VmSwitch, event id 66, event: Delete complete for Switch 44A32E0B-7D45-42BD-8AD9-A9B0086F814F (Friendly Name: WSL).

I really don't want to give up on this. If there any other ideas, I would gladly try them out

dmytroettcdw commented 1 year ago

Forgot to mention, I'm trying to get this running on virtualization enabled VMWare virtual machine. Hope that helps.

mofali commented 1 year ago

I am also facing same issue, do anyone have found fix. Really helpful if any reply. @dmytroettcdw please.

dmytroettcdw commented 1 year ago

I am also facing same issue, do anyone have found fix. Really helpful if any reply. @dmytroettcdw please.

I have lost my faith trying to make it work, so unfortunately I have no good news to share with you.

keith-horton commented 1 year ago

@dmytroettcdw , I've been looking at the original traces you provided. We can see that initially the request to create the switch for WSL (NAT) succeeded. But immediately afterwards there was an attempt to reset all switch extensions (normal process to startup a switch), and that failed with ERROR_NO_SUCH_DEVINST. Which looks like something ganked the switch from beneath us.

Do you have any switch extensions installed? This is a VM hosted by VMWare? (this is a guest VM - that VMWare is hosting?) Did VMWare install any switch extensions or any software in the guest?

dmytroettcdw commented 11 months ago

@keith-horton I'm really sorry for late reply, I lost access to this account for some time. Answering your questions.

Do you have any switch extensions installed?

I'm not sure. How do I check that?

This is a VM hosted by VMWare? (this is a guest VM - that VMWare is hosting?)

Yes, This is a guest VM running under VMWare hypervisor.

Did VMWare install any switch extensions or any software in the guest?

Not sure how to check. Is it possible to do from under guest VM?

keith-horton commented 10 months ago

WSL is hosted by vmSwitch in Windows. The fact you have VMWare installed suggests the 2 are in conflict somehow. You have a guest VM running, and you're trying to run WSL within the guest VM? I don't know VMWare - do they also have software running within the guest VM?

Not knowing about interop issues with VMWare, are you able to run other VMs or containers within this guest VM? For example, can you start Windows Sandbox?

vtkachenko commented 8 months ago

Facing the same issue in the same Environment, as you, @dmytroettcdw. Looking forward for the resolution, but assuming, that you've covered the long way already, there are not a lot of hopes to get a fix, I suppose :(

keith-horton commented 8 months ago

@dmytroettcdw : as this is a virtual machine, this may be due to phantom PnP devices breaking us. Are you OK running this script which we found that does an OK job finding and removing "ghost adapters" (i.e. adapters marked as Phantoms by PnP)?

https://gist.github.com/alexjebens/a027f8757348bdacbcbb5aa85612d045

keith-horton commented 8 months ago

If you don't want to run someone's powershell script, you can check this by hand :)

  1. Open device manager
  2. Click the View menu item > check Show hidden devices
    1. Expand Network adapters in the list
    2. Ghosted network adapters will look 'disabled' / 'hidden'
    3. Right click over the Ghosted network adapter and select Uninstall Device
justsomeasshole commented 7 months ago

Yes, this finally solved it! It has breen driving me crazy for the last 2 days. Thanks!