Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Vagrant up fail with Hyper-V #8794

Closed
Max84 opened this issue Jul 19, 2017 · 9 comments
Closed

Vagrant up fail with Hyper-V #8794

Max84 opened this issue Jul 19, 2017 · 9 comments

Comments

@Max84
Copy link

Max84 commented Jul 19, 2017

Vagrant version

1.9.7

Host operating system

Windows 10 (french version)

Guest operating system

gusztavvargadr/w10e

Vagrantfile

Vagrant.configure("2") do |config|
	Vagrant.require_version ">= 1.9.7"
	config.vm.provider "hyperv"
	config.vm.box = "gusztavvargadr/w10e"
end

Expected behavior

I expect a new VM.

Actual behavior

I get this error:

F:>vagrant up
Bringing machine 'default' up with 'hyperv' provider...
==> default: Verifying Hyper-V is enabled...
==> default: Configured startup memory is 1024
==> default: Configured cpus number is 1
==> default: Importing a Hyper-V instance
default: Cloning virtual hard drive...
default: 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_vmcx.ps1
Error:

Connect-VMNetworkAdapter : Hyper-V n'a trouvé aucun commutateur virtuel
portant le nom « Pour Accès Externe ».
Au caractère C:\HashiCorp\Vagrant\embedded\gems\gems\vagrant-1.9.7\plugins\prov
iders\hyperv\scripts\import_vm_vmcx.ps1:96 : 1

  • Connect-VMNetworkAdapter -VMNetworkAdapter $vmNetworkAdapter -SwitchN ...
  •   + CategoryInfo          : InvalidArgument : (:) [Connect-VMNetworkAdapter]
     , VirtualizationException
      + FullyQualifiedErrorId : InvalidParameter,Microsoft.HyperV.PowerShell.Com
     mands.ConnectVMNetworkAdapter
    
    
    

But i get this commutator "Pour Accès Externe", into Hyper-V.
I suspect, it's due to "è" (seen like this into Hyper-V), but become "è" with Vagrant.

Steps to reproduce

  1. Vagrant up (only), maybe onto a French Windows Host.

References

No

@sbaudoin
Copy link

Hello,
I confirm this issue relates to the accentuated e: if we create a new commutator with no special character it works.

@LeoColomb
Copy link

Confirmed. Seems to be an encoding issue.

> vagrant up
Bringing machine 'homestead-7' up with 'hyperv' provider...
==> homestead-7: Verifying Hyper-V is enabled...
==> homestead-7: Importing a Hyper-V instance
    homestead-7: Please choose a switch to attach to your Hyper-V instance.
    homestead-7: If none of these are appropriate, please open the Hyper-V manager
    homestead-7: to create a new virtual switch.
    homestead-7:
    homestead-7: 1) DockerNAT
    homestead-7: 2) Commutateur par défaut
    homestead-7:
    homestead-7: What switch would you like to use? 2
    homestead-7: Cloning virtual hard drive...
    homestead-7: 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_vmcx.ps1
Error:

Connect-VMNetworkAdapter : Hyper-V n'a trouvé aucun commutateur virtuel portant le nom « Commutateur par défaut ».
Au caractère C:\HashiCorp\Vagrant\embedded\gems\gems\vagrant-2.0.1\plugins\providers\hyperv\scripts\import_vm_vmcx.ps1:96 : 1
+ Connect-VMNetworkAdapter -VMNetworkAdapter $vmNetworkAdapter -SwitchN ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : InvalidArgument : (:) [Connect-VMNetworkAdapter], VirtualizationException
    + FullyQualifiedErrorId : InvalidParameter,Microsoft.HyperV.PowerShell.Commands.ConnectVMNetworkAdapter

@AlexRadch
Copy link

I have the same issue with laravel/homestead guest OS on Russian Windows 10 Host

Bringing machine 'homestead-7' up with 'hyperv' provider...
==> homestead-7: Verifying Hyper-V is enabled...
==> homestead-7: Importing a Hyper-V instance
    homestead-7: Cloning virtual hard drive...
    homestead-7: 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_vmcx.ps1
Error:

Connect-VMNetworkAdapter : Hyper-V не удалось найти виртуальный коммутатор с именем "Р?Р?Р?Р?С?С".
C:\HashiCorp\Vagrant\embedded\gems\gems\vagrant-2.0.1\plugins\providers\hyperv\scripts\import_vm_vmcx.ps1:96 знак:1
+ Connect-VMNetworkAdapter -VMNetworkAdapter $vmNetworkAdapter -SwitchN ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : InvalidArgument: (:) [Connect-VMNetworkAdapter], VirtualizationException
    + FullyQualifiedErrorId : InvalidParameter,Microsoft.HyperV.PowerShell.Commands.ConnectVMNetworkAdapter

How to workaround this?

@Prometee
Copy link

@AlexRadch Create a new "virtual switch" (виртуальный коммутатор) in Hyper-V Manager with an english name like "Default Virtual Switch" with the same options then retry vagrant up

@AlexRadch
Copy link

@Prometee yes it works.

chrisroberts added a commit to chrisroberts/vagrant that referenced this issue Apr 27, 2018
Keep track of selected Hyper-V switch using the ID instead of name
to prevent any encoding issues that may occur switching between
PowerShell and Ruby. With the IDs staying consistent, the switch
name can be fetched from the provided ID.

Fixes hashicorp#9679 hashicorp#8794 hashicorp#9451
@jbonhag
Copy link
Contributor

jbonhag commented Apr 3, 2020

Hi there,

It looks like this has been resolved within a previously shipped version of Vagrant so I am now closing this issue. If the original issue was not fully resolved, please reopen this issue or create a new one.

Cheers!

@jbonhag jbonhag closed this as completed Apr 3, 2020
@jospradlin
Copy link

I'm on 2.2.7 and I still get this error:

==> slave2: Starting the machine...
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: start_vm.ps1
Error:

@jbonhag
Copy link
Contributor

jbonhag commented Apr 23, 2020

Hi @jospradlin,

Sorry that you're seeing this error when bringing up a VM. I see that your error is in the start_vm.ps1 script, and the original issue mentioned the import_vm_vmcx.ps1 script. Would you be willing to open up a new issue and fill out the issue template so we can investigate?

Cheers! 😄

@ghost
Copy link

ghost commented May 4, 2020

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.

@ghost ghost locked and limited conversation to collaborators May 4, 2020
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

9 participants