【发布时间】:2017-08-27 16:56:24
【问题描述】:
我是 Vagrant 的新手,所以我正在采取一些小步骤来确保我理解这个过程。我想确保在我开始在虚拟机中进行任何认真的开发之前,我可以创建一个自定义包。目前,我只是简单地使用了官方的ubuntu/xenial64 Vagrant box,并配置它以便安装 nginx。你可以找到my step-by-step guide to this here。
我的定制盒子工作正常。我使用vagrant package --output nginx.box 然后vagrant box add nginx nginx.box 将我的自定义框添加到我的Vagrant 安装中。当我尝试从自定义包创建一个新盒子时,我的问题就出现了。
我创建了一个新目录并使用vagrant init nginx 来创建我的自定义框的克隆,但是当我使用vagrant up 时,Vagrant 无法
验证:
==> 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: Connection reset. Retrying...
default: Warning: Remote connection disconnect. Retrying...
default: Warning: Connection reset. Retrying...
default: Warning: Remote connection disconnect. Retrying...
default: Warning: Connection reset. Retrying...
default: Warning: Remote connection disconnect. Retrying...
default: Warning: Connection reset. Retrying...
default: Warning: Remote connection disconnect. Retrying...
default: Warning: Connection reset. Retrying...
default: Warning: Remote connection disconnect. Retrying...
default: Warning: Authentication failure. Retrying...
default: Warning: Authentication failure. Retrying...
default: Warning: Authentication failure. Retrying...
如果我通过 VirtualBox Manager 连接到 VM,系统会要求我进行身份验证,并且使用登录名和密码“vagrant”失败。
我查看了描述类似症状的 this question 和 this other question,但我还没有在答案中找到解决问题的方法。当我运行vagrant up --debug 时,我得到this output 在VM 启动后重复。关键段落似乎是:
DEBUG ssh: == Net-SSH connection debug-level log END ==
INFO ssh: SSH not ready: #<Vagrant::Errors::SSHAuthenticationFailed:
SSH authentication failed! This is typically caused by the public/private
keypair for the SSH user not being properly set on the guest VM. Please
verify that the guest VM is setup with the proper public key, and that
the private key path for Vagrant is setup properly as well.>
在我打包我的自定义盒子之前我需要做什么,这样任何开发者都可以使用它,而无需对公钥和私钥执行任何巫术?
【问题讨论】:
标签: authentication vagrant package