9

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?

Sam Hammamy
  • 10,819
  • 10
  • 56
  • 94

6 Answers6

18

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.

coderanger
  • 52,400
  • 4
  • 52
  • 75
Tom Wilson
  • 797
  • 9
  • 26
  • I have the same issue and I cannot determine why it started happening. This fixes it for now though, thanks! – John Lemp Oct 31 '16 at 18:32
  • Running `Test Kitchen version 1.8.0` had the timeout issue. Now after adding the `cableconnected1 :'on'` is fixed. – georger Nov 17 '16 at 00:43
  • Thanks for the fix! Observed this same issue with VirtualBox 5.0.30, Vagrant 1.9.1, Test Kitchen 1.14.2, kitchen-vagrant 0.21.1 (oh, this is with bento/ubuntu-16.10) – Patrick Dec 10 '16 at 20:58
  • THIS SHOULD BE THE CORRECT ANSWER if you're using latest tools downloaded after Jan 12 (on 1/12: ChefDK 1.1.16 , test-kitchen 1.14.2, vagrant 1.9.1) for Ubuntu (confirmed for 14.04 + 16.04) – Joe Goggins Jan 13 '17 at 04:30
  • 1
    same Kitchen/Chef soup mix, I get `Waiting for SSH service on 127.0.0.1:2200, retrying in 3 seconds` instead of original error – Chaim Eliyah Feb 02 '17 at 23:22
4

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

cheeseplus
  • 66
  • 2
  • Trying with that exact configuration and didn't work, the message `Waiting for SSH service ...` appears forever. Exact versions: `kitchen-vagrant (1.2.1)`, `Vagrant 2.0.0`, `VBox: 5.1.28r117968`, `bento/ubuntu-14.04 (virtualbox, 201708.22.0)` and in case it matters: `test-kitchen (1.17.0)` – Daniel Oct 14 '17 at 04:58
2

Notice this issue only happens in Centos boxes, not in Ubuntu boxes.

The kitchen-vagrant driver is already fixed.

You can update it, or manually make the change: https://github.com/test-kitchen/kitchen-vagrant/commit/3178e84b65d3da318f818a0891b0fcc4b747d559

Then this .kitchen.yml will work:

driver:
  name: vagrant
  ssh:
    insert_key: false
1

I downgraded from vagrant to 1.8.4 from 1.8.5 and it worked.

I had to run kitchen destroy blah to remove the instance created with 1.8.5. Then when I rand kitchen converge blah it worked.

villy393
  • 2,985
  • 20
  • 28
  • 1
    Unfortunate side-effect of this is loss of support for VirtualBox 5.1.x, which was introduced in Vagrant 1.8.5. So anyone that updated Kitchen in order to support VBox 5.1 will have to downgrade both to use this fix - and hope they haven't installed the VBox guest addons for 5.1.x on any non-kitchen VMs already. – Adrian Aug 22 '16 at 17:39
1

I had the same issue, I just needed to update the kitchen-vagrant gem. You can do this by first seeing which gem you have installed by doing a $ gem list ... kitchen-vagrant (0.20.0) ...

then do a gem update kitchen-vagrant and retry the kitchen verify command.

aidanmelen
  • 6,194
  • 1
  • 23
  • 24
0

The configuration that worked for me was:

PS> vboxmanage --version
5.1.26r117224
PS> gem list | grep kitchen-vagrant
kitchen-vagrant (1.2.1)
PS> vagrant --version
Vagrant 1.9.6

With ChefDK 2.3.4.1.

Daniel
  • 21,933
  • 14
  • 72
  • 101