K162

Starwalker, Stardust.

0%

vagrant up 后虚拟机无响应

Windows 环境下,在 powershell 中执行 vagrant up 后,虚拟机启动发生异常,久久没有响应。

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
PS C:\Andromeda\Homestead> vagrant up
Bringing machine 'homestead-7' up with 'virtualbox' provider...
==> homestead-7: Checking if box 'andromeda/homestead' is up to date...
==> homestead-7: Clearing any previously set forwarded ports...
==> homestead-7: Clearing any previously set network interfaces...
==> homestead-7: Preparing network interfaces based on configuration...
homestead-7: Adapter 1: nat
homestead-7: Adapter 2: hostonly
==> homestead-7: Forwarding ports...
homestead-7: 80 (guest) => 8000 (host) (adapter 1)
homestead-7: 443 (guest) => 44300 (host) (adapter 1)
homestead-7: 3306 (guest) => 33060 (host) (adapter 1)
homestead-7: 4040 (guest) => 4040 (host) (adapter 1)
homestead-7: 5432 (guest) => 54320 (host) (adapter 1)
homestead-7: 8025 (guest) => 8025 (host) (adapter 1)
homestead-7: 27017 (guest) => 27017 (host) (adapter 1)
homestead-7: 22 (guest) => 2333 (host) (adapter 1)
==> homestead-7: Running 'pre-boot' VM customizations...
==> homestead-7: Booting VM...
==> homestead-7: Waiting for machine to boot. This may take a few minutes...
homestead-7: SSH address: 127.0.0.1:2333
homestead-7: SSH username: vagrant
homestead-7: SSH auth method: private key
...

等待数分钟之后,提示 Timed out:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
Timed out while waiting for the machine to boot. This means that
Vagrant was unable to communicate with the guest machine within
the configured ("config.vm.boot_timeout" value) time period.

If you look above, you should be able to see the error(s) that
Vagrant had when attempting to connect to the machine. These errors
are usually good hints as to what may be wrong.

If you're using a custom box, make sure that networking is properly
working and you're able to connect to the machine. It is a common
problem that networking isn't setup properly in these boxes.
Verify that authentication configurations are also setup properly,
as well.

If the box appears to be booting properly, you may want to increase
the timeout ("config.vm.boot_timeout") value.

参考 StackOverflow 上的讨论1,BrianC 给出方案说,可尝试开启 GUI 模式,以此来更好地追踪错误。具体做法就是在 Vagrantfile 中取消下面这段配置的注释:

1
2
3
config.vm.provider "virtualbox" do |vb|
vb.gui = true
end

如果文件中原先就没有的话,可直接在 Vagrantfile 写入这段配置,然后重新尝试 vagrant up,得到提示:

VT-x/AMD-V 硬件加速在您的系统中不可用。您的 64-位虚拟机将无法检测到 64-位处理器,从而无法启动。

看来,可能是主板的 BIOS 设置中,没有开启虚拟化支持。

参考链接

[1] Vagrant up timeout - StackOverflow