Vagrant: Windows installer defaults to "C:\HashiCorp\Vagrant\"

Created on 24 Apr 2013  ·  30Comments  ·  Source: hashicorp/vagrant

Happens for Vagrant 1.2.2 on Windwows 8 and Windows 7 after uninstalling Vagrant 1.2.1 manually. The default path is set to "C:\HashiCorp\Vagrant\" instead of "C:\Program Files (x86)\HashiCorp\Vagrant\".

Most helpful comment

The ruby bug is supposed to be fixed for a very long time: https://bugs.ruby-lang.org/issues/7036

All 30 comments

Unfortunately this is necessary due to a bug in Ruby itself. Installing plugins to vagrant when it is installed in a directory with spaces doesn't work at all due to a ruby core bug.

So I have to unfortunately be a bad citizen and install in the root directory :(

Sent from my iPhone

On Apr 24, 2013, at 9:50 AM, Thomas Deinhamer [email protected] wrote:

Happens for Vagrant 1.2.2 on Windwows 8 and Windows 7 after uninstalling Vagrant 1.2.1 manually. The default path is set to "C:\HashiCorp\Vagrant\" instead of "C:\Program Files (x86)\HashiCorp\Vagrant\".

\
Reply to this email directly or view it on GitHub.

I see, too bad!

A better solution would be to suggest C:\vagrant instead of your company name. Very bad decision.

@kadishmal I don't see how it makes any difference. Vagrant is a project of HashiCorp.

@mitchellh sorry for confusion. In my case the suggested path was on disk D:\HashiCorp\Vagrant, not C:\, which confused me. From my experience, software vendors do one of the following:

  1. Install in C:\Program Files\Company\Product folder.
  2. Install in C:\Product folder.

This is why your choice doesn't seem to fit this common user expectation.

@kadishmal I don't explicitly choose "C:\". I use the Windows variable for the "system drive", so it is WIndows choosing D over C for w/e reason.

I think when I installed Vagrant it also suggested "S:..." but my system drive is surely not S but C, S is just another hard disk.

:+1:

@mitchellh Is the previously mentioned "ruby core bug" documented? Could you provide a link it? As for a workaround, can I provide my own no-spaces path to the installer?

Installing Vagrant for the first time on a Windows machine, and this issue stuck out like a sore thumb. Windows Installer Best Practises recommend that the Windows Installer and Logo Requirements be followed, even if the application isn't submitted for Logo certification.

Section 2.4: "The application should install to the Program Files folder by default."

Installing outside of Program Files causes problems for stricter Windows environments, and in particular if the Program Files directory is stored on another disk, Vagrant will be stored on the (potentially much smaller or otherwise protected) system drive instead.

Not to mention it's not nice to pollute the root of the system drive. :)

Another workaround would be to make a symbolic link from C:\vagrant\ to %ProgramFiles%\Vagrant, but this would only work on Windows Vista and later, and still puts things in the root of the system drive. However, at least the actual data is stored on the correct disk.

Is there an upstream bug report for this?

This is done because of a ruby bug, if I remember correctly.

@micolous Yes, @drpebcak is correct. I originally changed the Vagrant 1.1 installers to install to "C:\Program Files\HasihCorp" as it should, but was unable to do that because Ruby didn't handle the space in the path well.

I never reported it upstream, or I found a bug upstream. I'll try to look into it because I really would rather install it in the proper location.

As @AnthonyMastrean suggested, I'd like to provide another no-spaces directory (e.g. "C:dev\tools") in which to install Vagrant. Unfortunately, such an input provided to the installation process's "Destination Folder" window is ignored and Vagrant happily installs itself under "C:\HashiCorp\Vagrant".

Why doesn't Vagrant honor the installation directory I provided? The text clearly makes me believe it should: "Click Next to install to the default folder or click Change to choose another."

What gives?

@IAHawk Sounds like a bug in the installers. Our intention is to allow you to change that directory. :) I'll try to look into it but the installer generators use WiX and are open source under the "vagrant-installers" repo in my account if you want to take a look. Look at the "package" directory.

@mitchellh Might be a good idea to mention about this issue in the installer? Would likely help people (like me) who changed it to being under c:\Program Files and then spent a little while tracing for why it didn't work under cygwin.

image

A few brief words on this screen would really help. Thanks!

There is another aspect besides _bad citizenship_. Windows by default honours only certain directories for account privilege elevation, namely

  • …\Program Files\, including subfolders
  • …\Windowssystem32\
  • …\Program Files (x86)\, including subfolders for 64-bit versions of Windows

So if you ever needed elevated privileges or even Administrators rights you'd be out of luck. Read _Local Policies -> Security Options -> User Account Control: Only elevate UIAccess applications that are installed in secure locations_ for details.

If my memory serves me right you can always call custom commands from an installer. If the above junction/symlink hack works you could install the source in either program files folder, still receive the benefits of elevation and show people you are providing a workaround for a 3rd party issue.

I think the better place by default is "C:\ProgramData". :+1:

Hi!

If you would like to change the default location for the Vagrant install, please open an issue/pull request on the vagrant installers repo. As you can see here, we are in the process of changing the Mac OS X default directory to be more semantic as well.

@brunobatista :-1: ProgramData is still wrong, see https://github.com/mitchellh/vagrant/issues/1652#issuecomment-33021570 where I reference the documents which say what should be used. The bug in Ruby really needs to be fixed.

Yes I agree @micolous, however for now it might be a more appropriate solution.

The ruby bug is supposed to be fixed for a very long time: https://bugs.ruby-lang.org/issues/7036

Just installed it under "C:\Program Files (x86)\HashiCorp\Vagrant" without any issues.

We just tried it using "C:\Program Files (x86)\HashiCorp\Vagrant" as @renaatdemuynck suggested but we also had to set VAGRANT_HOME=C:\Program Files (x86)\HashiCorp\Vagrant , as suggested in this post https://github.com/mitchellh/vagrant/issues/2056. Now we don't have the error "failed writing body" but we got another one saying: "There was an error while execution Vboxmanage as CLI used by Vagrant to control VirtualBox ..." We are using Windows 7.

I have _Windows 10_ and typed C:\Program Files\Vagrant for the destination folder.
The installation went smoothly and when I checked the system's PATH environment variable, it actually pointed to C:\Program Files (x86)\Vagrant\bin. I just guess that the installer may have understood the proper path (x86) by some other reference. Basically it created these folders:

  • bin folder with only vagrant.exe inside;
  • embedded folder with vagrant's files (e.g. unins000.exe, another bin folder, etc.).

I opened up a shell and was able to run all vagrant commands.

> vagrant --version
Vagrant 1.9.5

I did not need to set any environment variables manually.

On my Windows 7 machine, C:\Program Files (x86)\HashiCorp\Vagrant\bin is also in the PATH environment variable. I did not have the set anything manually.

Installing in C:\Program Files (x86)\HashiCorp\Vagrant works great.
Environmental path was automatically set to C:\Program Files (x86)\HashiCorp\Vagrantbin
Vagrant version 2.1.1, Windows 10 proffesional

If I try to install the Windows 64-bit version to the main "Program Files" directory, the installer hangs for a bit and then changes it to "Program Files (x86)". This caused some confusion for me when I was trying to upgrade a previously installed 64-bit version, and thought I had installed the 32-bit version. I installed the 32-bit version over top of it, and while there haven't been any problems so far, it is definitely unexpected behavior.

I'd love for the installer to have at least a flag to be able to define WHERE the installation should land.

It is disappointing that this issue still hasn't been fixed 6 years later.

If I'd been using vagrant on a non windows platform for a while and already discovered it's benefits I might overlook this, but starting off with vagrant on Windows this doesn't give me confidence that Windows is a fully supported platform.

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