执行vagrant up启动虚拟机时遇VT-x相关错误求助
Vagrant启动虚拟机报错(VERR_VMX_MSR_ALL_VMX_DISABLED)解决方法
报错信息
vagrant up Bringing machine 'default' up with 'virtualbox' provider... ==> default: Checking if box 'ubuntu/focal64' version '20220804.0.0' is up to date.. ==> default: Clearing any previously set forwarded ports.. ==> default: Clearing any previously set network interfaces... ==> default: Preparing network interfaces based on configuration... default: Adapter 1: nat ==> default: Forwarding ports... default: 22 (guest) => 2222 (host) (adapter 1) ==> default: Running pre-boot' VM customizations.. ==> default: Booting VM... There was an error while executing 'VBoxManage', CLI used by Vagrant for controlling VirtualBox. The command and stderr is shown below. Command: ['startvm', "fOf87cbc-9f24-409f-b1b7-a105544a838c", "--type", "headless"] Stderr: VBoxManage.exe: error: Not in hypervisor partition (HVP=0 (VERR_NEM_NOT_AVAILABLE). VBoxManage.exe: error: VT-x is disabled in the BIOS for all CPU modes (VERR_VMX_MSR_ALL_VMX_DISABLED) VBoxManage.exe: error: Details: code E_FAIL (0x80004005), component ConsoleWrap, interface IConsole
解决步骤
启用BIOS/UEFI虚拟化功能
- 重启电脑,开机时按对应按键进入BIOS/UEFI(戴尔F2、惠普F10、联想F1/F2、华硕Del等,参考开机屏幕提示)。
- 找到虚拟化相关选项,如Intel Virtualization Technology (VT-x)、AMD-V或SVM Mode,设置为
Enabled。 - 保存设置并重启电脑。
关闭Windows Hyper-V(Windows系统适用)
- 图形界面方式:打开「控制面板」→「程序」→「程序和功能」→「启用或关闭Windows功能」,取消勾选Hyper-V,确认后重启电脑。
- 命令行方式:以管理员身份打开命令提示符,执行:
执行完成后重启电脑。bcdedit /set hypervisorlaunchtype off
检查VirtualBox加速设置
- 打开VirtualBox,点击「全局设置」→「系统」→「加速」,确认启用VT-x/AMD-V和启用嵌套分页已勾选。
- 针对目标虚拟机:选中虚拟机→「设置」→「系统」→「加速」,确认上述选项已勾选。
重新启动虚拟机
返回命令行,执行以下命令重试:vagrant reload或直接重新执行:
vagrant up
内容的提问来源于stack exchange,提问作者dbnick1
相关产品推荐
相关产品推荐

