我在同事申请的一台机器上安装Vagrant box,结果vagrant up
失败,报如下错误:
The guest machine entered an invalid state while waiting for it to boot. Valid states are 'starting, running'. The machine is in the 'poweroff' state. Please verify everything is configured properly and try again. If the provider you're using has a GUI that comes with it, it is often helpful to open that and watch the machine, since the GUI often has more helpful error messages than Vagrant can retrieve. For example, if you're using VirtualBox, run `vagrant up` while the VirtualBox GUI is open.
打开VirtualBox界面,重新执行vagrant up
,然后在VirtualBox里获取日志,显示如下错误:
Failed toopen a session for the virtual machine XXXXXXXXXXXXXXXX.VT-x is not available.(VERR_VMX_NO_VMX).
对于64位虚拟机,没有VT扩展的话,Virtualbox不支持64位客户机。解决方案是在BIOS使能Intel虚拟技术(VT-X)。 如果宿主机不支持VT-X,网上有一个解决方案(未经本人验证):
config.vm.provider :virtualbox do |vb|
vb.customize ["modifyvm", :id, "--hwvirtex", "off"]
end
其作用等同于VirtualBox的vbox配置文件中的: 此外如果vagrant内部出现问题,一个很好的调试方法是:
VAGRANT_LOG=debug
vagrant up
参考
Guest Machine Entered Invalid State #220
Vagrant Up Error In Headless Ubuntu: The guest machine entered an invalid state while waiting for it to boot
Error VT-x not available for Vagrant machine inside Virtualbox
Vagrant › VT-x is not available.
Enabling Intel VT-x and AMD-V virtualization hardware extensions in BIOS
Disable VT-X in Vagrantfile