我的流浪汉昨晚工作得很好。我刚打开电脑,点击《流浪者》,这就是我得到的:
==> 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,然后不得不禁用它,你也可以从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
就是这样。虚拟机将继续启动过程。
需要反复检查的一件事是,您的计算机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.
希望这能有所帮助。
我也有同样的问题。我认为问题可能是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。
关闭虚拟机内部的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社区中看到这个提交
我解决这个问题的方法在这篇文章中没有提到,所以我把细节贴在这里,以防它能帮助到其他人。
造成这种情况的原因是,在机器启动后,流浪汉无法登录机器。造成这种情况的原因有很多,正如本文中提到的,比如机器无法一直启动,或者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
我也有同样的问题,但其他答案都不能完全解决我的问题。@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
我通过在/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完全无关的东西。
这里有很多很好的答案,我不能全部读完,但是,我只是来给我的一点贡献。我有两个不同的问题:
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 !
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。
有关详细信息,请检查调试和故障排除页面。
我分享这些只是为了将来能帮助到其他人。上面的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来保存防火墙配置