Vagrant"身份验证失败"在上升期间,但"vagrant ssh"可以很好地进入

Mik*_*nna 5 windows ssh vagrant coreos

我很难过.我正在尝试在Windows 8.1上运行vagrant/virtualbox/coreos集群来开发用于在云中运行的集群.我在四台机器上尝试了这一点(所有这些都是带有最新更新的Windows 8.1,并且都配有最新的VirtualBox,Vagrant,Git和Vagrant的相同配置.我正在检查所有4系统上的回购中的Vagrant配置所以我相信每个人的配置是相同的.我获得了2次成功和2次失败.

两台机器成功如下:

Bringing machine 'core-01' up with 'virtualbox' provider...
==> core-01: Checking if box 'coreos-stable' is up to date...
(snip)
    core-01: SSH address: 127.0.0.1:2222
    core-01: SSH username: core
    core-01: SSH auth method: private key
    core-01: Warning: Connection timeout. Retrying...
==> core-01: Machine booted and ready!
==> core-01: Setting hostname...
==> core-01: Configuring and enabling network interfaces...
Run Code Online (Sandbox Code Playgroud)

流浪的ssh和vagrant都可以在这两个系统上正常工作.

另外两台Windows机器失败如下:

Bringing machine 'core-01' up with 'virtualbox' provider...
==> core-01: Importing base box 'coreos-stable'...
==> core-01: Matching MAC address for NAT networking...
==> core-01: Checking if box 'coreos-stable' is up to date...
==> core-01: Setting the name of the VM: coreos-vm-cluster_core-01_1422899531630_88904
==> core-01: Clearing any previously set network interfaces...
==> core-01: Preparing network interfaces based on configuration...
    core-01: Adapter 1: nat
    core-01: Adapter 2: hostonly
==> core-01: Forwarding ports...
    core-01: 22 => 2222 (adapter 1)
==> core-01: Running 'pre-boot' VM customizations...
==> core-01: Booting VM...
==> core-01: Waiting for machine to boot. This may take a few minutes...
    core-01: SSH address: 127.0.0.1:2222
    core-01: SSH username: core
    core-01: SSH auth method: private key
    core-01: Warning: Connection timeout. Retrying...
    core-01: Warning: Authentication failure. Retrying...
    core-01: Warning: Authentication failure. Retrying...
    core-01: Warning: Authentication failure. Retrying...
    core-01: Warning: Authentication failure. Retrying...
    core-01: Warning: Authentication failure. Retrying...
    core-01: Warning: Authentication failure. Retrying...
Run Code Online (Sandbox Code Playgroud)

注意工作和非工作系统如何经历一次超时连接,但是成功的系统实际上连接并完成了VM的启动,而不成功的系统只是遇到了身份验证重试循环.

在身份验证失败之后,如果我让它超时或者即使我按ctrl + C,我也可以运行"vagrant ssh core-01"并直接进入:

CoreOS (stable)
core@localhost ~ $
Run Code Online (Sandbox Code Playgroud)

'vagrant halt'也无法在这些系统上建立ssh连接:

==> core-01: Attempting graceful shutdown of VM...
    core-01: Guest communication could not be established! This is usually because
    core-01: SSH is not running, the authentication information was changed,
    core-01: or some other networking issue. Vagrant will force halt, if
    core-01: capable.
==> core-01: Forcing shutdown of VM...
Run Code Online (Sandbox Code Playgroud)

我可以成功使用putty或其他ssh客户端使用insecure_private_key进行身份验证,因此我假设VM本身具有正确的配置,问题在于Vagrant能够调用ssh进入.如果"Vagrant up"不能ssh,它无法完成VM的启动配置,所以我想主要解决这个问题.

这是ssh配置,让我可以使用其他ssh客户端,我认为应该由Vagrant使用:

Host: 127.0.0.1
Port: 2222
Username: core
Private key: C:/Users/Mike/.vagrant.d/insecure_private_key
Run Code Online (Sandbox Code Playgroud)

我还为VM启用了GUI,控制台没有显示任何错误; 它一直很好地到达登录提示(这也与我可以ssh并以其他方式使用VM的事实一致).

我相信(但不知道如何验证)Vagrant在C:\ Program Files(x86)\ Git\bin中调用openssh客户端

所有都运行Vagrant版本1.7.2和git 1.9.5.Ruby 2.0.0p353.

我的%PATH%约为500个字符.我确信Vagrant正在寻找某种类型的ssh客户端,因为至少会有一到两次超时,然后是身份验证失败.

提前感谢任何想法!

更新:深埋在"vagrant up --debug"的输出中是这个小宝石:

D, [2015-02-02T23:11:10.755468 #3920] DEBUG --
   net.ssh.authentication.session[14661cc]: trying publickey
E, [2015-02-02T23:11:10.756472 #3920] ERROR --
   net.ssh.authentication.key_manager[1473e1c]:
   could not load public key file
   `C:/Users/Mike/.vagrant.d/insecure_private_key': 
   Net::SSH::Exception (public key at
   C:/Users/Mike/.vagrant.d/insecure_private_key.pub is not valid)
Run Code Online (Sandbox Code Playgroud)

最后的" insecure_private_key.pub无效 "似乎是一个坚实的线索.

我已经尝试修改该文件以确保它只有LF用于行结尾以及CRLF,它没有任何区别.看起来很好看.它也是100%逐字节字节与在其他系统之一上工作的文件相同.为什么它会无效?我已经验证了当前用户对该文件具有完全控制权限,并且还尝试以管理员身份进行流浪.行为没有变化.:(

Mic*_*ł G 9

删除
C:/Users/Mike/.vagrant.d/insecure_private_key

在下一个流浪汉重新启动它将再次创建(这次应该是正确的)


小智 0

.pub 文件是由 Puttygen 创建的(可能是在以 Putty 格式创建私钥时)?我这样做了,它阻止了 vagrant 连接到盒子,但我可以使用 Putty 和 Puttygen 生成的 .ppk 文件进行连接。

更改 Putty 公钥的扩展名对我有用,大概是因为 Vagrant 不再尝试使用它。

  • 好主意,所以我决定存档到另一个文件夹 insecure_private_key* 并仅使用 ssh-keygen 从头开始​​重新创建。仍然没有运气,并且错误消息与以前相同(insecure_private_key.pub 无效)。然后,我将 insecure_private_key 移动到本地目录并设置 `config.ssh.private_key_path = './insecure_private_key'`,*现在*看起来这是一个简单的密钥不匹配。我现在没有时间完全调试,但这似乎是进步! (2认同)