linux - 更新 Ubuntu guest 后 Vagrant "ssh_exchange_identification: Connection closed by remote host"

标签 linux macos ubuntu vagrant virtual-machine

这是我第二次遇到这种情况: 我使用 Vagrant 创建了一个虚拟 Ubuntu 机器并在运行后:

sudo apt-get 更新 sudo apt-get 升级

我明白了:

    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 上也发生过。

可能有错误或者我做错了什么。

最佳答案

以下解决方案非常适合我:

  1. 转到主目录路径:sudo chmod go-w/usr/local
  2. 转到项目框:a) vagrant reload,b) vagrant up & c) vagrant ssh。

关于linux - 更新 Ubuntu guest 后 Vagrant "ssh_exchange_identification: Connection closed by remote host",我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/37488820/

相关文章:

java - 使用冲突的参数调用命令行应用程序

Java 鼠标事件未在 OSX 上注册

android - 简单的脚本带回了无意义的错误

c++ - 在 Linux 上用 C++ 从文件打开进程

linux - 如何在 AWS ec 虚拟机上使用 hadoop 1.0 配置高可用性

python - zsh:/usr/local/bin/pipenv:错误的解释器:/usr/local/opt/python/bin/python3.7:没有这样的文件或目录

mysql - 错误!服务器退出而不更新PID文件(/usr/local/var/mysql/`username` .lan.pid)

php - 无法在 ubuntu 20 上安装 php 7.3

ruby-on-rails - 我的 Rails 3 站点无法在 Ubuntu/Apache2/Passenger 上启动

c++ - 如何在不在命令行 g++ 中运行 .so 文件的情况下使用它