skip to Main Content

Thanks in advance, I’ve researched exhaustively and cannot fix this issue after 5 days.

I am attempting to install Ubuntu as a Windows distro on top of WSL-2 Kernel.
Here are the steps I take:

  1. I download the Linux Kernel Update package from this URL -> https://learn.microsoft.com/en-us/windows/wsl/install-manual#step-4—download-the-linux-kernel-update-package
  2. I turn on Windows features "Windows subsystem for Linux"; "Virtual Machine Platform"
  3. I restart machine and also ensure virtualization is enabled within my BIOS
  4. I install Ubuntu from Microsoft Store. (I’ve tried 3 different versions of Ubuntu).
  5. I run Ubuntu as an Administrator

When I run Ubuntu as Admin, I always get this below error:

"ubuntu wslregisterdistribution failed with error: 0x80041002"

I have scoured the net for fixes, but there is little on this error that doesn’t simply pertain to a Windows update.
The ONLY action that has resolved this is setting the wsl –set-default-version to "1" as the default is 2. When I downgrade to wsl-1, Ubuntu launches fine.

However, from my research and experience, I cannot run Docker Desktop using wsl-1 as it requires version 2.

When I run Ubuntu with wsl-1 and then type command "wsl -l -v", it does indeed say the following:

  NAME      STATE           VERSION
* Ubuntu    Running         1

I believe the Docker portion should be separated from the above-mentioned issue with Ubuntu/wsl, however, as my goal is to simply run the Docker Engine in DD, I’ll include the below information as well with regards to Docker Desktop:

I am attempting to run Docker Desktop on Windows 11 Enterprise. Docker engine always fails to start and I believe the issue lies with WSL/Ubuntu as described above as I cannot run Ubuntu with wsl-2.
Sometimes, Docker Desktop will not launch at all, and instead displays the below error message, prompting me to reset to factory defaults; but I know my issue is with WSL:

System.InvalidOperationException:
Failed to deploy distro docker-desktop to C:Usersv-kesculAppDataLocalDockerwsldistro: exit code: -1
 stdout: Error: 0x80041002 

Any help would be appreciated as we really need get Docker running on the new Windows 11 machines so we can dockerize our Spring Cloud environments into a Linux based AWS EC2 instance.. thank you!

3

Answers


  1. I think I might have the solution for you. I studied the error 0x80041002 and found out that it doesn’t come from WSL2, it comes from hyper-v. The error means that since WSL2 uses hyper-v to function, hyper-v tried to create a virtual ethernet adapter but something blocked it from doing it.

    All virtual machine software will use your physical controller as a link to create a virtual network adapter, so if you have many vm software installed and you check your network connections in your control panel, you’ll see that your pc has a lot of virtual ethernet adapters. And if you are having the issue 0x80041002, it means that one of your virtual adapters is blocking hyper-v from creating a new network for it.

    In my case I had installed vmware in my second hard drive and I had remove my hard drive from my pc. So the vmware virtual adapaters tried to talk to the source but it couldn’t, and since it’s linked to my physical controller, it blocked hyper-v from working properly.

    So check if any virtual machine software is causing this issue or a VPN, in case you have Oracle vm, vmware or VPN, try to uninstall it and try again. And maybe try to reinstall your physical network driver.

    Login or Signup to reply.
  2. use wsl version as 1 instead of version 2 with command

    wsl --set-default-version 1 
    

    and try re-install the linux dist which you want to use. After install or fix the wsl, you can switch wsl version 2 again.

    wsl --set-version <Dist> 2
    

    As you mention that if you use docker and the method above is useless, you should try to unregister the current distro and uninstall first and repeat the steps above. For unregistering the current version:

    wsl --unregister <Distro>
    
    Login or Signup to reply.
  3. WARNING: several users reported that this procedure broke their networking entirely. Read the documentation at below link carefully before attempting this solution. It did work as expected in my case, but that may not be the case for everyone.

    This is indeed related to a problem with a virtual network adapter.

    In my case WSL2 Ubuntu 18.04 went from a working state to error 0x80041002 without warning. I had been fiddling with network adapters a few days before this started occurring, trying to create a wireless hotspot using a WiFi dongle on the same PC, which failed. FWIW, I was following the guide here trying to resolve my other issue. I believe one of those commands may have been the root cause for this.

    I noticed that each time bash.exe was trying to start (before spewing the error), a malfunctioning device would momentarily appear in Windows 10 Device Manager under Network Adapters; the Hyper-V Virtual Switch Extension Adapter.

    Searching for that adapter and the error code, I ended up finding this: https://learn.microsoft.com/en-us/troubleshoot/windows-client/virtualization/cannot-create-hyper-v-virtual-switch

    This article solves an error message when you try to re-create a Hyper-V virtual switch (vSwitch) for the same physical adapter.
    
    Applies to:   Windows 10 - all editions
    Original KB number:   3101106
    

    They provide an Easy fix wizard (easyfix20159) that seems to properly reset all network adapters (warning: it will remove all virtual network adapters and the config of the main adapter).

    Before you run the Easy fix, note the following points:
    
        You will lose network connectivity after the wizard finishes.
        You must restart your computer manually after the wizard finishes.
        You will have to connect manually to all known Wi-Fi networks after your computer restarts.
        You must re-create the vSwitch by using the Hyper-V Virtual Switch Manager after your computer restarts.
    

    My Windows Subystem for Linux started working again after applying this fix and restarting Windows.

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search