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

Powershell Error in Vagrant 1.5 With Hyper-V Provider When Vagrant Path Contains Spaces #3100

Closed
charlesportwoodii opened this issue Mar 11, 2014 · 6 comments · Fixed by #3210

Comments

@charlesportwoodii
Copy link

I'm attempting to use the new built in HyperV provider in Vagrant 1.5 however I am receiving an PowerShell error when I try to bring a new box up.

This is on a clean install of Vagrant 1.5 on Windows 8.1 with HyperV enabled (I have non Vagrant HyperV machines are functioning without issue.) Virtualbox has never been installed on this machine.

The Vagrantfile I am using is the one that is generated from the vagrant init command.

Commands

vagrant -v # 1.5
SET VAGRANT_LOG=debug
vagrant init hashicorp/precise64
vagrant up --provider=hyperv

Error

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: get_switches.ps1
Error:

x86 : The term 'x86' is not recognized as the name of a cmdlet, function,
script file, or operable program. Check the spelling of the name, or if a path
was included, verify that the path is correct and try again.
At line:1 char:19
+ C:\Program Files
(x86)\Vagrant\embedded\gems\gems\vagrant-1.5.0\plugins\provider ...
+                   ~~~
    + CategoryInfo          : ObjectNotFound: (x86:String) [], CommandNotFound
   Exception
    + FullyQualifiedErrorId : CommandNotFoundException

The full debug log can be found here: https://gist.github.com/charlesportwoodii/9477408

@charlesportwoodii
Copy link
Author

Hi,

I played around with this a little more and I think I've found the issue. My initial install of Vagrant ended up in: C:\Program Files (x86) rather than a path that didn't have spaces or special characters. When I re-installed Vagrant to a path without spaces I was able to bring the box up.

I'm not sure if it is the parans or the spaces that was causing the issue, but it looks like that PowerShell script errors out when it encounters one of those in the path.

@mitchellh
Copy link
Contributor

Ah great. Yes, there is someone else who ran into this. I'll be taking a look.

@mitchellh
Copy link
Contributor

Fixed!

@charlesportwoodii
Copy link
Author

@mitchellh. Thanks for the quick fix!

@spiffyjr
Copy link

Turns out this was the cause of #3192. I modified the line (without testing) to path.sub(/\s/, '\\ '), which should escape spaces and work in Windows. If someone could verify that would be great.

@charlesportwoodii
Copy link
Author

@mitchellh,

That doesn't seem to be working for me. I upgraded to Vagrant 1.5.1 and now Vagrant just crashes immediatly as soon as I call vagrant up when the Vagrant path contains spaces. Here's the full debug log: https://gist.github.com/charlesportwoodii/9559496.

Also, I can't get Vagrant to install in C:\Program Files even when I manually set the path. It keeps reverting to C:\Program Files (x86). That's a completely separate issue though -


vagrant -v # 1.5.1
SET VAGRANT_LOG=debug
vagrant init hashicorp/precise64
vagrant up --provider=hyperv

And then the regular output:

Bringing machine 'default' up with 'hyperv' provider...
C:/Program Files (x86)/Vagrant/embedded/gems/gems/vagrant-1.5.1/plugins/providers/hyperv/action/read_state.rb:16:in `call': undefined method `[]' for nil:NilClass (NoMethodError)
    from C:/Program Files (x86)/Vagrant/embedded/gems/gems/vagrant-1.5.1/lib/vagrant/action/warden.rb:34:in `call'
    from C:/Program Files (x86)/Vagrant/embedded/gems/gems/vagrant-1.5.1/lib/vagrant/action/builtin/config_validate.rb:25:in `call'
    from C:/Program Files (x86)/Vagrant/embedded/gems/gems/vagrant-1.5.1/lib/vagrant/action/warden.rb:34:in `call'
    from C:/Program Files (x86)/Vagrant/embedded/gems/gems/vagrant-1.5.1/lib/vagrant/action/builder.rb:116:in `call'
    from C:/Program Files (x86)/Vagrant/embedded/gems/gems/vagrant-1.5.1/lib/vagrant/action/runner.rb:69:in `block in run'
    from C:/Program Files (x86)/Vagrant/embedded/gems/gems/vagrant-1.5.1/lib/vagrant/util/busy.rb:19:in `busy'
    from C:/Program Files (x86)/Vagrant/embedded/gems/gems/vagrant-1.5.1/lib/vagrant/action/runner.rb:69:in `run'
    from C:/Program Files (x86)/Vagrant/embedded/gems/gems/vagrant-1.5.1/lib/vagrant/machine.rb:157:in `action'
    from C:/Program Files (x86)/Vagrant/embedded/gems/gems/vagrant-1.5.1/plugins/providers/hyperv/provider.rb:55:in `state'
    from C:/Program Files (x86)/Vagrant/embedded/gems/gems/vagrant-1.5.1/lib/vagrant/machine.rb:339:in `state'
    from C:/Program Files (x86)/Vagrant/embedded/gems/gems/vagrant-1.5.1/lib/vagrant/action/builtin/is_state.rb:22:in `call'
    from C:/Program Files (x86)/Vagrant/embedded/gems/gems/vagrant-1.5.1/lib/vagrant/action/warden.rb:34:in `call'
    from C:/Program Files (x86)/Vagrant/embedded/gems/gems/vagrant-1.5.1/lib/vagrant/action/builder.rb:116:in `call'
    from C:/Program Files (x86)/Vagrant/embedded/gems/gems/vagrant-1.5.1/lib/vagrant/action/runner.rb:69:in `block in run'
    from C:/Program Files (x86)/Vagrant/embedded/gems/gems/vagrant-1.5.1/lib/vagrant/util/busy.rb:19:in `busy'
    from C:/Program Files (x86)/Vagrant/embedded/gems/gems/vagrant-1.5.1/lib/vagrant/action/runner.rb:69:in `run'
    from C:/Program Files (x86)/Vagrant/embedded/gems/gems/vagrant-1.5.1/lib/vagrant/action/builtin/call.rb:43:in `call'
    from C:/Program Files (x86)/Vagrant/embedded/gems/gems/vagrant-1.5.1/lib/vagrant/action/warden.rb:34:in `call'
    from C:/Program Files (x86)/Vagrant/embedded/gems/gems/vagrant-1.5.1/lib/vagrant/action/builtin/config_validate.rb:25:in `call'
    from C:/Program Files (x86)/Vagrant/embedded/gems/gems/vagrant-1.5.1/lib/vagrant/action/warden.rb:34:in `call'
    from C:/Program Files (x86)/Vagrant/embedded/gems/gems/vagrant-1.5.1/lib/vagrant/action/builtin/handle_box.rb:56:in `call'
    from C:/Program Files (x86)/Vagrant/embedded/gems/gems/vagrant-1.5.1/lib/vagrant/action/warden.rb:34:in `call'
    from C:/Program Files (x86)/Vagrant/embedded/gems/gems/vagrant-1.5.1/lib/vagrant/action/builder.rb:116:in `call'
    from C:/Program Files (x86)/Vagrant/embedded/gems/gems/vagrant-1.5.1/lib/vagrant/action/runner.rb:69:in `block in run'
    from C:/Program Files (x86)/Vagrant/embedded/gems/gems/vagrant-1.5.1/lib/vagrant/util/busy.rb:19:in `busy'
    from C:/Program Files (x86)/Vagrant/embedded/gems/gems/vagrant-1.5.1/lib/vagrant/action/runner.rb:69:in `run'
    from C:/Program Files (x86)/Vagrant/embedded/gems/gems/vagrant-1.5.1/lib/vagrant/machine.rb:157:in `action'
    from C:/Program Files (x86)/Vagrant/embedded/gems/gems/vagrant-1.5.1/lib/vagrant/batch_action.rb:72:in `block (2 levels) in run'

@ghost ghost locked and limited conversation to collaborators Apr 13, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants