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

==> 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中是否启用了硬件虚拟化。

我的问题是相同的超时字符串,但我只能在GUI中看到黑屏。

我刚刚安装的一台笔记本电脑一直显示同样的问题。经过几个小时的搜索,我终于找到了一个提示,看看BIOS是否启用了硬件虚拟化。

以下是我找到的帖子内容:

我发现仍然有一些用户遇到了这个问题。因此,我将尝试在下面总结一些可能的解决SSH超时问题的方法:

Make sure your firewall or antivirus is not blocking the program (which I doubt will happen often) Give your vagrant machine some time for timeouts to happen. If you dont have a very fast PC / Mac, the VM will take while to boot into an SSH ready state, so timeouts will happen. Therefore, first try to let vagrant timeout COMPLETELY before concluding that there is a fault. If vagrant times out completely then increase the timeout limit in the vagrant file to a few min and try again. If that still doesnt work, then try to clean boot your vagrant machine through the VirtualBox interface and enable the GUI of the machine beforehand. If the GUI doesn't show anything happening (ie. just blackscreen, no text) while it is booting, then your vagrant machine has got problems. Destroy the entire machine through the VB interface and reinstall. Delete the ubuntu image files in the Vagrant Images folder in the user folder and redownload and install. Do you even have an intel processor that supports 64bit hardware virtualisation? Google it. If you do, make sure there is no setting in your Bios disabling this feature. Disable hyper-v feature if you are running windows 7 or 8. Google how to disable. Make sure you are running through an SSH enabled client. Use Git bash. Download: http://git-scm.com/downloads Install a 32bit version of ubuntu like trusty32 or precise32. Just change the version in the vagrant file and reinstall vagrant in new directory. Make sure you are using the latest vagrant and virtualbox versions. Last resorts: Format your computer, reinstall windows and buy an intel core isomething processor.

希望这能有所帮助。

其他回答

将ubuntu32位安装到AMD64位上就成功了。我无法访问BIOs,因为它是一个受限制的环境,但我仍然能够让它与ubuntu/trusty32而不是ubuntu/trusty64一起工作

在Windows 7 SP1上使用Vagrant 1.6.3和VirtualBox 4.3.15

希望这能有所帮助。

我也遇到过同样的问题。我通过在BIOS设置中启用虚拟化来解决这个问题。

我分享这些只是为了将来能帮助到其他人。上面的Rubo77给了我这个答案的灵感。

在我的流浪文件中取消注释两行后,我遇到了这个连接超时循环。

vb.gui="true"
config.vm.network "forwarded_port", guest: 80, host: 8080

显然,第一行出现的GUI会询问你是想跳过安装还是让vagrant手动安装。我把它注释回来后就可以登录了,但是我仍然可以看到“连接中断”。在终点站重试。

于是我钻进我的“流浪汉”,敲了字。

sudo iptables -A INPUT -m conntrack --ctstate ESTABLISHED,RELATED -j ACCEPT

然后流浪汉重新加载,并没有遇到任何连接错误。然而,这并不接受所有传入的流量。所以你可能想要添加规则,只允许端口8080,如果你要长时间使用你的bos。

Digital Ocean提供了一个很好的教程,教你如何在iptables中添加规则。

记住安装iptables-persistent来保存防火墙配置

就像有些人已经指出的那样,如果VirtualBox映像没有正确引导,就会出现错误。对我来说,在《Vagrant》中使用GUI模式并没有太大帮助,因为它只显示一个黑色窗口。在virtualbox GUI中,我检查了虚拟机的设置,发现操作系统设置不正确(Debian 32而不是64位)。

所以我只能建议手动检查虚拟机的VirtualBox设置,让虚拟机启动,而不是首先使用Vagrant。

My solution turned out to be none of the above exactly. I'm running Ubuntu 14 as guest inside a Windows 7 host. I had been running this vagrant box fine, but I started it up again after not using it for a couple of months, and it kept coming up with the SSH connection timeout. It turned out that somehow the key pair didn't work - so I copied the Vagrant public key into Ubuntu according to the instructions on this page. But that wasn't all. I then discovered that the private key in my base box was different than the private key here. Putting this private key in as the vagrant_private_key file in C:\Users\your-user.vagrant.d\boxes\vagrant-box-name\nnnnnnnn\virtualbox after placing the public key into Ubuntu fixed the problem.