Skip to content
This repository has been archived by the owner on Jan 30, 2021. It is now read-only.

Possible conflict with vagrant-azure spinning up VirtualBox VM #46

Closed
StefanScherer opened this issue Dec 9, 2014 · 7 comments
Closed

Comments

@StefanScherer
Copy link

I have tried my first Ubuntu box with vagrant-azure today, thanks for this plugin!
But I have a problem spinning up a local VM with virtualbox provider after installing the vagrant-azure 1.0.5 plugin.

My setup is:

  • Mac Yosemite 10.10.1
  • vagrant 1.6.5
  • VMware Fusion 6.0.5
  • VirtualBox 4.3.20
  • The following vagrant plugins
$ vagrant plugin list
vagrant-azure (1.0.5)
vagrant-multiprovider-snap (0.0.14)
vagrant-cucumber (0.0.8)
vagrant-login (1.0.1, system)
vagrant-omnibus (1.4.1)
vagrant-pristine (0.3.0)
vagrant-serverspec (0.1.0)
vagrant-share (1.1.2, system)
vagrant-vcloud (0.4.3)
vagrant-vmware-fusion (3.1.2)

I have created a simple Vagrantfile for a Windows box and got this error:

$ vagrant up --provider=virtualbox
Bringing machine 'default' up with 'virtualbox' provider...
==> default: Importing base box 'windows_7'...
==> default: Matching MAC address for NAT networking...
==> default: Setting the name of the VM: win7_default_1418143064904_61689
==> default: Clearing any previously set network interfaces...
==> default: Preparing network interfaces based on configuration...
    default: Adapter 1: nat
==> default: Forwarding ports...
    default: 3389 => 3389 (adapter 1)
    default: 22 => 2222 (adapter 1)
    default: 5985 => 55985 (adapter 1)
==> default: Running 'pre-boot' VM customizations...
==> default: Booting VM...
==> default: Waiting for machine to boot. This may take a few minutes...
==> default: Forcing shutdown of VM...
==> default: Destroying VM and associated drives...
==> default: Running cleanup tasks for 'shell' provisioner...
/Users/stefan/.vagrant.d/gems/gems/vagrant-azure-1.0.5/lib/vagrant-azure/communication/powershell.rb:24:in `ready?': undefined method `check_winrm' for #<VagrantPlugins::ProviderVirtualBox::Driver::Meta:0x000001029d2f80> (NoMethodError)
    from /Users/stefan/.vagrant.d/gems/gems/vagrant-azure-1.0.5/lib/vagrant-azure/communication/powershell.rb:15:in `wait_for_ready'
    from /Applications/Vagrant/embedded/gems/gems/vagrant-1.6.5/lib/vagrant/action/builtin/wait_for_communicator.rb:16:in `block in call'

What makes me wonder is how can the vagrant-azure/communication/powershell.rb be called from vagrant when I want to spin up a box with the virtualbox provider and the default communicators for Vagrant 1.6.x?

The Vagrantfile looks pretty simple:

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

VAGRANTFILE_API_VERSION = "2"

Vagrant.configure(VAGRANTFILE_API_VERSION) do |config|
  config.vm.box = "windows_7"
  config.vm.provider "virtualbox" do |vb|
    vb.gui = true
  end
  config.vm.provision "shell", path: "provision.bat"
end

I am used with the virtualbox, vmware_fusion and vcloud providers, so I thought I just add another cloud provider and get in touch with Azure with vagrant.

Is it possible to use these local providers in parallel with vagrant-azure?
Should I use a special version for this (eg. directly from GitHub)?

I have repeated the vagrant up --provider=virtualbox command and stored the debug log in this gist.

@jeffmendoza
Copy link
Contributor

We've removed all the powershell with the new release (1.1.0) can you retry?

@StefanScherer
Copy link
Author

@jeffmendoza thanks for the update. Yes I have retried it, but I still have problems provisioning a VirtualBox VM when vagrant-azure 1.1.0 is installed.

I first powered up a Windows 7 VM and then only looked at the provisioning. Then I did some debugging with VAGRANT_LOG=debug vagrant provision.

The difference seems to be here:

With vagrant-azure (hangs)

DEBUG subprocess: Waiting for process to exit. Remaining to timeout: 32000
DEBUG subprocess: Exit status: 0
DEBUG virtualbox_4_3:   - [1, "rdp", 3389, 3389]
DEBUG virtualbox_4_3:   - [1, "ssh", 2222, 22]
DEBUG virtualbox_4_3:   - [1, "winrm", 55985, 5985]
DEBUG winrmshell: initializing WinRMShell
DEBUG winrmshell: powershell executing:
hostname
if ($?) { exit 0 } else { if($LASTEXITCODE) { exit $LASTEXITCODE } else { exit 1 } }
 INFO winrmshell: Attempting to connect to WinRM (patched)...
 INFO winrmshell:   - Host: 127.0.0.1
 INFO winrmshell:   - Port: 55985
 INFO winrmshell:   - Username: vagrant
 INFO winrm: WinRM not up: #<VagrantPlugins::CommunicatorWinRM::Errors::ExecutionError: An error occurred executing a remote WinRM command.

Without vagrant-azure (provisioning works)

DEBUG subprocess: Waiting for process to exit. Remaining to timeout: 32000
DEBUG subprocess: Exit status: 0
DEBUG virtualbox_4_3:   - [1, "rdp", 3389, 3389]
DEBUG virtualbox_4_3:   - [1, "ssh", 2222, 22]
DEBUG virtualbox_4_3:   - [1, "winrm", 55985, 5985]
DEBUG winrmshell: initializing WinRMShell
DEBUG winrmshell: powershell executing:
hostname
if ($?) { exit 0 } else { if($LASTEXITCODE) { exit $LASTEXITCODE } else { exit 1 } }
 INFO winrmshell: Attempting to connect to WinRM...
 INFO winrmshell:   - Host: 127.0.0.1
 INFO winrmshell:   - Port: 55985
 INFO winrmshell:   - Username: vagrant
DEBUG winrmshell: Output: {:data=>[{:stdout=>"vagrant-2012\r\n"}], :exitcode=>0}
 INFO winrm: WinRM is ready!
 INFO warden: Calling OUT action: #<VagrantPlugins::Omnibus::Action::InstallChef:0x000001039f9120>
 INFO interface: info: Running provisioner: shell...
 INFO interface: info: ==> win7: Running provisioner: shell...
==> win7: Running provisioner: shell...

It seems that at the Attempting to connect to WinRM (patched)... message the problem starts.
Is this patched code still needed with Vagrant 1.7?
If it is needed for Azure then it should only be loaded if the specific box should be provisioned with the vagrant-azure provider and not for others.

I hope I could help to find the problem.

@devigned
Copy link
Member

devigned commented Feb 4, 2015

@StefanScherer this should definitely only get loaded for that provider. Let me try to replicate and perhaps supply a patch to fix this. Thank you for the help.

@StefanScherer
Copy link
Author

Installed vagrant-azure 1.1.1 and spinned up a Windows VM in VirtualBox - works, no more conflicts. Awesome! 🌟 ⭐ 🌟

@seancoyne
Copy link

I'm seeing this on 1.1.1 (Vagrant 1.7.2, VirtualBox 4.3.22, Mac OS X 10.10.2).

Tried to load up one of my non-Azure, virtualbox provider VMs and it would not connect via winrm.

if ($?) { exit 0 } else { if($LASTEXITCODE) { exit $LASTEXITCODE } else { exit 1 } }
 INFO winrmshell: Attempting to connect to WinRM (patched)...
 INFO winrmshell:   - Host: 127.0.0.1
 INFO winrmshell:   - Port: 5985
 INFO winrmshell:   - Username: vagrant
 INFO winrm: WinRM not up: #<VagrantPlugins::CommunicatorWinRM::Errors::ExecutionError: An error occurred executing a remote WinRM command.

once I uninstalled the vagrant-azure plugin, the VM loaded fine.

If there are any other logs/info that would be helpful, let me know and I'll try to provide.

Plugin list:

$ vagrant plugin list
vagrant-azure (1.1.1)
vagrant-hostsupdater (0.0.11)
vagrant-librarian-chef (0.2.1)
vagrant-reload (0.0.1)
vagrant-share (1.1.3, system)
vagrant-vbguest (0.10.0)

@devigned devigned reopened this Feb 23, 2015
@devigned
Copy link
Member

@seancoyne hmm... I thought this bug was killed. I'll try to reproduce your results.

@milesibastos
Copy link

I'm seeing this on 1.1.1 (Vagrant 1.7.2, VirtualBox 4.3.22, Mac OS X 10.10.2).
once I uninstalled the vagrant-azure plugin, the VM loaded fine.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

5 participants