Vagrant up 失败并显示警告 : Remote connection disconnect. 正在重试

标签 vagrant virtualbox centos7 vagrant-windows

升级到 vagrant 版本 2.1.1 和最新的 centos/7(virtualbox,1803.01)和 $vagrant up 现在无法在加载新 key 后立即构建。正在使用的 Vagrant 文件在以前版本的 vagrant (2.0.3) 上运行良好。

有趣的是,我能够使用 vagrant 手动连接到实例,使用新 key ,既使用直接 ssh 也使用:

$vagrant ssh nat

已经尝试过的事情:
在 vagrant config.vm.boot_timeout = 1200
内延长超时 卸载了 vagrant 和 virtualbox + 手动删除插件并在重新安装之前删除 C:\Users\owner\.vagrand.dC:\Users\owner\.VirtualBox 目录
尝试了以前有效的旧版本 nat.vm.box_version = "1704.01"

为什么不回滚?
最初我升级是因为我有另一个问题,我将提出一个单独的线程。一旦我创建它就会链接到这里。

版本
主机操作系统:Windows 7 Professional
访客操作系统:centos/7 1803.01

Vagrant 版本:2.1.1

Vagrant 插件列表:
Vagrant 主机管理器 (1.8.8)
Vagrant 主机 (2.8.1)
vagrant-proxyconf (1.5.2)
Vagrant 重新加载 (0.0.1)
Vagrant (1.1.9)
Vagrant -vbguest (0.15.1)

$ vagrant up
Bringing machine 'nat' up with 'virtualbox' provider...
Bringing machine 'fei' up with 'virtualbox' provider...
==> nat: Importing base box 'centos/7'...
==> nat: Matching MAC address for NAT networking...
==> nat: Checking if box 'centos/7' is up to date...
==> nat: Setting the name of the VM: brand_nat_1526342206425_95671
==> nat: Fixed port collision for 22 => 2222. Now on port 2200.
==> nat: Clearing any previously set network interfaces...
==> nat: Preparing network interfaces based on configuration...
    nat: Adapter 1: nat
    nat: Adapter 2: intnet
==> nat: Forwarding ports...
    nat: 22 (guest) => 2200 (host) (adapter 1)
==> nat: Running 'pre-boot' VM customizations...
==> nat: Booting VM...
==> nat: Waiting for machine to boot. This may take a few minutes...
    nat: SSH address: 127.0.0.1:2200
    nat: SSH username: vagrant
    nat: SSH auth method: private key
    nat: Warning: Connection aborted. Retrying...
    nat: Warning: Connection reset. Retrying...
    nat: Warning: Remote connection disconnect. Retrying...
    nat: Warning: Connection aborted. Retrying...
    nat:
    nat: Vagrant insecure key detected. Vagrant will automatically replace
    nat: this with a newly generated keypair for better security.
    nat:
    nat: Inserting generated public key within guest...
    nat: Removing insecure key from the guest if it's present...
    nat: Key inserted! Disconnecting and reconnecting using new SSH key...
    nat: Warning: Remote connection disconnect. Retrying...
    nat: Warning: Remote connection disconnect. Retrying...
    nat: Warning: Remote connection disconnect. Retrying...
    nat: Warning: Remote connection disconnect. Retrying...
    nat: Warning: Remote connection disconnect. Retrying...
    nat: Warning: Remote connection disconnect. Retrying...
    nat: Warning: Remote connection disconnect. Retrying...
    nat: Warning: Remote connection disconnect. Retrying...
    nat: 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.

还显示了我稍微清理过的 vagrant 文件。列出的脚本都没有实际运行,因为框在执行之前就失败了。

# -*- mode: ruby -*-
# vi: set ft=ruby :

# abbreviated brand name
BRAND_NAME = "brand"
TOP_LEVEL_DOMAIN = ".some.dev"
BOX_NAME = "centos/7"

Vagrant.configure(2) do |config|

  config.vm.synced_folder ".", "/vagrant", type: "virtualbox"
  config.vm.boot_timeout = 1200

  if Vagrant.has_plugin?("vagrant-proxyconf")
    config.proxy.http     = "http://192.168.100.3:3128/"
    config.proxy.https    = "https://192.168.100.3:3128/"
    config.proxy.no_proxy = "localhost,127.0.0.1,.some.lan"
  end

  config.vm.provider :virtualbox do |vb|
    vb.customize ["modifyvm", :id, "--natdnshostresolver1", "on"]
    vb.memory = 2048
    vb.cpus = 2
    vb.customize ["modifyvm", :id, "--cpuexecutioncap", "50"]
  end

  config.vm.define "nat" do |nat|
    nat.vm.box = BOX_NAME
    nat.vm.network "private_network", ip: "10.0.0.2", virtualbox__intnet: true
    nat.vm.hostname = "nat.staging." + BRAND_NAME + TOP_LEVEL_DOMAIN
    nat.vm.provision :hosts, :sync_hosts => true
    nat.vm.provision "shell", path: "./scripts/aws_replication.sh"
    nat.vm.provision "shell", path: "./scripts/nat_ssh.sh"
    nat.vm.provision "shell", path: "./scripts/nat_staging.sh"
    nat.vm.provision "shell", path: "./scripts/nat_git_clone.sh"
    nat.vm.provision "shell", path: "./scripts/nat_set_ansible.sh"
  end

  config.vm.define "fei" do |fei|
    fei.vm.box = BOX_NAME
    fei.vm.network "private_network", ip: "10.0.0.4", virtualbox__intnet: true
    fei.vm.network "forwarded_port", guest: 80, host: 80, auto_correct: true
    fei.vm.network "forwarded_port", guest: 443, host: 443, auto_correct: true
    fei.vm.network "forwarded_port", guest: 9000, host: 9000, auto_correct: true
    fei.vm.provision :hosts, :sync_hosts => true
    fei.vm.hostname = BRAND_NAME + ".staging" + TOP_LEVEL_DOMAIN
    fei.vm.provision "shell", path: "./scripts/aws_replication.sh"
    fei.vm.provision "shell", path: "./scripts/non-nat_key_staging.sh"
  end
end

最佳答案

nat:检测到 Vagrant 不安全 key 。 Vagrant 会自动替换
nat:使用新生成的 key 对来提高安全性。

每次您运行“Vagrant up”命令时,它都会尝试查找不安全的 key 并替换它。要使用路径“config.ssh.private_key_path”中提到的默认 key ,请在 Vagrantfile 中包含以下条目。

在你的 Vagrantfile 中使用 config.ssh.insert_key = false 然后尝试。

关于Vagrant up 失败并显示警告 : Remote connection disconnect. 正在重试,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/50343486/

相关文章:

php - Laravel Homestead Redis 端口转发

windows - vagrant 在哪里存储日志?

Windows 10 中的 Vagrant 'Timed out while waiting for the machine to boot'

virtual-machine - 在虚拟机中运行真实的 "Bios Setup"

networking - Vagrant 崩溃取决于物理网络

python - 在 OS X 10.10 下的 PyCharm 中使用 VirtualBox 设置 Vagrant 时出错

Heroku 登录 - JSONError : Unexpected end of JSON input while parsing near ' '

perl - 在有问题的位置安装 CPAN 模块

mysql - 无法使用 MySQL Workbench 访问 Mariadb (Centos 7)

bash - 将 Xterm 的输出重定向到日志文件