本文介绍了使用带有准系统自定义程序包的流浪汉时,身份验证失败的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我是Vagrant的新手,所以我采取了一些小步骤以确保我了解流程.我想确保在开始在虚拟机中进行任何认真的开发之前,可​​以创建自定义程序包.目前,我只使用了官方的 ubuntu/xenial64 Vagrant box ,并对其进行了配置这样就安装了nginx.您可以找到我的逐步指南在这里.

I'm new to Vagrant, so I'm taking baby steps to make sure that I understand the process. I want to ensure that I can create a custom package before I start doing any serious development in the virtual machine. For now, I have simply used the official ubuntu/xenial64 Vagrant box, and provisioned it so that nginx is installed. You can find my step-by-step guide to this here.

我的自定义包装盒工作正常.我使用vagrant package --output nginx.box,然后使用vagrant box add nginx nginx.box将自定义框添加到我的Vagrant Install中.当我尝试从自定义程序包创建新框时,出现了我的问题.

My customized box works fine. I use vagrant package --output nginx.box and then vagrant box add nginx nginx.box to add my custom box to my Vagrant Install. It is when I try creating a new box from the custom package that my problem appears.

我创建了一个新目录,并使用vagrant init nginx创建了我的自定义框的副本,但是当我使用vagrant up时,Vagrant无法验证:

I create a new directory and use vagrant init nginx to create a clone of my custom box, but when I use vagrant up, Vagrant fails to authenticate:

  ==> 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"失败.

If I connect to the VM through VirtualBox Manager, I'm asked to authenticate, and using the login and password "vagrant" fails.

我查看了此问题和,它描述了类似的症状,但是我没有尚未在答案中找到解决我的问题的方法.当我运行vagrant up --debug时,会得到此内容VM旋转后重复输出.关键段落似乎是:

I've looked at this question and this other question which describe similar symptoms, but I haven't yet found a solution to my problem in the answers. When I run vagrant up --debug, I get this output repeating after the VM has spun up. The key passage seems to be:

 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.>

在打包自定义框之前,我需要做些什么,以便任何开发人员都可以使用它而无需对公钥和私钥执行任何伏都教?

What do I need to do before I package my custom box so that any developer will be able to use it without performing any voodoo on the public and private keys?

推荐答案

此框已通过密码验证,安装此框时,可以检查其Vagrantfile中的密码(在我的Mac上,我将在)

This box is password authenticated, when you install the box, you can check its Vagrantfile for the password (on my Mac, I will see the file at ~/.vagrant.d/boxes/ubuntu-VAGRANTSLASH-xenial64/20170116.1.0/virtualbox)

config.ssh.username = "ubuntu"
config.ssh.password = "95bf98670a543bcd7bdd576c"

在构建自己的盒子时,最简单的方法可能是重新打包该文件(请参见 https://www.vagrantup.com/docs/cli/package.html#vagrantfile-file ),所以在您的步骤上

The easiest would probably to repackage this same file when you build your own box (see https://www.vagrantup.com/docs/cli/package.html#vagrantfile-file), so on your step

vagrant package --output nginx.box

我会跑步

vagrant package --vagrantfile <path_to_original_box_vagrantfile> --output nginx.box

这篇关于使用带有准系统自定义程序包的流浪汉时,身份验证失败的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

10-15 11:31