2

i've set up a first Vagrant box for python dev that works very well. I can vagrant ssh in that original box without issue.

Trouble start when i try to create a copy of that box (with vagrant package), to share it with colleagues. When i try to boot that copy with vagrant up, i run into the oft reported ssh authentication failure. Note that i still can vagrant ssh in the original box.

Workflow & logs

vagrant_anaconda ==> my base box

newvm ==> the copy

package creation

cd vagrant
vagrant up (doc says the VM should be running)
vagrant package --base vagrant_anaconda --output ~/Code/vagrant.box --vagrantfile Vagrantfile --include bootstrap.sh

new Vagrant VM set up

mkdir newvm
cd newvm
vagrant init newvm ~/Code/vagrant.box

I copy the bootstrap.sh of the original vm (the include parameter is probably not supposed to be used for this)

Vagrantfile (removed the comments for concision)

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

Vagrant.configure(2) do |config|

  config.vm.box = "chef/centos-6.5"
  config.vm.provision :shell, path: "bootstrap.sh"

  config.vm.network "forwarded_port", guest: 80, host: 8080
  config.vm.network "forwarded_port", guest: 5002, host: 5002

end

bootstrap.sh

#!/usr/bin/env bash

yum update
yum -y install httpd
rm -rf /var/www/html
ln -fs /vagrant /var/www/html
service httpd start

Dreaded SSH authentication error

vagrant up

Bringing machine 'default' up with 'virtualbox' provider...
==> default: Importing base box 'newvm'...
==> default: Matching MAC address for NAT networking...
==> default: Setting the name of the VM: newvm_default_1425211273763_74431
==> default: Clearing any previously set network interfaces...
==> default: Preparing network interfaces based on configuration...
    default: Adapter 1: nat
==> default: Forwarding ports...
    default: 80 => 8080 (adapter 1)
    default: 5002 => 5002 (adapter 1)
    default: 22 => 2222 (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: Connection timeout. Retrying...
    default: Warning: Authentication failure. Retrying...
    default: Warning: Authentication failure. Retrying...

result of vagrant ssh-config :

Host default
  HostName 127.0.0.1
  User vagrant
  Port 2222
  UserKnownHostsFile /dev/null
  StrictHostKeyChecking no
  PasswordAuthentication no
  IdentityFile /Users/nicolas/.vagrant.d/insecure_private_key
  IdentitiesOnly yes
  LogLevel FATAL

Steps taken :

If i boot the gui of the VM (as suggested in other answers), i can see that it's requesting a login /psw.

I've tried deleting the insecure_private_key. No effect.

How can i log in my second box ? How can i be reasonably sure that the people i'm going to send it won't face that issue ?

0

You must log in to answer this question.

Browse other questions tagged .