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

2 Likes

This is my issue and solution. Thanks!

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

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 "

bcdedit /set HypervisorLaunchType auto fixed it for me!