Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

wsl --set-default-version 2 The service cannot be started, either because it is disabled or because it has no enabled devices associated with it

I'm trying to install again Ubuntu on my Windows 10 Home Version 20H2 OS Build 19042.685 using WSL2.

The problem is the WSL2 installation is not finished. I received the following message doing Step 5 - Set WSL 2 as your default version

PS C:\WINDOWS\system32> wsl
The service cannot be started, either because it is disabled or because it has no enabled devices associated with it.

Previous steps done:

PS C:\WINDOWS\system32> dism.exe /online /enable-feature /featurename:Microsoft-Windows-Subsystem-Linux /all /norestart

Deployment Image Servicing and Management tool
Version: 10.0.19041.572

Image Version: 10.0.19042.685

Enabling feature(s)
[==========================100.0%==========================]
The operation completed successfully.
PS C:\WINDOWS\system32> dism.exe /online /enable-feature /featurename:VirtualMachinePlatform /all /norestart

Deployment Image Servicing and Management tool
Version: 10.0.19041.572

Image Version: 10.0.19042.685

Enabling feature(s)
[==========================100.0%==========================]
The operation completed successfully.
PS C:\WINDOWS\system32>

Then I restarted Windows and

execute wsl_update_x64.msi
like image 447
penag62 Avatar asked Jan 05 '21 16:01

penag62


People also ask

How do I set wsl default to 2?

To set the default version to WSL 1 or WSL 2 when a new Linux distribution is installed, use the command: wsl --set-default-version <Version#> , replacing <Version#> with either 1 or 2.

How do I fix the Windows Subsystem for Linux optional component is not enabled?

The Windows Subsystem for Linux optional component is not enabled: Open Control Panel -> Programs and Features -> Turn Windows Feature on or off -> Check Windows Subsystem for Linux or using the PowerShell cmdlet mentioned at the beginning of this article.

How do I set default wsl?

Set default Linux distro on WSL2Search for Command Prompt, right-click the top result, and select the Run as administrator option. Quick tip: You can also write the command like this: wsl -l . In the command, replace DISTRO-NAME for the name of the distro to set it as default (see step No. 3).

How do I change the default WSL version in Windows 10?

WSL Version: How to Change WSL Default Version to WSL 2 in Windows 10. To ensure that all future WSL Linux distributions use WSL 2 instead of WSL 1, Open PowerShell as Administrator and run the following command: wsl --set-default-version 2.

Why can't I start WSL2?

The problem is the WSL2 installation is not finished. I received the following message doing Step 5 - Set WSL 2 as your default version PS C:\WINDOWS\system32> wsl The service cannot be started, either because it is disabled or because it has no enabled devices associated with it.

Why is WSL--set-default-version 2 not working?

wsl --set-default-version 2 You might receive the following error: WSL 2 requires an update to its kernel component. If that is the case, Install Kernel Updates and run the wsl --set-default-version 2 command again. For any reason, if you don't want to use Windows

How do I upgrade to WSL 2 instead of WSL 1?

To ensure that all future WSL Linux distributions use WSL 2 instead of WSL 1, Open PowerShell as Administrator and run the following command: You might receive the following error: WSL 2 requires an update to its kernel component. If that is the case, Install Kernel Updates and run the wsl --set-default-version 2 command again.


2 Answers

I had the same issue

C:\WINDOWS\system32> wsl --set-default-version 2
The service cannot be started, either because it is disabled or because it has no enabled devices associated with it.

The problem was Kaspersky. The solution is simple Open cmd.exe and run the following code

sc config LxssManager start=auto

Kaspersky will give you a pop-up about a potential thread. Tell Kaspersky to ignore the alert. Please don't click on "Fix it" button for Kaspersky or you will undo the solution.

That should fix it

like image 164
Docans Avatar answered Oct 16 '22 19:10

Docans


Docans is right; running:

sc config LxssManager start=auto

in Command Prompt seems to fix the issue. However, you must run Command Prompt as an Administrator. I don't have enough reputation to comment or edit the post to clarify this so I have to make it a separate answer.

like image 1
Antonio Banderéz Avatar answered Oct 16 '22 17:10

Antonio Banderéz