An unexpected error was encountered while executing a WSL command

Hey guys you just need to enable virtualization from bios setup check it from task manager’ performance if its enabled already.

For me, just had to set my WSL default distro back to Ubuntu (from something else):

wsl -s Ubuntu

Hi, I have the same problem. I’m trying to get it to work on my Azure virtual machine with Windows Server 2022

On Windows 10 Pro I did:

Open “PowerShell” as administrator and type:

bcdedit /set HypervisorLaunchType auto

then type:

shutdown /r /t 0

it will restart Windows.

If it still doesn’t work, then try:

In Windows search type: “regedit” and select “Registry Editor”.
Navigate HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\services\Dnscaches
Locate the “Start” DWORD key and change its value to 2 (Automatic)
Close everything and restart Windows.

In “Services” check that “DNS Client” is “Running”.

3 Likes

This is my issue and solution. Thanks!

1 Like

1 enable svm in bios… 2 go to enable windows features Hyper-V an WSL should be that easy, tbh i just followed this video to visualise the steps worked for me… there is troubleshooting like updating svm versions also explained

How To Install Docker on Windows 11 (youtube.com)

Check your drivers in device Manager
Device manager → System devices → driver for hyper-v and drivers for virtual disk and network adapter
If they turned off, turn them on and try to open docker

1 Like

Its help me too , thank you

This worked for me. Thanks

Solutions are not so straight but, open cmd as admin then run this “wsl --update”. After restart docker. Regards.

On Windows 10/11 Home, Docker Desktop depends on a working WSL2 environment. (No WSL1 support due to missing Hyper-V feature)
On all other Windows 10/11 versions, it either depends on a working WSL1 or WSL2 environment.

The only common nominator for everyone with these problems is that something prevents WSL from working. There is not just one cause and not just one solution.

1 Like

This command helped me
wsl --update
image

tried all solutions above and not any of these was the fix for my.

My Solution:

  1. Uninstall Docker Desktop
  2. Reinstall Docker Desktop but DON’T check the “User WSL 2 instead of Heyper-V”
1 Like

In my case, I fixed that disable the option
Hyper-V
as feature of windows

image

maybe this working for someone else


En mi caso funciono solo deshabilitando la caracteristica de Windows de Hyper-V

talvez funciones para alguien mas

“wsl --update” works like magic, I had watched videos and checked different resources and was stranded, I have enable virtualization from my bios and did different things but this saved the day:)

it workd
very thanks so much!

It physically works!!! Thank you very much. I only run the command "wsl --unregister docker-desktop "

1 Like

bcdedit /set HypervisorLaunchType auto fixed it for me!

1 Like

the best way. It helped me on windows 10, now it helps me on windows 11. That Indian guy is genius )

I tired your solution and got these errors.

command => wsl --version

output
WSL version: 1.2.5.0
Kernel version: 5.15.90.1
WSLg version: 1.0.51
MSRDC version: 1.2.3770
Direct3D version: 1.608.2-61064218
DXCore version: 10.0.25131.1002-220531-1700.rs-onecore-base2-hyp
Windows version: 10.0.19045.4529

command => wsl --status
output => Default Version: 2

command => wsl --unregister docker-desktop
output => Unregistering.
There is no distribution with the supplied name.
Error code: Wsl/Service/WSL_E_DISTRO_NOT_FOUND