这是我第二次发生这种情况: 我使用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上也是如此。
也许有一个错误或我做错了什么。
答案 0 :(得分:6)
我在OSX 10.11.6和Vagrant 1.9.1上使用laravel / homestead 1.0.1框遇到了这个问题。
打开"电缆已连接"在Virtual Box VM设置中的适配器上。
Virtual Box GUI>VM Settings>Network>Adapter> ☑ Cable Connected
要永久修复此问题...将其添加到vagrantfile的中间。
config.vm.provider 'virtualbox' do |vb|
vb.customize ['modifyvm', :id, '--cableconnected1', 'on']
end
答案 1 :(得分:5)
以下解决方案对我来说非常合适:
答案 2 :(得分:2)
ssh_exchange_identification: Connection closed by remote host
可能与VirtualBox 5.0.20中有关使用通配符访客地址处理端口转发的更改有关,这会导致您遇到connection closed
个问题。有关此问题的更多信息:
有两种方法可以解决这个问题:
.15
来宾IP地址guest_ip
设置Vagrantfile
设置forwarded_port
中的// suppose customer ID is an integer
int customerId = 0;
string customerName = (string)Session["New"];
using (SqlConnection sqlCon = new SqlConnection(connectionString))
{
SqlCommand sqlCmd = new SqlCommand("SELECT id FROM CustomerDetails WHERE CustomerName = @customerName", sqlCon);
sqlCmd.Parameters.AddWithValue("@customerName", customerName);
object result = sqlCmd.ExecuteScalar();
if (result != null)
customerId = (int)result;
}
值。答案 3 :(得分:-3)
在我遇到同样的错误后,这对我有用。
在终端上,导航到带有 .vagrant 目录的文件夹,然后运行以下命令:
$ vagrant destroy
$ vagrant up
$ vagrant ssh
你应该恢复运行。 快乐的编码!