Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Cannot Login Into Vagrant boxes managed via Test Kitchen

I have a very boiler plate .kitchen.yml with the following:

---
driver:
  name: vagrant
platforms:
  - name: ubuntu-14.04
suites:
   - name: default
   run_list:
    - recipe[webserver::default]

when I run kitchen converge I get the following:

==> default: Setting hostname...
   ==> default: Replaced insecure vagrant key with less insecure key!
   ==> default: Machine not provisioned because `--no-provision` is specified.
   Waiting for SSH service on 127.0.0.1:2222, retrying in 3 seconds
   Waiting for SSH service on 127.0.0.1:2222, retrying in 3 seconds
   Waiting for SSH service on 127.0.0.1:2222, retrying in 3 seconds
   .....
   ......

After quit a bit of googling, I've read that Vagrant 1.7+ replaces the default ssh key with what they think is a less insecure key.

There's the config.ssh.insert_key = false but that won't work for the following reasons:

  1. Updated kitchen.yml with insert_key = false

    1.1 This does not work because the Vagrantfile produced has the boolean false as a "false" string!

  2. Tried using a Global Vagrantfile file

    2.1 This did not work as if the file isn't even read!

  3. Tried to build my own box but didn't succeed.

Anyone manage to fix or have a work around for this?

like image 621
Sam Hammamy Avatar asked Aug 16 '16 23:08

Sam Hammamy


2 Answers

Apparently other fixes solved the original post-er's problem, but not mine. Posting here in case it's useful for someone else...

After some hours troubleshooting this problem, and I finally noticed in the VirtualBox Manager that, under Settings/Network/Advanced, that the "Cable Connected" checkbox was unchecked! WTF, my virtual machine's virtual cable was not "connected?" (Big sigh)

I fixed this problem by adding this to my .kitchen.yml file:

driver: name: vagrant customize: cableconnected1: 'on'

I have no idea why the virtual machines were coming up with an unplugged cable. I do not think my workaround is the natural solution but it's all I've got and it works.

UPDATE: This is no longer needed with newer versions of Vagrant and VBox, for all those finding this via Google now.

like image 126
Tom Wilson Avatar answered Sep 22 '22 16:09

Tom Wilson


kitchen-vagrant maintainer here to let everybody know that the issue has to do entirely with the matrix of Vagrant, VirtualBox, and bento boxes in play.

To check versions:

VBoxManage --version vagrant --version vagrant box list | grep bento/

In short, there were a rough series of both Vagrant and VirtualBox releases that caused all sorts of havok so depending on which versions the bento boxes were built/tested against you may or may not experience it.

At present, the following configuration is known working and what the last :

kitchen-vagrant 1.2.1 Vagrant 2.0.0 VirtualBox 5.1.28 bento boxes version 201708.22.0+

Users can look at the boxes on Vagrant Cloud and see what any given box was tested against, e.g. bento/14.04 version 201708.22.0. It's an ugly JSON blob at the moment but very useful as you can see this one was built/tested against. Any box that is uploaded is run through a kitchen run to test it not only for base functionality but also shared folder support for most* platforms.

*most here means nearly everything except known problem distros and FreeBSD

like image 26
cheeseplus Avatar answered Sep 21 '22 16:09

cheeseplus