在Windows 10上的VirtualBox 6.x中运行64位虚拟机是已知的问题。
罪魁祸首是Windows Defender Application/Device Guard。
要禁用它,请前往本地组策略编辑器(Win+R->gpedit.msc)并禁用“打开基于虚拟化的安全性”。
Local Computer Policy > Computer Configuration > Administrative Templates > System > Device Guard > Turn on Virtualization Based Security
然后您需要以管理员身份在命令行中运行以下命令:
mountvol X: /s
copy %WINDIR%\System32\SecConfig.efi X:\EFI\Microsoft\Boot\SecConfig.efi /Y
bcdedit /create {0cb3b571-2f2e-4343-a879-d86a476d7215} /d "DebugTool" /application osloader
bcdedit /set {0cb3b571-2f2e-4343-a879-d86a476d7215} path "\EFI\Microsoft\Boot\SecConfig.efi"
bcdedit /set {bootmgr} bootsequence {0cb3b571-2f2e-4343-a879-d86a476d7215}
bcdedit /set {0cb3b571-2f2e-4343-a879-d86a476d7215} loadoptions DISABLE-LSA-ISO,DISABLE-VBS
bcdedit /set {0cb3b571-2f2e-4343-a879-d86a476d7215} device partition=X:
mountvol X: /d
X:代表你未使用的驱动器号(可以是任何其他驱动器号)
重新启动计算机,按F3确认禁用设备保护和基于虚拟化的安全性。 之后,您的虚拟机将再次正常工作。
另一种禁用设备保护的方法是使用PowerShell脚本。
从Microsoft下载脚本:https://www.microsoft.com/en-us/download/details.aspx?id=53337
以管理员身份运行脚本:
.\DG_Readiness.ps1 –Disable -AutoReboot
在BIOS时间启用虚拟化
通过设置禁用Hyper-V角色(我遇到的问题)
右键单击Windows按钮,选择“应用程序和功能”。
在相关设置下,在右侧选择“程序和功能”。
选择“打开或关闭Windows功能”。
选择Hyper-V并将其禁用。
a)Right click on the Windows button and select ‘Apps and Features’.
b)Select Programs and Features on the right under related settings.
c)Select Turn Windows Features on or off.
d)Select Hyper-V and disable it
bcdedit /set hypervisorlaunchtype off
并重新启动您的计算机。要再次打开它,请运行:
bcdedit /set hypervisorlaunchtype on
bcdedit /set hypervisorlaunchtype auto
重要提示:在关闭虚拟化程序并重新启动系统后,必须开启虚拟化程序,因为没有虚拟化程序,您无法在Windows上使用git存储库。
有用的页面 我的电脑是Windows 10,只需在BIOS时间内启用默认情况下“禁用”的2个虚拟选项即可顺利运行。
谢谢。