If you are trying to reproduce this exactly, I'm using the following environment:
- VirtualBox 4.3.12
- Bills Kitchen 3.0-rc4 (includes Vagrant, Packer, Chef, etc)
First challenge is to get a windows basebox from somewhere. I couldn't find a good one, so built one myself from the windows/boxcutter packer templates:
git clone https://github.com/boxcutter/windows.git windows-boxes
cd windows-boxes
make virtualbox/eval-win7x86-enterprise
This takes a while (~45 minutes, depending on your internet connection).
Once the basebox is built, you can import it to Vagrant:
vagrant box add boxcutter/eval-win7x86-enterprise box/virtualbox/eval-win7x86-enterprise-nocm-1.0.4.box
Next I was trying to figure out a minimal Vagrantfile example, which works for all the basic Vagrant things, e.g.:
vagrant up
should not work reliably (not hang / run into timeouts)vagrant ssh
should workvagrant ssh -c "echo foo"
should run the commandvagrant provision
should work, with eitherinline:
orpath:
(.bat / .ps) "shell" provisioner- synced folders should work (via vboxsf or smb ideally)
The Vagrantfile that is packaged within the above built basebox already includes some windows specific settings, such as setting config.vm.communicator = "winrm"
and config.vm.guest = :windows
, so we don't need to repeat that in our Vagrantfile.
So this was my first try:
Vagrant.configure(2) do |config|
config.vm.box = "boxcutter/eval-win7x86-enterprise-nocm"
config.vm.provision "shell", inline: "echo hello!"
config.vm.synced_folder ".", "/vagrant", disabled: true
end
No luck though...
vagrant up
works, but hangs and never completes (I can Ctrl+C though and continue working with the VM)vagrant ssh
works, yay! :-)vagrant ssh -c "echo foo"
drops me into the shell instead of executing the commandvagrant provision
hangs and times out- synced folders I explicitly disabled for now to make it even simpler
Looks like winrm is the likely culprit. I'm surprised that vagrant ssh works, but I'm guessing that the box utter you built was with openssh and not winrm.
Have you tried the vagrant-winrm plugin? You can use the vagrant winrm -c (just like vagrant ssh -c) command to try to help debug.
I'm sure the troubleshooting guide talks about it but here are some things I've run into:
There is also a winrm log in Event Viewer which might give you more insight, provided you can RPD in
http://blogs.msdn.com/b/wmi/archive/2010/03/16/collecting-winrm-traces.aspx