我的流浪汉昨晚工作得很好。我刚打开电脑,点击《流浪者》,这就是我得到的:
==> 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在网络上还没有被广泛报道,我也找不到发生这种情况的原因。
我分享这些只是为了将来能帮助到其他人。上面的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来保存防火墙配置
当你被上面描述的方式困在你的流浪机器上时,不需要以gui模式启动(没有X服务器是不可能的)。
当您的虚拟机正在引导时,在一个单独的终端窗口中,只需找出正在运行的机器的id。
vboxmanage list runningvms
结果是这样的:
"projects_1234567890" {5cxxxx-cxxx-4xxx-8xxx-5xxxxxxxxxx}
通常,VM只是等待您在引导加载程序中选择一个选项。您可以通过controlvm向虚拟机发送相应的keycode(在本例中为Enter):
vboxmanage controlvm projects_1234567890 keyboardputscancode 1c
就是这样。虚拟机将继续启动过程。
这里有很多很好的答案,我不能全部读完,但是,我只是来给我的一点贡献。我有两个不同的问题:
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。
有关详细信息,请检查调试和故障排除页面。