56

Today, I decided to upgrade from WSL 1 to WSL 2. On WSL 1, I had no issues getting both Kali Linux or Ubuntu to function on WSL 1. When upgrading to WSL 2, both Kali and Ubuntu failed to upgrade to version 2. I read that uninstalling and reinstalling them could fix this issue. However, upon reinstalling both of them, my system now fails to detect any installed distro, despite the distro's being installed. Launching both Kali or Ubuntu gives the same error.

Installing, this may take a few minutes...
WslRegisterDistribution failed with error: 0x80370102
Error: 0x80370102 The virtual machine could not be started because a required feature is not installed.

When researching this error, and from reading the official WSL 2 install guide from Microsoft, the error always seems to be because the system doesn't have virtualization enabled in the BIOS. This is really confusing as I have checked over 4 different times if I missed any virtualization setting in my BIOS, and have verified it is all enabled. I also have confirmed I have the NX feature enabled as well. Even HWiNFO detects I have virtualization enabled:

Screenshot of HWiNFO's results

I have also made sure that the Virtual Machine Platform, Windows Subsystem for Linux and the Windows Hypervisor Platform features are all enabled. Not only this, but I can also create and run any number of VMs from VirtualBox without any errors or issues whatsoever.

Other troubleshooting steps I have gone through was resetting the WSL service, reset my machine (multiple times), update the WSL kernel, verify my Win version is in 19041 or above, and waited 20 minutes after boot to see if I was just being impatient.

System information:

  • Running Windows 10 version 10.0.19041.388 (also known as SDK version 2004)
  • Ryzen 3900x CPU
  • 32GB DDR4 RAM
  • Asus Tuf Gaming X570-Plus motherboard w/ BIOS version 1407
7
  • Same here. Before that I was on a intel based conf. No pb.to install wsl (1 at that time) Of course you checked in your bios /advanced / cpu / that SVM mode was enabled? I hope someone has the answer.
    – mchko
    Aug 3, 2020 at 14:35
  • I checked my BIOS multiple times to verify the setting in on. This is definitely a weird issue. I'm thinking it's possibly a bug WSL 2 has with some AMD CPUs, but I can't find anything to verify that.
    – Blu
    Aug 3, 2020 at 14:51
  • 1
    WHAT WORKED FOR ME: I own an HP Z4 G4 Workstation and had to restart my computer and go into the BIOS menu to enable the virtualization on my CPU. I'd try searching "<your computer name> enable virtualization bios" on the web and following those instructions. After a restart and running this command, I was able to get the 'enter a new username/password' prompt
    – youngrrrr
    May 8, 2021 at 2:12
  • 2
    for me the following was the only solution (executing in PowerShell as admin): wsl --set-default-version 1 Jul 30, 2021 at 20:42
  • 1
    Thanks @HerpesFreeEngineer . I tried all the answers and this is the only thing that worked. Using fairly current AMD hardware on Windows 11.
    – Samaursa
    Jul 19, 2023 at 0:05

8 Answers 8

57

FIRST you need to make sure you have enabled CPU virtualization in your BIOS. These instructions will depend on your hardware.

For AMD CPUs, you will look for a feature called: "AMD (AMD Secure Virtual Machine, AMD SVM)"

For Intel CPUs, you will look for a feature called: "Intel (Intel Virtualization Technology, Intel VT-x)"

Here are the instructions for setting SVM on my computer. Note: this is for a MSI motherboard.

  1. Go to advanced settings.

  2. Go into the overclocking section.

  3. Go into the CPU Features section

  4. Toggle the CPU feature "SVM Mode" which enables CPU virtualization.

SECOND you are going to have to enable the Hyper-V Windows feature.

Here are my instructions (Note feel free to duckduckgo/google this separately):

  1. Search for "Windows Features" in your taskbar.

  2. Then look for "Hyper-V". Then enable it.

At this point you should be done and no longer get this error.

8
  • 3
    The issue I am having is that all of these steps have already been taken, and I have quadruple checked that each of those settings are enabled. I can run regular VMs through Vbox and VMware no issue. It's only WSL that refuses to work saying I don't have VM features enabled.
    – Blu
    Nov 18, 2020 at 16:30
  • 2
    Unfortunately this did not work for me. I still can't run Ubuntu 20.04 on Windows 10.
    – Ryan
    Jan 22, 2021 at 1:26
  • 5
    I didn't have a feature called "Hyper-V", but I had one called "Windows Hypervisor Platform", which mentioned virtualization. I enabled it, and it worked for me.
    – vallentin
    Feb 6, 2021 at 18:18
  • 2
    You're a lifesaver :) Apr 16, 2021 at 8:05
  • 1
    Thank you! This was exactly what I needed, I did not expect to find the virtualization settings in the "CPU overclocking" section of the BIOS! Jan 2, 2022 at 0:26
25

I fixed this problem by running the code below on the host and rebooting the system.

bcdedit /set hypervisorlaunchtype auto

You may also need to enable Nested Virtualization for the VM. Run this PowerShell script also from the host.

$VM = "Windows 11 dev environment"

# Shut down VM
Get-VM $VM | Stop-VM

# Set VM Memory to Static, Hyper-V inside the VM will not be able to adjust memory dynamically
Set-VMMemory -VMName $VM -DynamicMemoryEnabled $false

# Set VM Processor
Set-VMProcessor -VMName $VM -ExposeVirtualizationExtensions $true

# Enable MAC address spoofing. This allows the use of NAT switches
# and in the case of containerization, transparent networking
Get-VMNetworkAdapter -VMName $VM | Set-VMNetworkAdapter -MacAddressSpoofing on

#Start VM
Get-VM $VM | Start-VM

source: https://youtu.be/SQAY4kDShhg

5
  • 8
    Welcome to Ask Ubuntu, and thanks for your answer! In the future, an even more helpful answer would mention how you knew about this command (point to the docs where you found it), what the risks of running it are, and how to revert (if possible).
    – Ryan
    Jan 22, 2021 at 1:28
  • 2
    This fixed in PC with Windows 11
    – sainf
    Dec 9, 2021 at 21:55
  • 3
    This fixed the issue for me in Windows 11. I had all the checkboxes checked for the WSL requirements Jan 23, 2022 at 13:53
  • Thanks solved my issue, a quick question, in case I want to revert back this change how do you do this?
    – Hossein
    Apr 24, 2022 at 14:07
  • 1
    this is what worked to fix wsl and subsystem for android on windows 11
    – spider623
    Jul 30, 2022 at 19:01
11

It worked for me after I:

  • Disabled the "Virtual Machine Platform" feature
  • Restarted Windows
  • Re-enabled the "Virtual Machine Platform" feature
  • Restarted Windows once more

This is from the May 2020 release notes:

We are aware of an issue where using the DISM (Deployment Image Servicing and Management) tool to repair corruption on systems running the May 2020 Update does not always report the correct status. This will be fixed in an upcoming servicing release.

It seems that Dism has trouble determining whether a feature is really enabled, so you may need to try several times until it works.

I found the solution on GitHub, and some of the information in this answer was taken from there. It was challenging for me to find a solution, so I'm adding this information here for others who may be struggling with the same issue.

7
  • Thank you for your contribution! Please consider editing your answer and explaining a little bit what this solution is, how you implemented it and what users should expect and try when browsing that link.
    – Pizza
    Sep 26, 2020 at 18:44
  • 1
    If you're wondering how to get "Virtual Machine Platform" disabled (and then enabled again) as described above, go to the control panel and search for "Turn Windows features on or off" and scroll down in the window that opens to "Virtual Machine Platform". Oct 9, 2020 at 21:21
  • Unfortunately this did not work for me. I still can't run Ubuntu 20.04 on Windows 10.
    – Ryan
    Jan 22, 2021 at 1:26
  • 1
    +1 - disabling and re-enabling w/ reboots did the trick. Not sure if relevant, but I also enabled virtualization in the bios after disabling the "VMP"; and then re-enabling "VMP" / rebooting. Jul 26, 2021 at 14:56
  • My hack is similar. I disabled the "Virtual Technology" feature; Restarted Windows; Re-enabled the "Virtual Technology" feature; Restarted Windows.
    – sirius
    Jan 13, 2023 at 14:07
7

I had the same error and with the virtualization enabled too. After uncheck Windows Subsystem for Linux, Windows Hypervisor Platform and Virtual Machine Platform, restarting the pc and enable them again the error disapeared and I could install WSL 2.

2

I had been trying for months to get WSL 2 working. Upgrading my existing "Ubuntu" installation from WSL 1 never worked.

  1. Finally, I uninstalled my existing "Ubuntu" (as in not "Ubuntu 20.04") installation, which I'd installed from the Microsoft store.
  2. I installed the Ubuntu 20.04 app from the Microsoft store.
  3. I confirmed that all 4 of the Hyper-V requirements said Yes.
  4. I confirmed that my (ASRock) BIOS had "Intel Virtualization Technology" = Enabled and "No-Execute Memory Protection" = Enabled.
  5. In Windows > Control Panel > Programs > "Turn Windows features on or off", I confirmed that I'd already checked (enabled) "Hyper-V" and "Windows Hypervisor Platform" and "Windows Subsystem for Linux".
  6. The key for me was to uncheck "Virtual Machine Platform", which I tried because of this answer. Because of that answer, I was planning to re-enable it after restarting (which I'd already tried unsuccessfully months ago), but luckily I felt inspired to try opening the Ubuntu 20.04 app, and it worked! ("Virtual Machine Platform" remains disabled.)
  7. UPDATE: Oops, I prematurely declared success. The next problem I had was that I couldn't connect to the internet from within WSL 2 Ubuntu 20.04. So then I did need to re-enable "Virtual Machine Platform". And then more steps were necessary: sudo rm /etc/resolv.conf && sudo bash -c 'echo "nameserver 8.8.8.8" > /etc/resolv.conf' && sudo chattr +i /etc/resolv.conf (from https://github.com/microsoft/WSL/issues/4844#issuecomment-765248581) was hugely helpful (because https://github.com/microsoft/WSL/issues/5336#issuecomment-653881695 didn't quite work, and that file and kept getting overwritten).

Bryan's answer was similar but required uninstalling / unchecking even more.

1
  • 2
    Uncheck "Virtual Machine Platform" did it for me as well after hours of trying to figure it out. Thank you so much! Mar 26, 2022 at 15:31
1

you have to enable virtualisation in BIOS. There is no other way. I spent 2 hours with MS adviser on it. We done everything and ended with no success. I saw somewhere later that BIOS setting advice. It works! Virtualisation is disabled there. Once enabled Ubuntu works.

2
  • 1
    I actually already have that setting enabled. Like I said in the post, I already checked to make sure virtualization is enabled in my BIOS, and even had a piece of software triple-check to verify it can detect virtualization is enabled.
    – Blu
    Aug 9, 2020 at 1:21
  • This solved it for me. Upvoting as it is nonobvious.
    – Anakhand
    Oct 25, 2020 at 9:03
0

Oh! I found it. In "add / remove functionnalities", you have Hyper-V and something else about virtualization. That one was missing. I only have the french translation of this func. so giving it to you won't probably help. Look for the entire list and double-check. Actually hyper-v is not required. Debian up and running.

2
  • 1
    I tried your method and it still won't function. There are only 2 options I can see which is the Hyper-V feature, and the Virtual Machine Platform feature. The VMP feature is requires for WSL to function. Altho, weirdly enough, Powershell now tells me I need ot enable virtualization in my BIOS and enable the VMP feature. Both of which are enabled.
    – Blu
    Aug 3, 2020 at 15:38
  • I can verify that Hyper-V is not required for WSL 2. Although adding this does fix the problem for some people I have run WSL through several restarts without Hyper-V enabled. This seems to be a bug on the Windows end.
    – haleonj
    Dec 9, 2022 at 16:12
0

Today, while I reinstated Windows 11, I ran into that issue, which was ode because it was working right before.

With only Windows Subsystem for Linux features activated, no need Hyper-V...

I resolved it by doing an update: wsl --update

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .