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

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


当前回答

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

vagrant destroy
vagrant up

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

其他回答

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

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

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.

我通过在/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

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

希望这能有所帮助。