0

I'm using Windows 11 on VirtualBox 6.1.30, inside Windows 11 on a Core m3-6Y30 CPU @ 0.90GHz.

I downloaded Ubuntu 20.04 from the Microsoft Store. When I started it, a message appeared that the option called Windows Subsystem for Linux should be enabled in the Control Panel in Windows Features.

I turned on that feature, restarted the computer, and attempted to start WSL Ubuntu again. This time there was a message to update to WSL2.

So in PowerShell with admin privileges I entered the command:

dism.exe / online / enable-feature / featurename command: VirtualMachinePlatform / all / norestart

... then restarted the computer and downloaded the kernel update package mentioned here.

Finally, in PowerShell with admin rights I ran the recommended command:

wsl --set-default-version 2

After that, I restarted my computer and started Ubuntu on WSL and got the "Error 0x80370102" mentioned in this question.

It only worked after I ran wsl --set-default-version 1 .

What can it be? Something wrong with hardware virtualization?

Everything else works on VirtualBox.

I started with the command wsl --set-default-version 1, then I checked the bcdedit / set hypervisorlaunchtype auto, but it didn't work.

Only after that did wsl --set-default-version 1 work.

NotTheDr01ds
  • 15,380
  • 6
  • 51
  • 79
P.Bak
  • 43
  • 1
  • 2
  • 8
  • 1
    I think you have taken some improper actions and some are out of order. Please edit your question answering the following: What version of Windows 10 are you running? What guides have you been following for these actions that you took? Did you actually update to WSL2 as indicated? Did you try to remove/uninstall Ubuntu so that you can reinstall it after ensuring that WSL2 is installed on your system? – Nmath Dec 18 '21 at 20:23
  • I am using windows 11 on virtualbox. When it comes to solving this problem, I used only this guide, which is mentioned here https://askubuntu.com/questions/1264102/wsl-2-wont-run-ubuntu-error-0x80370102. When it comes to wsl, how do I check which version I'm using? I have not tried to remove or uninstall ubuntu. How to check wsl versions? – P.Bak Dec 18 '21 at 20:58
  • I ran the command '' wslfetch`` on virtualbox but I don't know if it will do anything? [1]: https://i.stack.imgur.com/ifyTA.png – P.Bak Dec 18 '21 at 21:06
  • 1
    I've made some extensive edits to your question to attempt to make it more readable. Please let me know I got anything wrong there. I did not change one thing that might have needed to be fixed. You say you ran the command `dism.exe / online / enable-feature / featurename command: VirtualMachinePlatform / all / norestart`, but that's clearly a bad command (either lots of typos or you re-typed it wrong). It should be `dism.exe /online /enable-feature /featurename:VirtualMachinePlatform /all /norestart`. Could you also confirm that you ran the correct command? – NotTheDr01ds Dec 18 '21 at 22:05
  • Also note that on Windows 11, the standard way of installing/enabling WSL2 is simply `wsl --install`. This will enable both WSL2 and WSL1. It will also install and configure an Ubuntu 20.04 instance -- All with the one command. No need for all the other, old "manual" steps unless something does go wrong with `wsl --install`. – NotTheDr01ds Dec 18 '21 at 22:35
  • So what do you recommend doing? Uninstall wsl and install using powershella with wsl admin privileges using ```wsl --install```? – P.Bak Dec 20 '21 at 13:17

1 Answers1

2

Given what we've discussed in the comments, my personal recommendation would be to stick with WSL1. It covers most of the use-cases of WSL2 by creating a "translation layer" between calls to the Linux kernel API and that of the Windows kernel. WSL2 does go (at least) one step further with virtualization, but that only works well on supported hardware.

As for WSL2, it's possible that you may have more than one problem, but at least one possibility is that you need to enable "Nested Virtualization" in VirtualBox.

WSL2 uses features of the Windows Hyper-V hypervisor to create a virtual machine. Since you are already running Windows 11 in a VirtualBox VM, that means you are "running a VM inside a VM" -- That's "nested virtualization".

Support for this feature was, I believe, added starting with VirtualBox 6.1.4, but you do have to enable it. See this doc page for full details, but to summarize:

  • If you are using the VirtualBox Manager GUI, go to the Processor tab and turn on Enable Nested VT-x/AMD-V. Note, as we learned in the comments, that option is grayed out on your VM since your CPU (Core m3-6Y30) doesn't support hardware-based virtualization.

  • As an alternative, you should be able to set the option from the command-line using VBoxManage modifyvm vm-name --nested-hw-virt on. This will reportedly "force" virtualization even on unsupported hardware (but I cannot confirm). Note that, from a comment on this answer, "performance is expected to be abysmal" if your CPU does not support the necessary features.

NotTheDr01ds
  • 15,380
  • 6
  • 51
  • 79
  • I would like to turn on what you are talking about, but the feature is turned off (I cannot select this option)[1]: https://i.stack.imgur.com/9auEm.png. How can i turn it on? – P.Bak Dec 20 '21 at 13:23
  • @P.Bak Well, for starters, we now know that it's off, so that's (at least one reason) why you aren't able to enable WSL2. What version of VirtualBox are you using? [This SO post](https://stackoverflow.com/q/54251855/11810933) mentions that it *was* (or maybe *is*) only available for AMD, but I think that's outdated info. According to that latest page that I linked, it should be able for Intel as well, but that may require a later version. Also see the top-voted answer there that mentions how to enable it from the command-line even if grayed out in the GUI, although note performance issues. – NotTheDr01ds Dec 20 '21 at 15:19
  • the current version I'm using is virtualbox 6.1.30 – P.Bak Dec 20 '21 at 16:09
  • @P.Bak So it should be there, assuming that your hardware supports it. We haven't covered one of the basics, like what's the OS you are running VirtualBox under. The directions for checking whether you support hardware-based virtualization will depend on the top-level OS. Did you try `VBoxManage modifyvm vm-name --nested-hw-virt on`? Again, that is reported to work (but slower) even if the main system doesn't support virtualization. – NotTheDr01ds Dec 20 '21 at 16:59
  • 1
    My operating system is windows 11. It runs on unsupported hardware. I have an Intel® Core ™ m3-6Y30 CPU @ 0.90GHz processor. The solution you mention ```VBoxManage modifyvm vm-name --nested-hw-virt on``` I haven't checked yet. – P.Bak Dec 20 '21 at 17:14
  • So that there was clarity of the situation. Do you recommend using this ```VBoxManage modifyvm vm-name --nested-hw-virt on``` command? – P.Bak Dec 21 '21 at 11:45
  • @P.Bak Well, you are attempting to run a Linux VM (WSL2) *inside* a Windows 11 VM (on VirtualBox) *insider* Windows 11, on a CPU that doesn't support hardware-based virtualization in the first place. If you *really* need to run WSL2 there (and still no guarantee it will work) then yes, I would recommend trying to "force" the nested virtualization via that command. Being a VM, there's no harm in it, right? I can only imagine that, if it works, it's going to be unbearably slow, but I can't speak from experience. Best of luck, though! – NotTheDr01ds Dec 22 '21 at 13:55
  • I mean, as a beginner, I do not need wsl2, but just when I download ubuntu from the microsoft store, it reports an error that I do not have wsl2 – P.Bak Jan 18 '22 at 12:57
  • but overall performance will drop in physical or virtual machine? – P.Bak Jan 18 '22 at 12:59
  • @P.Bak Well, you *cannot* run WSL2 on *your* physical machine, because your CPU doesn't support hardware virtualization. **If** you are able to "force" the virtualization in VirtualBox, we expect the performance would be abysmal, because *every* virtualization operation would be done in software rather than hardware. – NotTheDr01ds Jan 18 '22 at 15:04
  • ok I understand. and whether these changes that I described in this post to run wsl on virtualbox can be. Well, because if something works for me, I would not want to touch it. It adheres to the principle of "if something works, don't move", and this post is for it because I wanted to get mainly the reasons for solving this problem. – P.Bak Jan 19 '22 at 16:43