流浪超时

Don*_*ito 26 virtualbox timeout vagrant vagrantfile

有一些问题让我的流浪汉,得到了框,运行vagrant initvagrant up命令后我得到这个消息.

Bringing machine 'default' up with 'virtualbox' provider...
    ==> default: Importing base box 'precise32'...
    ==> default: Matching MAC address for NAT networking...
    ==> default: Setting the name of the VM: virtm_default_1400193131859_61200
    ==> default: Fixed port collision for 22 => 2222. Now on port 2201.
    ==> default: Clearing any previously set network interfaces...
    ==> default: Preparing network interfaces based on configuration...
        default: Adapter 1: nat
    ==> default: Forwarding ports...
        default: 22 => 2201 (adapter 1)
    ==> default: Booting VM...
    ==> default: Waiting for machine to boot. This may take a few minutes...
        default: SSH address: 127.0.0.1:2201
        default: SSH username: vagrant
        default: SSH auth method: private key 
    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.
Run Code Online (Sandbox Code Playgroud)

有什么建议?

Bri*_*anC 17

有几个不同的问题可能导致此超时问题.跟踪它的一个好方法是启用GUI模式.这将打开VirtualBox机器UI,它可以提供更好的线索来解决问题.

要启用GUI模式,请确保Vagrantfile取消注释您的此部分:

config.vm.provider "virtualbox" do |vb|
   vb.gui = true
end
Run Code Online (Sandbox Code Playgroud)

然后做一个vagrant reload.这应该会显示VirtualBox应用程序,显示您的虚拟机UI.通常问题将变得明显,无论是网络问题还是grub引导加载程序问题.

解决问题后,您可以再次对此进行评论,然后再做一次vagrant reload以返回无头模式.

参考:Vagrant docs

  • 谢谢.在我的例子中,VM被卡在引导程序(grub)中,等待ENTER键.我使用默认的`hashicorp/precise32`.我用GUI启动了机器,然后运行`sudo grub-mkconfig`来重置`/ boot/grub/grub.cfg`文件,然后我可以回复`vb.gui = true`行. (2认同)
  • @maggix这与我遇到的问题相同;我不是100%肯定,但是我认为在先前“无用停止”之后启动VM时会发生这种情况。现在我进行更清洁的关机,例如:`vagrant ssh -c'sudo shutdown -h now'` (2认同)

fka*_*lis 5

这里优雅地描述一个解决方案。它是唯一一个在 i686 上对我有用的 Ubuntu 16.04.2、Vagrant 1.9.3 和 Virtualbox 5.1.18 试图运行 ubuntu/trusty32。

您要做的是修复服务器上的网络并为启动添加一些额外的时间:

现在停止虚拟机。下次你做一个“流浪者”的时候就可以了。