这是我第二次遇到这种情况:我使用Vagrant创建了一个虚拟Ubuntu机器,并在运行之后:
sudo apt-get update sudo apt-get upgrade
我得到了这个:
default: SSH username: vagrant
default: SSH auth method: private key
default: Warning: Remote connection disconnect. Retrying...
default: Warning: Remote connection disconnect. Retrying...
default: Warning: Remote connection disconnect. Retrying...
default: Warning: Remote connection disconnect. Retrying...
default: Warning: Remote connection disconnect. Retrying...
default: Warning: Remote connection disconnect. Retrying...
default: Warning: Remote connection disconnect. Retrying...
default: Warning: Remote connection disconnect. Retrying...
default: Warning: Remote connection disconnect. Retrying...
default: Warning: Remote connection disconnect. Retrying...
default: Warning: Remote connection disconnect. Retrying...
default: Warning: Remote connection disconnect. Retrying...
default: Warning: Remote connection disconnect. Retrying...
default: Warning: Remote connection disconnect. Retrying...
default: Warning: Remote connection disconnect. Retrying...
default: Warning: Remote connection disconnect. Retrying...
default: Warning: Remote connection disconnect. Retrying...
default: Warning: Remote connection disconnect. Retrying...
default: Warning: Remote connection disconnect. Retrying...
default: Warning: Remote connection disconnect. Retrying...
default: Warning: Remote connection disconnect. Retrying...
default: Warning: Remote connection disconnect. Retrying...
default: Warning: Remote connection disconnect. Retrying...
default: Warning: Remote connection disconnect. Retrying...
default: Warning: Remote connection disconnect. Retrying...
default: Warning: Remote connection disconnect. Retrying...
default: Warning: Remote connection disconnect. Retrying...
default: Warning: Remote connection disconnect. Retrying...
default: Warning: Remote connection disconnect. Retrying...
default: Warning: Remote connection disconnect. Retrying...
Timed out while waiting for the machine to boot. This means that
Vagrant was unable to communicate with the guest machine within
the configured ("config.vm.boot_timeout" value) time period.
If you look above, you should be able to see the error(s) that
Vagrant had when attempting to connect to the machine. These errors
are usually good hints as to what may be wrong.
If you're using a custom box, make sure that networking is properly
working and you're able to connect to the machine. It is a common
problem that networking isn't setup properly in these boxes.
Verify that authentication configurations are also setup properly,
as well.
If the box appears to be booting properly, you may want to increase
the timeout ("config.vm.boot_timeout") value.当我调试ssh连接时,我看到以下内容:
vagrant ssh -- -vvv
OpenSSH_6.9p1, LibreSSL 2.1.8
debug1: Reading configuration data ~/.ssh/config
debug1: Reading configuration data /etc/ssh/ssh_config
debug1: /etc/ssh/ssh_config line 20: Applying options for *
debug1: /etc/ssh/ssh_config line 102: Applying options for *
debug2: ssh_connect: needpriv 0
debug1: Connecting to 127.0.0.1 [127.0.0.1] port 2222.
debug1: Connection established.
debug1: key_load_public: No such file or directory
debug1: identity file ~/.vagrant/machines/default/virtualbox/private_key type -1
debug1: key_load_public: No such file or directory
debug1: identity file ~/.vagrant/machines/default/virtualbox/private_key-cert type -1
ssh_exchange_identification: Connection closed by remote host这在Linux上发生在我身上,在Mac OS上也是如此。
也许有一个bug,或者我做错了什么。
发布于 2016-08-04 17:56:20
下面的解决方案对我来说非常有效:
发布于 2017-01-09 02:23:06
我在OSX 10.11.6和Vagrant 1.9.1上使用laravel/homestead 1.0.1 box时遇到了这个问题。
在Virtual Box VM设置中打开适配器上的"Cable Connected“。
Virtual Box GUI>VM Settings>Network>Adapter> ☑ Cable Connected
永久解决这个问题。将这个添加到您的漫游文件的中间。
config.vm.provider 'virtualbox' do |vb| vb.customize ['modifyvm', :id, '--cableconnected1', 'on'] end
发布于 2016-06-07 20:13:27
ssh_exchange_identification: Connection closed by remote host可能与VirtualBox 5.0.20中有关使用通配符来宾地址处理端口转发的更改有关,这会导致出现connection closed问题。有关此问题的更多信息:
有两种方法可以解决这个问题:
包含一个修复的
guest_ip设置(documentation).在您的Vagrantfile中设置一个初始的.15访客ip address
forwarded_port值https://stackoverflow.com/questions/37488820
复制相似问题