VirtualBox conflicts with Hyper-V

I’ve been learning HarmonyOS development lately, and my dev machine has always run deepin. DevEco Studio doesn’t support Linux, and the win compatibility engine didn’t help either. So I had no choice but to install VirtualBox to run Win10.

Win10 installed fine in VirtualBox, but after launching DevEco Studio the VM kept saying Hyper-V was not enabled. It clearly was enabled though — so what now? Could VT-X and Hyper-V actually be in conflict? I dug around and found the fix.

  1. Shut down the Win10 VM and run this in a deepin terminal:

     VBoxManage modifyvm "VM name" --nested-hw-virt on
    
  1. Change the VM settings
  • Open the VirtualBox manager → select the Win10 VM → Settings → System → Acceleration:

    • Set Paravirtualization Interface to Hyper-V4;

    • Tick Enable Nested Paging;

    • Processor count ≥ 2 (if the physical CPU has enough cores).

  1. Enable Hyper-V inside Windows.
    1
    2
    3
    4
    5
    pushd "%~dp0"
    dir /b %SystemRoot%\servicing\Packages\*Hyper-V*.mum >hyper-v.txt
    for /f %%i in ('findstr /i . hyper-v.txt 2^>nul') do dism /online /norestart /add-package:"%SystemRoot%\servicing\Packages\%%i"
    del hyper-v.txt
    Dism /online /enable-feature /featurename:Microsoft-Hyper-V-All /LimitAccess /ALL
    Create a txt file in Windows yourself, paste the code in, rename the extension to bat and run it as administrator. Reboot when it’s done.