Question

I'm trying to get the vagrant hyper-v provider to work with a debian 7.4 image, but not having much luck.

  1. I created a vagrant box by following the steps in http://docs.vagrantup.com/v2/hyperv/boxes.html .
  2. I removed all existing hyper-v vms and network switches from hyper-v.
  3. I added an "External switch" to hyper-v.
  4. Then:

    [ADMIN] 17:55:06 C:\> cd .\vagrant-test
    [ADMIN] 17:55:08 C:\vagrant-test> ls
    [ADMIN] 17:55:08 C:\vagrant-test> vagrant init debian-wheezy
    A `Vagrantfile` has been placed in this directory. You are now
    ready to `vagrant up` your first virtual environment! Please read
    the comments in the Vagrantfile as well as documentation on
    `vagrantup.com` for more information on using Vagrant.
    [ADMIN] 17:55:19 C:\vagrant-test> vagrant up --provider=hyperv
    Bringing machine 'default' up with 'hyperv' provider...
    ==> default: Verifying Hyper-V is enabled...
    ==> default: Importing a Hyper-V instance
        default: Cloning virtual hard drive...
        default: Creating and registering the VM...
        default: Successfully imported a VM with name: DebianWheezy74Base
    ==> default: Starting the machine...
    ==> default: Waiting for the machine to report its IP address...
        default: Timeout: 120 seconds
    Hyper-V failed to determine your machine's IP address within the
    configured timeout. Please verify the machine properly booted and
    the network works. To do this, open the Hyper-V manager, find your
    virtual machine, and connect to it.
    
    The most common cause for this error is that the running virtual
    machine doesn't have the latest Hyper-V integration drivers. Please
    research for your operating system how to install these in order
    for the VM to properly communicate its IP address to Hyper-V.
    [ADMIN] 17:57:55 C:\vagrant-test>
    

I've tried the same thing with an internal switch.

That's fair enough, because the way the hyper-v provider tries to find the IP address is via a powershell command like this:

[ADMIN] 18:01:18 C:\code\autosetup> Get-VMNetworkAdapter -VMName DebianWheezy74Base
Name            IsManagementOs VMName             SwitchName      MacAddress   Status                      IPAddresses
----            -------------- ------             ----------      ----------   ------                      -----------
Network Adapter False          DebianWheezy74Base External Switch 00155D890119 {Degraded, ProtocolVersion} {}


[ADMIN] 18:01:25 C:\code\autosetup> (Get-VMNetworkAdapter -VMName DebianWheezy74Base).IPAddresses
[ADMIN] 18:01:36 C:\code\autosetup>

So it can't determine what IP address was actually assigned to the VM. Yes, the VM does actually get an IP very quickly via DHCP.

There are a number of things that point to needing to upgrade the hyper-v integration services on the VM, but hyper-v doesn't "officially" support debian, just RHEL. The downloads Microsoft supplies simply include rpms. Debian should already have the proper hyper-v goodness. I see that the hyper-v modules are loaded:

root@debian74base:/home/vagrant# lsmod | grep hv_
hv_utils               12986  0
hv_netvsc              18304  0
hv_storvsc             17423  2
hv_vmbus               32029  4 hid_hyperv,hv_storvsc,hv_netvsc,hv_utils
scsi_mod              162269  5 libata,sr_mod,sg,hv_storvsc,sd_mod

Has anyone gotten vagrant + hyper-v + debian to work? If so, how?

Was it helpful?

Solution

I was able to get the debian/hyper-v/vagrant combo working by building/installing the hv_kvp_daemon (from https://github.com/v10networks/hv_kvp_daemon)

Build the package:

apt-get install devscripts git
cd /tmp
git clone https://github.com/v10networks/hv_kvp_daemon
cd hv_kvp_daemon
debuild -i -us -uc -b
dpkg -i ../hv-userspace-daemons_0.2-1_amd64.deb

Set it to run on boot:

update-rc.d hv-kvp-daemon defaults. 

Vagrant (and the Hyper-V manager) was able to detect the IP after that.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top