mitchellh/vagrant — Issue #572: Running Vagrant within Vagrant: Possible?
Author: geraldalewis
Created: 2011-11-28 18:41:12+00:00
State: open

The Turducken of Computing
---

I've been banging my head against the issue for a couple days now and have had no luck making it work.

It occurred to me that it *may not be possible*, or that it may be possible, but only through `VBox` directly.

I'm happy to continue exploring the issue, but this kind of hacking is not within my wheelhouse, and any tips would be really appreciated!

Some general info on my (lack of) progress
---
(`vm1 $` indicates the prompt within the 1st VM)

Inside the 1st Vagrant VM, `vm1 $ vagrant up` (to create the 2nd Vagrant VM) responds with:

[default] Failed to connect to VM!
Failed to connect to VM via SSH. Please verify the VM successfully booted
by looking at the VirtualBox GUI.

though it appears I do indeed have the 2nd VM inside the 1st Vagrant VM running:

vm1 $ BoxManage list vms --long
Name: vagrant_1322502151
Guest OS: Ubuntu
UUID: 9d1ab03d-00d3-4745-bbc4-9b8209429820

State: running

`vm1 $ ssh vagrant@second_vm -vvvv ` dies after:

debug1: identity file /opt/ruby/lib/ruby/gems/1.8/gems/vagrant-0.8.7/keys/vagrant type 1
debug1: Checking blacklist file /usr/share/ssh/blacklist.RSA-2048
debug1: Checking blacklist file /etc/ssh/blacklist.RSA-2048
ssh_exchange_identification: Connection closed by remote host

guest additions on the 2nd VM:

vm1 $ VBoxManage guestcontrol vagrant_1322502151 exec --image /bin/ls --username vagrant --password vagrant --wait-exit --wait-stdout -- -l /usr

result in the message:

VBoxManage: error: The guest execution service is not ready (yet).

Shutting down the 2nd VM via VBoxManage and restarting as headless:

vm1 $ VBoxHeadless --startvm vagrant_1322502151

Responds with

Oracle VM VirtualBox Headless Interface 4.1.6
(C) 2008-2011 Oracle Corporation
All rights reserved.

and then hangs...