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

==> 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在网络上还没有被广泛报道,我也找不到发生这种情况的原因。


当前回答

关闭虚拟机内部的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完全无关的东西。

VMware提供商的用户还有一个可能的解决方案: 对我来说,在同一台主机上删除并行安装的VirtualBox后,这个问题得到了解决。VMware和VirtualBox之间的网络接口明显冲突

我也有同样的问题。我认为问题可能是SSH密钥(错误的文件定位或其他东西,但我检查了很多次),但你可能总是在配置部分添加用户名和密码(不使用SSH密钥)和运行gui,所以Vagrantfile中的代码应该看起来或多或少如下:

Vagrant.configure(VAGRANTFILE_API_VERSION) do |config|

  config.ssh.username = "vagrant"
  config.ssh.password = "vagrant"

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

In my case even if GUI was displayed I got black screen (no errors or possibility to login or anything else) and in console I got the Error: Connection timeout. Retrying... many times. I made sure I had VT-x (virtualization) enabled in BIOS, I checked many combinations of versions of both Virtual Box and Vagrant together and many Vagrant boxes (for some of them I didn't have black screen in GUI but still have connection problems). Finally I've updated VirtualBox and Vagrant again to the last versions and the problem still occurred.

最关键的是在运行vagrantup(使用Vagrantfile中的GUI)后,在VirtualBox中查看图标,如下图所示

虽然我在VirtualPC中没有错误(没有VT-x未启用的警告),但我的V图标是灰色的,所以这意味着VT-x被禁用。正如我说的,我一直在我的BIOS中启用它。

Finally I realized the problem might by HYPER-V which I also installed and enabled to test sites on older Internet Explorer. I went to Windows Control Panel -> Programs and functions / Software and choose from the menu on left Turn on or Turn off Windows functions (hope you will find those, I use Polish Windows so don't know exact English names). I turned off Hyper-V, restarted PC and after running Virtual Box and vagrant up I finally had no errors, in GUI I have login screen and my V icon stopped to be gray.

我浪费了很多时间来解决这个问题(和许多电脑重启),所以我希望这可能对任何在Windows上有问题的人有帮助-确保你在控制面板中关闭了Hyper-V。

而不是ctrl-d-ing出虚拟框,因为我习惯做每当我ssh到任何东西,我相信流浪者更喜欢你进入另一个终端,并做一个:

流浪汉瘸腿

让盒子停下来。然后回到VB就没有问题了。

我在使用x64盒子(chef/ubuntu-14.04)时也遇到了同样的问题。

我更改为x32,它工作(hashicorp/precise32)。