vagrant up fails after selecting network adapter on hyperv

Created on 9 May 2018  ·  10Comments  ·  Source: hashicorp/vagrant

Vagrant version

Vagrant 2.1.1

Host operating system

Windows 10 v1709 (OS Build 16299.371)

Guest operating system

centos 6.9

Vagrantfile

Vagrant.configure("2") do |config|
  config.vm.box = "centos/6"
end

Debug output

https://gist.githubusercontent.com/SSoft7/2444535a60a720619a6565ae8a229c43/raw/ae2227fbbb0f4b1bdc021fe546bfdc105e4a89b6/vagrant.log

Expected behavior

up and running with vagrant VM.

Actual behavior

vagrant up failed after selecting network adapter.

Steps to reproduce

  1. vagrant box add centos/6
  2. vagrant init centos/6
  3. vagrant up

Update

I have downgraded straight to version Vagrant 2.0.4 and this issue is not there, so something is wrong with new 2.1.1

every time i run vagrant i face some issue :-(

Most helpful comment

This is fixed within the latest release (2.1.2).

Cheers!

All 10 comments

Having the same problem on Vagrant 2.10 and git master 2.1.2.dev * master 02c207b42 Merge pull request #9817 from jkohrman/master on Windows 10 v1803.

I am having the same issue as well. Vagrant 2.1.1 on Windows 10 Pro x64 1709.

```
cdunphy-centos7-vm01: Please choose a switch to attach to your Hyper-V instance.
cdunphy-centos7-vm01: If none of these are appropriate, please open the Hyper-V manager
cdunphy-centos7-vm01: to create a new virtual switch.
cdunphy-centos7-vm01:
cdunphy-centos7-vm01: 1) nat
cdunphy-centos7-vm01: 2) DockerNAT
cdunphy-centos7-vm01: 3) Default Switch
cdunphy-centos7-vm01:
cdunphy-centos7-vm01: What switch would you like to use? 3
cdunphy-centos7-vm01: Cloning virtual hard drive...
cdunphy-centos7-vm01: Creating and registering the VM...
An error occurred while executing a PowerShell script. This error
is shown below. Please read the error message and see if this is
a configuration error with your system. If it is not, then please
report a bug.

Script: import_vm_xml.ps1
Error:

C:\HashiCorp\Vagrant\embedded\gems\2.1.1\gems\vagrant-2.1.1\plugins\providers\hyperv\scri
pts\import_vm_xml.ps1 : A parameter cannot be found that matches parameter name
'switchid'.
At line:1 char:389

  • ... hy-centos7-vm01/hyperv/Virtual Hard Disks/disk.vhd' -switchid 'c08cb7 ...
  • ~~~~~

    • CategoryInfo : InvalidArgument: (:) [import_vm_xml.ps1], ParameterBinding

      Exception

    • FullyQualifiedErrorId : NamedParameterNotFound,import_vm_xml.ps1

      ```

I had a different error but with a similar result in 2.1.0 which is why I quickly updated to 2.1.1. I do not see a workaround.

This problem was caused because https://github.com/hashicorp/vagrant/issues/9774 failed to support import_vm_xml.ps1 when fixing an issue in import_vm_vmcx.ps1

And the fix is in #9813

Has this made it to release yet? I'm still having the exact same problem and I am using Vagrant 2.1.1. Do I have to build from source to get this fix? Its blocking me from using my DEV environment. :(

Things to try.... build from master or wait for 2.1.2 or try to find a different base box that doesn't trigger this issue.

is there any ETA about 2.1.2? I have the same issue. Can someone post a hotfix?

AFAIK the "hotfix" is to run Vagrant directly from a checked out master branch.

I use this process:
https://www.vagrantup.com/docs/installation/source.html

I clone the vagrant github repo into a sibling folder of the main Vagrant install C:\HashiCorp\Vagrant-Dev

Along with a couple support scripts:

C:\HashiCorp\Vagrant-Dev[master ≡ +1 ~1 -0 !]
λ  more .\install.ps1
bundle install ; bundle --binstubs exec

If you put vagrant-dev.cmd in your PATH then you can run it like regular vagrant:

C:\HashiCorp\Vagrant-Dev[master ≡ +1 ~1 -0 !]
λ  Get-Command vagrant-dev.cmd

CommandType     Name                                               Version    Source
-----------     ----                                               -------    ------
Application     vagrant-dev.cmd                                    0.0.0.0    C:\cloud\win\bin\v...


C:\HashiCorp\Vagrant-Dev[master ≡ +1 ~1 -0 !]
λ  Get-Command vagrant-dev.cmd | type
@echo off
PATH %PATH%;C:\HashiCorp\Vagrant\embedded\bin;C:\HashiCorp\Vagrant\embedded\gnuwin32\bin;C:\HashiCorp\Vagrant\embedded\mingw64\bin;
ruby C:\HashiCorp\Vagrant-Dev\exec\vagrant %*
C:\HashiCorp\Vagrant-Dev[master ≡ +1 ~1 -0 !]

Example:

C:\HashiCorp\Vagrant-Dev[master ≡ +1 ~1 -0 !]
λ  vagrant-dev global-status
 WARN global: resolv replacement has not been enabled!
You appear to be running Vagrant outside of the official installers.
Note that the installers are what ensure that Vagrant has all required
dependencies, and Vagrant assumes that these dependencies exist. By
running outside of the installer environment, Vagrant may not function
properly. To remove this warning, install Vagrant using one of the
official packages from vagrantup.com.

id       name    provider   state    directory
-------------------------------------------------------------------------------------
6b818a0  default hyperv     off      C:/Users/tonya/Vagrant/vagrant-ansible
1b45952  default hyperv     off      C:/Users/tonya/Vagrant/hyperv/vagrant-hackathon
3d34f25  default hyperv     running  C:/Users/tonya/Vagrant/hyperv/w16s
77b8bc3  default virtualbox poweroff C:/Users/tonya/Vagrant/vb/vagrant-hackathon
4150561  default virtualbox poweroff C:/Users/tonya/Vagrant/vb/vagrant-w16s
7f46f40  default virtualbox poweroff C:/Users/tonya/Vagrant/vb/vagrant-ia16ep4demo
a040aa5  default hyperv     off      C:/Users/tonya/Vagrant/hyperv/vagrant-centos

The above shows information about all known Vagrant environments
on this machine. This data is cached and may not be completely
up-to-date (use "vagrant global-status --prune" to prune invalid
entries). To interact with any of the machines, you can go to that
directory and run Vagrant, or you can use the ID directly with
Vagrant commands from any directory. For example:
"vagrant destroy 1a2b3c4d"

This is fixed within the latest release (2.1.2).

Cheers!

I'm going to lock this issue because it has been closed for _30 days_ ⏳. This helps our maintainers find and focus on the active issues.

If you have found a problem that seems similar to this, please open a new issue and complete the issue template so we can capture all the details necessary to investigate further.

Was this page helpful?
0 / 5 - 0 ratings