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

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


我解决了这个问题,如果其他人有类似的问题,我会回答。

我所做的是:我启用了虚拟框的GUI,让它在启动时等待输入,以选择我是想直接引导到ubuntu还是safemode等等。

要打开GUI,你必须把这个放在你的Vagrantfile配置中:

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

如果你不想启用GUI,然后不得不禁用它,你也可以从Oracle安装扩展包:

http://www.oracle.com/technetwork/server-storage/virtualbox/downloads/index.html#extpack

然后把这个放在你的Vagrantfile中来启用VRDP:

vb.customize ["modifyvm", :id, "--vrde", "on"]

现在您可以使用RDP按需连接到您的盒子,而不需要运行SSH或一直打开GUI。

当你被上面描述的方式困在你的流浪机器上时,不需要以gui模式启动(没有X服务器是不可能的)。

当您的虚拟机正在引导时,在一个单独的终端窗口中,只需找出正在运行的机器的id。

vboxmanage list runningvms

结果是这样的:

"projects_1234567890" {5cxxxx-cxxx-4xxx-8xxx-5xxxxxxxxxx}

通常,VM只是等待您在引导加载程序中选择一个选项。您可以通过controlvm向虚拟机发送相应的keycode(在本例中为Enter):

vboxmanage controlvm projects_1234567890 keyboardputscancode 1c

就是这样。虚拟机将继续启动过程。

这是流浪者的新“特征”。看看这里: https://github.com/mitchellh/vagrant/issues/3329

他们将把“错误”改为“警告”。它只是告诉你机器还没有启动,它正在尝试连接…

我在一台Windows 8.1的机器上遇到了同样的问题。连接超时和启用gui根本没有用,屏幕是黑色的。在我的情况下,修复是禁用“超V”

引用自Vagrant文档https://docs.vagrantup.com/v2/hyperv/index.html

警告:启用Hyper-V将导致VirtualBox、VMware和任何其他虚拟化技术不再工作。请参阅这篇博客文章https://www.hanselman.com/blog/SwitchEasilyBetweenVirtualBoxAndHyperVWithABCDEditBootEntryInWindows81.aspx,如果有需要其他管理程序的时候,可以简单地创建一个引导条目来启动没有启用Hyper-V的Windows。

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

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

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

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

FWIW—我的问题是由于使用了一个非常旧的配置文件而不是一个新的配置文件。使用新的配置文件(从而调整/改变DSL)立即解决了我的问题。

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

需要反复检查的一件事是,您的计算机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.

希望这能有所帮助。

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

流浪汉瘸腿

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

我也遇到过同样的问题,但是上面提到的解决方案都不适合我! 我通过将Vagrant降级到1.6.2来解决这个问题,现在它可以工作了!

对我来说有用的是从BIOS允许64位操作系统(Ubuntu 13.10)上的64位虚拟化。

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

我也有同样的问题。我认为问题可能是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。

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

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

希望这能有所帮助。

It used to help to switch to trusty32, but the situation now got worse again: I tried to use Homestead 2.0 and now I've got the Connection Timeout problem again, which would't usually be a problem, because switching to 32bit helped before. But now I can't just add a line like config.vm.box="ubuntu/trusty32" because we don't have a classic Homestead.yaml file anymore, the values in the new 2.0 Homestead.yaml file just seem to be inserted into the real one in the background and there ist no Vagrantfile available that I could manually edit ...

希望有人能帮忙……

有这个问题超过一个星期,尝试了所有的解决方案,

1. giving SSH username and password
2. Enabling GUI interface
3. Updated Virtual Box and Vagrant

毫无效果。

终于从这个环节得到了解决方案

将谷歌公共DNS IP添加到您的Wifi设置中

在Network Preferences下面> Wifi > Advanced > DNS add IP Address 8.8.8.8

完美的工作。也许这可以帮助任何在Mac上有问题的人。 由于Skovmand

从virtualbox界面,我首先在“CD”上启动,并禁用硬盘启动。因此,它是从CD iso引导的,显然不是在预期的机器上…我希望这能有所帮助。我希望它也能让某人微笑……PEBCAK。

关闭虚拟机内部的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社区中看到这个提交

我有一个问题与现有的盒子(不确定什么改变),但我可以通过SSH连接,即使流浪者盒子无法启动。碰巧我的SSH密钥以某种方式改变了。

从vagrant根文件夹中,我运行vagrant ssh-config,它告诉我密钥文件在哪里。我用puttygen打开它,它给了我一把新钥匙。

在我的Linux客户机上,我编辑了~/。Ssh /authorized_keys并将新的公钥放入其中。

现在一切都恢复正常了!

就我个人而言,Tunnelblick VPN软件阻断了连接。现在当我启动新的虚拟机时,我临时禁用Tunnelblick。

也许这是一个太简单的答案,以帮助许多人,但值得一试,如果你没有:做一个“流浪者暂停”,而不是“流浪者暂停”,然后重新启动VM与“流浪者up”。

我认为我的问题是由于一些“kworker”进程出现bug,并且在VM中不断超时,所以做硬重启似乎正确地重新加载进程,而保存和恢复只是在其破碎状态下恢复破碎的进程。

我的运行正常,然后这个“警告:远程连接断开。一遍又一遍——大概20遍——直到连接上。基于以上的答案,我只是

vagrant destroy
vagrant up

一切都很好。我的很简单,但我把Vagrantfile压缩到config.vm.box = "ubuntu/trusty64",它还在运行。这就是为什么毁灭然后重新开始似乎是最好的选择。鉴于这些流浪汉图像的无国籍性质,我不明白为什么在每个情况下都不会奏效。我刚刚开始研究这个问题,我可能会发现这不是真的。

如果您正在使用包装层(如Kitchen CI),并且正在运行32b主机,则必须抢先安装Vagrant盒子。它们的默认提供程序是二进制文件的opscode“家族”。

所以在厨房创建default-ubuntu-1204之前,请确保您使用:

vagrant box add default-ubuntu-1204 http://opscode-vm-bento.s3.amazonaws.com/vagrant/virtualbox/opscode_ubuntu-12.04-i386_chef-provisionerless.box

如果您的主机不支持字大小虚拟化,则使用32b映像

在Homestead.yaml上寻找这条线:

config.vm.network "forwarded_port", guest: 80, host: 8080

并更改为:

config.vm.network "forwarded_port", guest: 80, host: 8000

然后在Homestead目录下运行:

vagrant destroy
vagrant up

看看它是否有效。

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

我解决的方法是,在Windows上键入两次“cmd”(或“ctrl+C”),然后退出连接失败的屏幕。

然后,我可以通过SSH (vagrant SSH)连接,并自己查看错误。

在我的例子中,这是一个输入错误的路径。

我解决这个问题的方法在这篇文章中没有提到,所以我把细节贴在这里,以防它能帮助到其他人。

造成这种情况的原因是,在机器启动后,流浪汉无法登录机器。造成这种情况的原因有很多,正如本文中提到的,比如机器无法一直启动,或者iptables防火墙阻止SSH。

在我的例子中,问题是我无意中设置了一个“private_network”,它的IP地址与内置的VirtualBox NAT网络(在我的例子中是10.0.2.0/24)在同一个子网中。这打乱了机器的NAT网络(但没有任何地方显示错误),由于vagrant通过NAT网络连接,因此即使机器正在运行且没有启用防火墙,它也无法连接。

Vagrant.configure("2") do |config|
  config.vm.network "private_network", ip: "10.0.2.31"
end

解决办法是更新我的VagrantFile,并使用一个与VirtualBox的NAT网络不冲突的“private_network”IP。

Vagrant.configure("2") do |config|
  config.vm.network "private_network", ip: "10.0.4.31"
end

我也遇到过同样的问题。我通过在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

在我从Vagrantfile中删除这一行后,我也遇到了同样的问题:

config.vm.network "private_network", type: "dhcp"

我把这行放回去后,VM加载正常。

我通过在/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完全无关的东西。

删除文件:

C:\Users\UserName\\.vagrant.d\insecure_private_key

然后运行:

vagrant up

这里有很多很好的答案,我不能全部读完,但是,我只是来给我的一点贡献。我有两个不同的问题:

vagrant up wasn't able to find my ssh 'id_rsa' (because I didn't have it yet, at that time): I ran ssh-keygen -t rsa -b 4096 -C "myemailaddress@mydomain.com", based on this GitHub's article, and voilá, steped through that; Then, I got the same problem of this question "Warning: Connection timed out. Retrying...", eternally...: So, after reading a lot, I've restarted my system and looked at my BIOS (F2 to get there, on PC), and there were Virtualization disabled. I've enabled that, saved, and started the system once again, to check if it has changed anything.

从那以后,流浪起来就像有魔力一样!现在是凌晨4点,但它还在跑!多酷啊,hã?我知道很少有像我这样的受虐狂开发者会在Windows上尝试这个,特别是在Windows 10上,我只是无法不忘记来这里并留下我的话…另一个重要的信息,是,我试图设置Laravel 5,使用Homestead, VirtualBox,作曲家等。这是有效的。所以,希望这个答案能对你有所帮助,就像这个问题和答案对我有所帮助一样。祝福你。G-bye !

当我杀死腻子过程时,我解决了这个问题。因为我同时运行了git-ssh和putty。他们似乎在争夺ssh访问权。一个就够了。

对我来说,这是流浪者和虚拟盒子之间的兼容性。

我在windows 10上,我所做的就是卸载流浪者和虚拟盒子

然后安装一个旧版本的虚拟盒子,特别是4.3.38版本(也为这个版本安装扩展包)

然后安装最新版本的vagrant(目前1.8.5)

从那以后,它起作用了。

我在VirtualBox中运行vagrant/VirtualBox时得到了这个。我通过在主机上运行流浪机器来解决这个问题。

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

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

我找到的解决方案是检查连接到NAT的适配器1中的电缆连接选项。我真的不知道,这是我的第四个流浪者盒子,但这是唯一一个没有选中电缆连接选项的盒子,检查它后,它工作了。

我对这个问题的解决方案是,我的旧笔记本电脑启动时间太长了。我打开虚拟盒子,连接到盒子,等待屏幕加载。花了大约8分钟。

然后它连接并安装了我的文件夹,继续运行。

有时候要有耐心!

SSH连接在初始启动时超时可能与多种原因有关,例如:

check whether virtualization is enabled in BIOS (as per comment), system awaits for user interaction (e.g. share partition is not ready), mismatch of your private key (check the config via vagrant ssh-config), the booting process takes much longer time (try increasing config.vm.boot_timeout), it's booting from the wrong drive (e.g. from the installer ISO), VM firewall misconfiguration (e.g. iptables configuration), local firewall rules, port conflict or conflict with a VPN software, sshd misconfiguration.

要调试问题,请运行——debug选项或如下:

VAGRANT_LOG=debug vagrant up

如果没有什么明显的,那么尝试从另一个终端连接到它,通过vagrant ssh或通过:

vagrant ssh-config > vagrant-ssh; ssh -F vagrant-ssh default

如果SSH仍然失败,尝试使用GUI(例如config. exe)运行它。GUI = true)。

如果不是,检查正在运行的进程(例如:vagrant ssh -c ' pstrree -a')或验证您的sshd_config。


如果它是一次性的虚拟机,你总是可以尝试破坏它,并重新启动它。

你也应该考虑升级你的Vagrant和Virtualbox。


有关详细信息,请检查调试和故障排除页面。

检查CPU在BIOS设置中的虚拟化是否已启用。

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.

我发现在MacOS上使用VirtualBox将此添加到Vagrantfile将让你更进一步:

config.vm.provider 'virtualbox' do |vb|
  vb.customize ['modifyvm', :id, '--cableconnected1', 'on']
end

我是这样做的:

“vagrant up”启动虚拟机后,关闭虚拟机,在虚拟框中进入新的虚拟机设置。然后点击“网络”->“高级” 适配器类型:我从“英特尔PRO XXXXX”改为“PCNet-Fast”(或任何其他适配器除了英特尔PRO确实工作)

在我的情况下,给它一个静态IP地址,简单地解决了问题:

Config.vm.network "private_network", ip: "192.168.50.50"

我分享这些只是为了将来能帮助到其他人。上面的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来保存防火墙配置

ubuntu/ bioni64遇到类似的问题

通过启用Vagrantfile中的gui,我可以使用默认的vagrant/vagrant登录

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

然后执行如下命令复位防火墙

$ ufw force --reset  

然后重新启动系统,这次没有UI 能顺利启动吗

在进行重置之前,请确保保留防火墙规则的备份