我的流浪汉昨晚工作得很好。我刚打开电脑,点击《流浪者》,这就是我得到的:

==> default: Clearing any previously set network interfaces...
==> default: Preparing network interfaces based on configuration...
    default: Adapter 1: nat
    default: Adapter 2: hostonly
==> default: Forwarding ports...
    default: 22 => 2222 (adapter 1)
==> default: Booting VM...
==> default: Waiting for machine to boot. This may take a few minutes...
    default: SSH address: 127.0.0.1:2222
    default: SSH username: vagrant
    default: SSH auth method: private key
    default: Error: Connection timeout. Retrying...
    default: Error: Connection timeout. Retrying...
    default: Error: Connection timeout. Retrying...
    default: Error: Connection timeout. Retrying...
    default: Error: Connection timeout. Retrying...
    default: Error: Connection timeout. Retrying...
    default: Error: Connection timeout. Retrying...
    default: Error: Connection timeout. Retrying...
    default: Error: Connection timeout. Retrying...
    default: Error: Connection timeout. Retrying...
    default: Error: Connection timeout. Retrying...
    default: Error: Connection timeout. Retrying...
    default: Error: Connection timeout. Retrying...

有人吃过这个吗?vagrant在网络上还没有被广泛报道,我也找不到发生这种情况的原因。


当前回答

对我有帮助的是在BIOS中启用虚拟化,因为机器无法启动。

其他回答

关闭虚拟机内部的iptables防火墙

我是这样解决的:

我在我的Vagrantfile中启用了GUI界面(这是配置文件) 我可以在Gui中使用标准用户名vagrant和密码vagrant登录运行中的虚拟机 我关闭了虚拟机内部运行的iptables防火墙

这解决了我的问题,我发现,防火墙阻止了来自本地网络的所有ip,如192.168.x。X和10.x.x.x

添加/etc/iptables规则。D /199-allow-wan允许wan的所有连接:

ip46tables -A wan-input -j ACCEPT

(ip46tables是一个别名)在我的Vagrant例子Freifunk社区中看到这个提交

我通过在/etc/fstab中添加一个新条目来测试我的vagrant VM中挂载的文件夹。后来我注销了,跑了个流浪汉,但当我跑了个流浪汉,我得到:

SSH auth method: private key
Warning: Remote connection disconnect. Retrying...

I read all these posts and tried all the ones that seemed relevant for my case (except for vagrant destroy, which would have certainly fixed my problem, but was a last resort in my case). The post by @Kiee gave me the idea to try to boot my VM directly from the VirtualBox GUI. During the boot process the VM halted itself and was asking me if I wanted to skip mounting the test folder that I had added earlier to /etc/fstab. (That's why vagrant couldn't boot the VM.) After answering 'NO' the VM booted no problem. I logged in, removed the naughty line from my fstab, and shutdown the VM.

在那之后,流浪汉就能很好地踢足球了。

外卖吗?如果突然间vagrant无法引导回您的VM,请尝试直接从提供商引导(在我的情况下是VirtualBox)。您的引导可能挂起了与SSH完全无关的东西。

如果你在Windows 8或Windows 10上工作,这对我来说很管用:

更改BIOS设置以允许64位虚拟化。 以下是如何做到的: 使用高级启动重启PC(进入高级启动-'立即重启'-'故障排除'-'高级选项'-' UEFI固件设置'-'重新启动') 在BIOS窗口内-转到“高级”菜单/选项卡-启用“英特尔虚拟技术” 保存并退出。

我也有同样的问题,但其他答案都不能完全解决我的问题。@Kiee的回答很有帮助,尽管我在GUI中看到的是一个黑屏(在左上角有下划线,虚拟盒子中的这个问题也在堆栈溢出中单独提出,同样没有帮助)。

最终,一个解决方案被证明非常简单:检查虚拟机的版本。

更准确地说,我从别人那里得到了一个64位Debian的盒子,但Virtual box坚持把它当作32位的,这一点我没有注意到。要更改它,请打开虚拟框,然后打开终端并运行

vagrant up

排队等候

default: SSH auth method: private key

现在您可以按ctrl+C(或等待超时)并运行

vagrant halt

你的虚拟机不会被摧毁,所以你可以在虚拟盒子的菜单中看到它,但它会被关闭,所以你可以更改设置。在菜单中选择您的机器,单击“设置”->“通用”,并选择适当的“版本”,对我来说是“Debian(64位)”。这种类型之后又流浪起来。

如果这是你的情况(或“设置”中的不同更改解决了你的问题),你可以从修复的输入中创建新框

vagrant package --output mynew.box

更多细节:主机32位Ubuntu 12.04,客户64位Debian 8.1, Virtual Box 5.0.14, Vagrant 1.8.1

我在《Vagrant 1.6.5》和《Virtual Box 4.3.16》中也遇到了同样的问题。 在https://github.com/mitchellh/vagrant/issues/4470上描述的解决方案对我来说很好,我只需要删除VirtualBox 4.3.16并安装旧版本4.3.12。