An unexpected error was encountered while executing a WSL command

For anyone landing here after a search, I personally solved this by disabling legacy console in CMD:

Run CMD as admin > right click title bar > Properties > Untick Use legacy console.

I had this enabled for Syncthing starting minimized, I guess I’ll have to figure something else out for that.

1 Like

After wsl --status I got this: The WSL 2 kernel file is not found. To update or restore the kernel please run ‘wsl --update’.
After running wsl --update everything works.

2 Likes

Its worked for me. Thnks

In my case it helped.
Launch PowerShell with administrator privileges.
Then execute the
wsl --update
command:

C:\WINDOWS\system32> wsl --update
Installing: Windows Subsystem for Linux
Windows Subsystem for Linux has been installed.

Finally, restart the Docker Desktop application.

1 Like

I had the same issue. It was resolved by enabling virtualization in the BIOS.

Hello…try this:
reboot your machine and log in with the Admin Account (not a user account) and go to CMD and type wsl --update, then run docker desktop.

After enabling virtualization in the BIOS still my docker was not running. Later I got to know my wsl command was not working. wsl --status → was showing- the specified service does not exist as an installed service.
So I installed wsl form this GitHub repo: Release 2.0.11 · microsoft/WSL · GitHub
And my docker started working.

This worked for me, too. thx

Hi, I have the same problem but I’m using a VM. I did the enabled features but still not working. any idea?

For me it was a firewall issue I had “simple wall” enabled which is a software that lets you control what comes and goes to your PC. it was working in bg. disabling it worked!

I have the same error, but all the above examples do not work for me, who can help, what other options are there to fix

yeah,me too. i still have this problem,no one help me.i don’t know how to solove it

For me it was the Legacy Console for Command Prompt and PowerShell and/or the ubuntu system.

I disabled the Legacy Console.

The second step was: I installed ubuntu over Powershell:
wsl --install -d ubuntu

after this, it works.

1 Like
wsl --update 

works for me

1 Like

刚刚我已经完美解决了,耗时间五个小时 1. 开启计算机vt虚拟化;在任务管理器中性能查看
2. ROG的AMD主板开启BIOS有所不同,一些默认开启
3. 开启win10的和tvp和计算机子系统两个功能
4. 关闭CMD的虚拟化平台
5. 安装wsl1版本
6. 设置默认为1
7.最重要的是确保使用虚拟化
详细的看


Moderator note by rimelek: Non-english part of the message translated using Google Translate:

I have just solved it perfectly, and it took five hours.

  1. Turn on computer vt virtualization; check the performance in the task manager
  2. ROG’s AMD motherboards have different BIOS options, some are enabled by default.
  3. Enable win10’s tvp and computer subsystem functions
  4. Close the CMD virtualization platform
  5. Install wsl1 version
  6. Set default to 1
  7. The most important thing is to make sure you use virtualization
    See in detail

1 Like

Hello everyone,

I found a fix on Windows 11 for this exact issue where when I started Docker, it would load and tell me that it stopped. It then showed me this Docker Desktop - Unexpected WSL error.

The following steps worked for me:

1- Run Powershell as Admin.
2- Run the following commands one at a time to disable all Virtualization features (select no (N) when asked to restart computer):
DISM /Online /disable-Feature /FeatureName:VirtualMachinePlatform
DISM /Online /disable-Feature /FeatureName:HypervisorPlatform
DISM /Online /disable-Feature /FeatureName:Microsoft-Windows-Subsystem-Linux
3- Restart your computer manually
4- Run Powershell as Admin once your computer has rebooted.
5- Run the following commands in this order one at a time to re-enable all Windows Virtualization features (Again, select no (N) when asked to restart computer):
DISM /Online /enable-Feature /FeatureName:Microsoft-Windows-Subsystem-Linux
DISM /Online /enable-Feature /FeatureName:VirtualMachinePlatform
DISM /Online /enable-Feature /FeatureName:HypervisorPlatform
6- Reboot your computer manually.
7-Run Docker and see if it worked!

Of course you have to have enabled virtualization capabilities for your computer in your BIOS before attempting any of this. To enable virtualization in the BIOS, simply press F2 or DEL when your computer is booting and go in the advance settings. It should be called “Intel Virtualization technology” or something similar that contains the word “Virtualization”. Enable this feature and save the changes and reboot.

I hope this helps you guys! Safe Travel!

1 Like

hHey! I tried this i could disable but getting 87 error while trying to enable them. (Also checked and made sure if the virtualization is enabled ). Any other fixes?

I Just Solve the Problem with enabling BIOS SVM mode

To enable SVM mode in BIOS for an AMD CPU, you can do the following:

    1. Press F7 or click Advanced Mode
    1. Go to the Advanced tab and select CPU Configuration
    1. Go to SVM Mode and select Enabled from the drop-down menu
    1. Click Exit and then OK to apply the changes

You’re a lifesaver man! Reinstalling WSL using this method worked like a charm

Glad I could help you out mate ! :slight_smile: