vagrant 2.2.7 - 无法 vagrant up:默认:警告:身份验证失败。重试

问题描述 投票:0回答:2

此问题已在此处描述:Vagrant 默认:警告:连接重置。重试。然而,它应该在 vagrant 1.9.5 中修复,而我正在使用 vagrant 2.2.7。

为了简单起见,我只是在 Ubuntu 18.04 LTS 上安装 vagrant 2.27 并尝试使用以下 Vagrantfile 运行它:

Vagrant.configure("2") do |config|
  config.vm.box = "ubuntu/trusty64"
end

发生的事情是这样的:

nicolas@BEL20:~/ansible$ vagrant up
Bringing machine 'default' up with 'virtualbox' provider...
==> default: Box 'ubuntu/trusty64' could not be found. Attempting to find and install...
default: Box Provider: virtualbox
default: Box Version: >= 0
==> default: Loading metadata for box 'ubuntu/trusty64'
default: URL: https://vagrantcloud.com/ubuntu/trusty64
==> default: Adding box 'ubuntu/trusty64' (v20190514.0.0) for provider: virtualbox
default: Downloading: https://vagrantcloud.com/ubuntu/boxes/trusty64/versions/20190514.0.0/providers/virtualbox.box
default: Download redirected to host: cloud-images.ubuntu.com
==> default: Successfully added box 'ubuntu/trusty64' (v20190514.0.0) for 'virtualbox'!
==> default: Importing base box 'ubuntu/trusty64'...
==> default: Matching MAC address for NAT networking...
==> default: Checking if box 'ubuntu/trusty64' version '20190514.0.0' is up to date...
==> default: Setting the name of the VM: ansible_default_1580225223507_34560
==> default: Clearing any previously set forwarded ports...
==> default: Clearing any previously set network interfaces...
==> default: Preparing network interfaces based on configuration...
default: Adapter 1: nat
==> default: Forwarding ports...
default: 22 (guest) => 2222 (host) (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: Warning: Authentication failure. Retrying...
...

因此虚拟机无法启动,但是我可以 ssh 到本地主机。将以下行添加到配置中:

config.ssh.password = "vagrant"

一切都按预期进行:

nicolas@BEL20:~/ansible$ vagrant up
Bringing machine 'default' up with 'virtualbox' provider...
==> default: Box 'ubuntu/trusty64' could not be found. Attempting to find and install...
default: Box Provider: virtualbox
default: Box Version: >= 0
==> default: Loading metadata for box 'ubuntu/trusty64'
default: URL: https://vagrantcloud.com/ubuntu/trusty64
==> default: Adding box 'ubuntu/trusty64' (v20190514.0.0) for provider: virtualbox
default: Downloading: https://vagrantcloud.com/ubuntu/boxes/trusty64/versions/20190514.0.0/providers/virtualbox.box
default: Download redirected to host: cloud-images.ubuntu.com
==> default: Successfully added box 'ubuntu/trusty64' (v20190514.0.0) for 'virtualbox'!
==> default: Importing base box 'ubuntu/trusty64'...
==> default: Matching MAC address for NAT networking...
==> default: Checking if box 'ubuntu/trusty64' version '20190514.0.0' is up to date...
==> default: Setting the name of the VM: ansible_default_1580226061698_99495
==> default: Clearing any previously set forwarded ports...
==> default: Clearing any previously set network interfaces...
==> default: Preparing network interfaces based on configuration...
default: Adapter 1: nat
==> default: Forwarding ports...
default: 22 (guest) => 2222 (host) (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: password
default: 
default: Inserting generated public key within guest...
default: Removing insecure key from the guest if it's present...
default: Key inserted! Disconnecting and reconnecting using new SSH key...
==> default: Machine booted and ready!
==> default: Checking for guest additions in VM...
default: The guest additions on this VM do not match the installed version of
default: VirtualBox! In most cases this is fine, but in rare cases it can
default: prevent things such as shared folders from working properly. If you see
default: shared folder errors, please make sure the guest additions within the
default: virtual machine match the version of VirtualBox you have installed on
default: your host and reload your VM.
default: 
default: Guest Additions Version: 4.3.40
default: VirtualBox Version: 5.2
==> default: Mounting shared folders...
default: /vagrant => /home/nicolas/ansible
nicolas@BEL20:~/ansible$ 

但我不想通过登录名/密码进行身份验证。这里可能会发生什么?

提前非常感谢您的帮助。

亲切的问候,

尼古拉斯

vagrant
2个回答
0
投票

就我而言,

vagrant --version
是2.2.9,盒子是
ubuntu/focal64
(无法使用密码连接到它)。 我还看到了一个永远的序列:

default: Warning: Authentication failure. Retrying...

我必须确保

StrictHostKeyChecking
no
127.0.0.1
(或者我在
vagrant ssh-config
中看到的任何内容)。


-1
投票

您可能会在这里找到一些东西。这个问题似乎在那里得到了解决。

© www.soinside.com 2019 - 2024. All rights reserved.