Vagrant无法启动ubuntu/vivid32。 在启动过程中,Vagrant尝试多次连接,最终超时。 如果我通过VirtualBox管理器连接到虚拟机,ifconfig会显示eth0已启动,但没有分配IP地址。 然后我执行
sudo ifdown eth0 && sudo ifup eth0
之后,使用ifconfig命令可以看到eth0有一个IP地址。 然后我可以用vagrant ssh在vagrant中连接。 如果我通过VirtualBox管理器关闭并重新启动虚拟机,虚拟机会正常启动(带有IP地址),并且vagrant也可以通过vagrant ssh连接。 但是,如果我通过vagrant命令行关机(vagrant halt)并重新启动虚拟机(vagrant up),我会遇到相同的问题(vagrant端超时并且没有IP地址),无法通过vagrant ssh连接虚拟机。 在vagrant尝试连接时,虚拟机会显示:
cloud-init-nonet[4.54]: waiting 10 seconds for network device
cloud-init-nonet[14.57]: waiting 120 seconds for network device
cloud-init-nonet[134.57]: gave up waiting for a network device
我在客户端尝试了几种方案,例如这个,但是无论我尝试了什么,在vagrant端都没有帮助。
在固定客户端IP地址后,VirtualBox管理器可以将虚拟机启动,并且多次启动也没有问题。 但是,如果我通过vagrant(vagrant halt)关闭并重新打开(vagrant up),我会遇到相同的超时问题,并且无法通过vagrant ssh连接到虚拟机。 我怀疑“vagrant up”会清除网络接口并重新设置它,这个过程中会导致问题再次出现。
(这个问题也会出现在客户端:ubuntu/trusty32上)
f:\Programs\HashiCorp\Vagrant\bin>vagrant up
Bringing machine 'vivid32' up with 'virtualbox' provider...
==> vivid32: Checking if box 'ubuntu/vivid32' is up to date...
==> vivid32: Clearing any previously set forwarded ports...
==> vivid32: Clearing any previously set network interfaces...
==> vivid32: Preparing network interfaces based on configuration...
vivid32: Adapter 1: nat
==> vivid32: Forwarding ports...
vivid32: 22 => 2222 (adapter 1)
==> vivid32: Booting VM...
==> vivid32: Waiting for machine to boot. This may take a few minutes...
vivid32: SSH address: 127.0.0.1:2222
vivid32: SSH username: vagrant
vivid32: SSH auth method: private key
vivid32: Warning: Connection timeout. Retrying...
vivid32: Warning: Connection timeout. Retrying...
...
vivid32: Warning: Connection timeout. Retrying...
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.
- Vagrant 1.7.4
- VirtualBox - VirtualBox-5.0.0-101573
- 主机 - Windows Vista
- 客户机 - ubuntu/vivid32