Vagrant Hangs Configuring Network Interfaces

2,317 views
Skip to first unread message

Randy Stafford

unread,
Aug 27, 2015, 6:57:06 PM8/27/15
to Vagrant
Hello Vagrant Community,

First let me say thanks for Vagrant - it's serving nicely for a testing need I have.  Now I'm struggling to vagrant up a Windows 2012 R2 guest on an OS X Yosemite host with VirtualBox 5.0.2 provider, and I'd appreciate any assistance anyone might be able to provide.  My Vagrant version is 1.7.4, and here is my Vagrantfile:

# -*- mode: ruby -*-

# vi: set ft=ruby :


Vagrant.configure(2) do |config|

  config.vm.box = "sqlserver2014"

  config.vm.network "private_network", ip: "192.168.56.200"

  config.vm.network :public_network, :bridge => 'en1: Wi-Fi (AirPort)'

  config.vm.communicator = "winrm"

  config.winrm.host = "192.168.56.200"

  config.winrm.username = "Administrator"

  config.winrm.password = "password"

  config.vm.provider "virtualbox" do |vb|

    vb.gui = true

  end

end


The WinRM communicator is working, but vagrant hangs.  Here is the output of vagrant up:

Bringing machine 'default' up with 'virtualbox' provider...
==> default: Clearing any previously set forwarded ports...
==> default: Clearing any previously set network interfaces...
==> default: Preparing network interfaces based on configuration...
    default: Adapter 1: nat
    default: Adapter 2: hostonly
    default: Adapter 3: bridged
==> default: Forwarding ports...
    default: 5985 => 55985 (adapter 1)
    default: 5986 => 55986 (adapter 1)
==> default: Booting VM...
    default: WinRM address: 192.168.56.200:5985
==> default: Waiting for machine to boot. This may take a few minutes...
    default: WinRM username: Administrator
    default: WinRM transport: plaintext
==> default: Machine booted and ready!
==> default: Checking for guest additions in VM...
==> default: Configuring and enabling network interfaces...

After that last line of output, vagrant hangs and never returns control to the shell.  Here's the last bit with VAGRANT_LOG=info:

==> default: Configuring and enabling network interfaces...
 INFO winrm: Checking whether WinRM is ready...
 INFO winrmshell: Attempting to connect to WinRM...
 INFO winrmshell:   - Host: 192.168.56.200
 INFO winrmshell:   - Port: 5985
 INFO winrmshell:   - Username: Administrator
 INFO winrmshell:   - Transport: plaintext
 INFO winrm: WinRM is ready!
 INFO guest: Autodetecting host type for [#<Vagrant::Machine: default (VagrantPlugins::ProviderVirtualBox::Provider)>]
 WARN winrmshell: Detected ParserError, setting exit code to 1
 INFO guest: Detected: windows!
 INFO guest: Execute capability: configure_networks [#<Vagrant::Machine: default (VagrantPlugins::ProviderVirtualBox::Provider)>, [{:type=>:static, :adapter_ip=>"192.168.56.1", :ip=>"192.168.56.200", :netmask=>"255.255.255.0", :auto_config=>true, :interface=>1}, {:type=>:dhcp, :use_dhcp_assigned_default_route=>false, :auto_config=>true, :interface=>2}]] (windows)
 INFO provider: Execute capability: nic_mac_addresses [#<Vagrant::Machine: default (VagrantPlugins::ProviderVirtualBox::Provider)>] (virtualbox)
 INFO subprocess: Starting process: ["/usr/local/bin/VBoxManage", "showvminfo", "20f524ac-87ed-46a1-8c3f-22ea843314d1", "--machinereadable"]
 INFO subprocess: Command not in installer, restoring original environment...
 INFO guestnetwork: Configuring NIC Ethernet 2 using static ip 192.168.56.200

I would appreciate any advice anyone can give me on how to further diagnose and hopefully correct this problem.  Thanks in advance!

Cheers,
Randy

Alvaro Miranda Aguilera

unread,
Aug 27, 2015, 7:30:41 PM8/27/15
to vagra...@googlegroups.com
On Fri, Aug 28, 2015 at 10:57 AM, Randy Stafford
<randy.s...@oracle.com> wrote:
> config.vm.network "private_network", ip: "192.168.56.200"
>
> config.vm.network :public_network, :bridge => 'en1: Wi-Fi (AirPort)'

Hello Rany.

Try the following:

0a. Ensure you are on the current Vagrant
0b. Confirm the base box have the minimum requirements ie:

Set-Item WSMan:\localhost\Service\AllowUnencrypted -Value True
Set-Item WSMan:\localhost\Service\Auth\Basic -Value True



1. Comment out those to config.vm.network to make the Vagrantifile as
simple as possible:

# config.vm.network "private_network", ip: "192.168.56.200"

# config.vm.network :public_network, :bridge => 'en1: Wi-Fi (AirPort)'

2. Then try in this way:

vagrant destroy (this will delete the VM)
vagrant up --no-provision (this will start the VM and nothing else)

Then, if all fine

vagrant provision

This should help to identify where the problem is.

If fails on the provision.. can you share the box?

thanks
Alvaro.

Randy Stafford

unread,
Aug 27, 2015, 10:10:40 PM8/27/15
to Vagrant
Hi Alvaro,

Thanks for the quick response.  I've put answers inline below.

Cheers,
Randy


On Thursday, August 27, 2015 at 5:30:41 PM UTC-6, Alvaro Miranda Aguilera wrote:
On Fri, Aug 28, 2015 at 10:57 AM, Randy Stafford
<randy.s...@oracle.com> wrote:

...

0a. Ensure you are on the current Vagrant

Check.  Vagrant version 1.7.4.

0b. Confirm the base box have the minimum requirements ie:

Set-Item WSMan:\localhost\Service\AllowUnencrypted -Value True
Set-Item WSMan:\localhost\Service\Auth\Basic -Value True

I had done that early on - I've been through a lot of iterations.  :)

1. Comment out those to config.vm.network to make the Vagrantifile as
simple as possible:

#  config.vm.network "private_network", ip: "192.168.56.200"

#  config.vm.network :public_network, :bridge => 'en1: Wi-Fi (AirPort)'

I also commented out config.winrm.host = "192.168.56.200" - since I'm not giving the VM that static IP on the host-only network.

2. Then try in this way:

vagrant destroy (this will delete the VM)
vagrant up --no-provision (this will start the VM and nothing else)

rpstaffo-mac:~ rpstaffo$ vagrant up --no-provision

Bringing machine 'default' up with 'virtualbox' provider...

==> default: Importing base box 'sqlserver2014'...

==> default: Matching MAC address for NAT networking...

==> default: Setting the name of the VM: rpstaffo_default_1440726484115_11028

==> default: Clearing any previously set network interfaces...

==> default: Preparing network interfaces based on configuration...

    default: Adapter 1: nat

==> default: Forwarding ports...

    default: 5985 => 55985 (adapter 1)

    default: 5986 => 55986 (adapter 1)

==> default: Booting VM...

==> default: Waiting for machine to boot. This may take a few minutes...

    default: WinRM address: 127.0.0.1:55985

    default: WinRM username: Administrator

    default: WinRM transport: plaintext

An error occurred executing a remote WinRM command.


Shell: powershell

Command: hostname

if ($?) { exit 0 } else { if($LASTEXITCODE) { exit $LASTEXITCODE } else { exit 1 } }

Message: Protocol wrong type for socket

 
I'd seen this message before, in previous iterations.  I got past it by configuring config.winrm.host.  According to lsof -i :55985 on the host, VirtualBox is listening on port 55985.  The Vagrantfile I previously posted was the simplest one I came up with that got me the farthest.

Then, if all fine

vagrant provision

This should help to identify where the problem is.

If fails on the provision.. can you share the box?

I don't and won't have any provisioning configured in this VM.   I just need to figure out how to get vagrant up to run to completion.

thanks
Alvaro.

Alvaro Miranda Aguilera

unread,
Aug 28, 2015, 12:50:58 AM8/28/15
to vagra...@googlegroups.com
Hello,

This is a simple Vagrantfile I use to test WinRM
Vagrant.configure(2) do |config|
#config.vm.box = "windows-2008-r2-sp1-x64"
config.vm.box = "windows-8.1-x64"
config.vm.synced_folder ".", "/vagrant", disabled: true
config.vm.provider :vmware_fusion do |v|
v.gui = true
end
config.vm.communicator = "winrm"
config.vm.boot_timeout = 600
config.winrm.username = "vagrant"
config.winrm.password = "vagrant"
config.vm.provision "shell", inline: "Get-WMIObject
Win32_ComputerSystem | Select-Object -ExpandProperty name"
end


It works on VMWare out of the box.


Have a look at this project:
https://github.com/luciusbono/Packer-Windows81

It use packer (packer.io) to build automatically that VM, and use WINRM



This is how WinRM is setup:
https://github.com/luciusbono/Packer-Windows81/blob/master/configure-winrm.ps1
> --
> This mailing list is governed under the HashiCorp Community Guidelines -
> https://www.hashicorp.com/community-guidelines.html. Behavior in violation
> of those guidelines may result in your removal from this mailing list.
>
> GitHub Issues: https://github.com/mitchellh/vagrant/issues
> IRC: #vagrant on Freenode
> ---
> You received this message because you are subscribed to the Google Groups
> "Vagrant" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to vagrant-up+...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/vagrant-up/b4572f87-8ab6-425e-b480-6d139ca6cb62%40googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.

Randy Stafford

unread,
Aug 28, 2015, 1:08:26 PM8/28/15
to vagra...@googlegroups.com
Thanks Alvaro.  That Vagrantfile is not substantively different than the one I just tried.  It’s great that it works with VMWare, but I need to use VirtualBox.  I’ve sent you my box separately - I appreciate your help!

Cheers,
Randy

You received this message because you are subscribed to a topic in the Google Groups "Vagrant" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/vagrant-up/iliBGKrXRKg/unsubscribe.
To unsubscribe from this group and all its topics, send an email to vagrant-up+...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/vagrant-up/CAHqq0ezb79KztARgMfyxGg0aCQg9_XcB-GVuzBjWj9B5AMiLcg%40mail.gmail.com.
Reply all
Reply to author
Forward
0 new messages