【发布时间】:2020-08-21 03:27:57
【问题描述】:
机器:Window10(64 位)。
我下载了最新的 VirtualBox、Vagrant 并初始化了 CentOS 6.7 64bit image/url。
以下在 Git-Bash 会话中成功运行。
1. vagrant box 添加 "centos67x64" "https://github.com/CommanderK5/packer-centos-template/releases/download/0.6.7/vagrant-centos-6.7.box"
2. 流浪初始化
3. 更新了 Vagrantfile(并打开了 vb.gui 选项,即取消注释文件中的配置部分)。
config.vm.provider "virtualbox" do |vb|
# Display the VirtualBox GUI when booting the machine
vb.gui = true
# Customize the amount of memory on the VM:
vb.memory = "2048"
end
之后,我尝试了以下命令,但收到此错误消息。
$ vagrant up
Bringing machine 'default' up with 'virtualbox' provider...
==> default: Importing base box 'centos67x64'...
==> default: Matching MAC address for NAT networking...
==> default: Setting the name of the VM: vv_default_1466548735200_80300
==> 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`, a CLI used by Vagrant
for controlling VirtualBox. The command and stderr is shown below.
Command: ["startvm", "ae74ebaa-8f01-48cf-bdad-956c59ef1208", "--type", "gui"]
Stderr: VBoxManage.exe: error: VT-x is not available (VERR_VMX_NO_VMX)
VBoxManage.exe: error: Details: code E_FAIL (0x80004005), component ConsoleWrap, interface IConsole
如果我关闭/评论整个 Vagrantfile 相应部分,我仍然会收到以下错误。
$ vagrant up
Bringing machine 'default' up with 'virtualbox' provider...
==> 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`, a CLI used by Vagrant
for controlling VirtualBox. The command and stderr is shown below.
Command: ["startvm", "ae74ebaa-8f01-48cf-bdad-956c59ef1208", "--type", "headless"]
Stderr: VBoxManage.exe: error: VT-x is not available (VERR_VMX_NO_VMX)
VBoxManage.exe: error: Details: code E_FAIL (0x80004005), component ConsoleWrap, interface IConsole
任何想法!我查看了其他帖子,但在我的情况下找不到解决方法。
当我得到一些提示时,我尝试了一种解决方案。
- 关闭我猜在 Windows10 中默认关闭的 Hyper-V。
然后,我通过取消选中(勾选标记或黑框)关闭了 Hyper-V。
- Windows10 告诉我要重新启动,我说“不”(稍后)。
尝试再次运行“vagrant up”(没有或没有任何更改或上述 config.vm... 对 Vagrantfile 的更改)。它不起作用,并给了我相同的 --headless 错误消息。
好的,该重启了。重新启动Windows10。重启后,我看到一堆Virtual Box的错误信息弹出(下面显示的很少)。
- 在所有这些 Virtual Box 弹出窗口上单击“确定”按钮后,我尝试在我的机器上运行 Virtual Box,它运行良好(成功)。
- 现在,我打开 Git-BASH 并再次进入 Vagrantfile 所在的目录。尝试调整设置打开/关闭或评论/取消评论 Vagrantfile 相应部分(如上所述)。
仍然在运行“vagrant up”时收到相同的错误消息(即使在关闭 Hyper-V 之后也是如此)。
【问题讨论】:
-
你停止了 hyper-v 吗?
-
不,我没有。在我的 Windows7 机器上,我没有执行该步骤。在 Windos10(我收到此消息的地方)上,这是 Vagrant 的先决条件吗?不确定他们列出图像框的网站或部分是否提到了这部分。 vagrantbox.es
-
是的,那是因为 Windows 7 没有安装 hyper-v。以下是此线程中的更多信息:social.technet.microsoft.com/Forums/windows/en-US/…
-
好的,我取消选中 Hyper-V 的复选框。我真的需要重新启动我的机器吗(即使在取消选中过程应用了更改之后)。接下来我会这样做。我希望在此之后 vb.gui 和 vb.memory 都应该工作,对吧?
-
是的,我记得我必须重新启动我的 win 服务器才能使其生效。
标签: vagrant windows-10 virtualbox vagrantfile headless