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 1.8.1 is dependent on Cygwin #6788

Closed
Tillaert opened this issue Jan 4, 2016 · 27 comments · Fixed by #8749
Closed

Vagrant 1.8.1 is dependent on Cygwin #6788

Tillaert opened this issue Jan 4, 2016 · 27 comments · Fixed by #8749

Comments

@Tillaert
Copy link

Tillaert commented Jan 4, 2016

On windows, with vagrant 1.81., when running vagrant up, I get this message

The executable 'cygpath' Vagrant is trying to run was not
found in the %PATH% variable. This is an error. Please verify
this software is installed and on the path.

I do not have cygwin installed on my environment, nor have I seen that this is required.

@jamestoyer
Copy link

I'd like to add that this is the area of the debug trace that seems to cause issues

 INFO global: Vagrant version: 1.8.1
 INFO global: Ruby version: 2.2.3
 INFO global: RubyGems version: 2.4.5.1
...
 INFO host: Detected: windows!
DEBUG host: Searching for cap: provider_install_virtualbox
DEBUG host: Checking in: windows
DEBUG host: Found cap: provider_install_virtualbox in windows
DEBUG base: Windows, checking for VBoxManage on PATH first
DEBUG base: Windows. Trying VBOX_INSTALL_PATH for VBoxManage
DEBUG base: VBOX_INSTALL_PATH value: C:\Program Files\Oracle\VirtualBox\
 INFO environment: Running hook: environment_unload
 INFO runner: Preparing hooks for middleware sequence...
 INFO runner: 2 hooks defined.
 INFO runner: Running action: environment_unload #<Vagrant::Action::Builder:0x324ed30>
ERROR vagrant: Vagrant experienced an error! Details:
ERROR vagrant: #<Vagrant::Errors::CommandUnavailableWindows: The executable 'cygpath' Vagrant is trying to run was not
found in the %PATH% variable. This is an error. Please verify
this software is installed and on the path.>
ERROR vagrant: The executable 'cygpath' Vagrant is trying to run was not
found in the %PATH% variable. This is an error. Please verify
this software is installed and on the path.
ERROR vagrant: C:/HashiCorp/Vagrant/embedded/gems/gems/vagrant-1.8.1/lib/vagrant/util/subprocess.rb:31:in `initialize'
C:/HashiCorp/Vagrant/embedded/gems/gems/vagrant-1.8.1/lib/vagrant/util/subprocess.rb:22:in `new'
C:/HashiCorp/Vagrant/embedded/gems/gems/vagrant-1.8.1/lib/vagrant/util/subprocess.rb:22:in `execute'
C:/HashiCorp/Vagrant/embedded/gems/gems/vagrant-1.8.1/lib/vagrant/util/platform.rb:119:in `cygwin_windows_path'

C:/HashiCorp/Vagrant/embedded/gems/gems/vagrant-1.8.1/plugins/providers/virtualbox/driver/base.rb:50:in `block in initialize'
C:/HashiCorp/Vagrant/embedded/gems/gems/vagrant-1.8.1/plugins/providers/virtualbox/driver/base.rb:42:in `each' C:/HashiCorp/Vagrant/embedded/gems/gems/vagrant-1.8.1/plugins/providers/virtualbox/driver/base.rb:42:in `initialize'
C:/HashiCorp/Vagrant/embedded/gems/gems/vagrant-1.8.1/plugins/providers/virtualbox/driver/meta.rb:36:in `initialize'
C:/HashiCorp/Vagrant/embedded/gems/gems/vagrant-1.8.1/plugins/providers/virtualbox/provider.rb:9:in `new'
C:/HashiCorp/Vagrant/embedded/gems/gems/vagrant-1.8.1/plugins/providers/virtualbox/provider.rb:9:in `installed?'
C:/HashiCorp/Vagrant/embedded/gems/gems/vagrant-1.8.1/plugins/commands/up/command.rb:169:in `block in install_providers'
C:/HashiCorp/Vagrant/embedded/lib/ruby/2.2.0/set.rb:283:in `each_key'
C:/HashiCorp/Vagrant/embedded/lib/ruby/2.2.0/set.rb:283:in `each'
C:/HashiCorp/Vagrant/embedded/gems/gems/vagrant-1.8.1/plugins/commands/up/command.rb:161:in `install_providers'

C:/HashiCorp/Vagrant/embedded/gems/gems/vagrant-1.8.1/plugins/commands/up/command.rb:85:in `execute'
C:/HashiCorp/Vagrant/embedded/gems/gems/vagrant-1.8.1/lib/vagrant/cli.rb:42:in `execute'
C:/HashiCorp/Vagrant/embedded/gems/gems/vagrant-1.8.1/lib/vagrant/environment.rb:302:in `cli'
C:/HashiCorp/Vagrant/embedded/gems/gems/vagrant-1.8.1/bin/vagrant:174:in `<main>'
 INFO interface: error: The executable 'cygpath' Vagrant is trying to run was not
found in the %PATH% variable. This is an error. Please verify
this software is installed and on the path.
The executable 'cygpath' Vagrant is trying to run was not
found in the %PATH% variable. This is an error. Please verify
this software is installed and on the path.
 INFO interface: Machine: error-exit ["Vagrant::Errors::CommandUnavailableWindows", "The executable 'cygpath' Vagrant is trying to run was not\nfound in the %PATH% variable. This is an error. Please verify\nthis software is installed and on the path."]

Versions I'm using:
Vagrant version: 1.8.1
Ruby version: 2.2.3
RubyGems version: 2.4.5.1
Virtualbox version: 5.0.10
Windows 10 version: 1511 (OS Build 10586.36)

@thom8
Copy link

thom8 commented Jan 6, 2016

As a workaround I'd recommend running vagrant commands in Git bash -- https://git-for-windows.github.io/

@Tillaert
Copy link
Author

Tillaert commented Jan 7, 2016

That would work, however, in our environment that is just as problematic as running cygwin. We've reverted to Vagrant 1.7.4.

@StefanScherer
Copy link
Contributor

I can't reproduce this running on Windows 10, Vagrant 1.8.1, VirtualBox 5.0.12.

PS C:\Users\vagrant\Documents> $env:PATH
C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;C:\Windows\System32\WindowsPowerShell\v1.0\;c:\HashiCorp\Vagrant\bin

PS C:\Users\vagrant\Documents> $env:VAGRANT_LOG="debug"

PS C:\Users\vagrant\Documents> vagrant up
 INFO global: Vagrant version: 1.8.1
 INFO global: Ruby version: 2.2.3
 INFO global: RubyGems version: 2.4.5.1
...
 INFO host: Detected: windows!
DEBUG host: Searching for cap: provider_install_virtualbox
DEBUG host: Checking in: windows
DEBUG host: Found cap: provider_install_virtualbox in windows
DEBUG base: Windows, checking for VBoxManage on PATH first
DEBUG base: Windows. Trying VBOX_INSTALL_PATH for VBoxManage
DEBUG base: VBOX_INSTALL_PATH value: C:\Program Files\Oracle\VirtualBox\
 INFO base: VBoxManage path: C:/Program Files/Oracle/VirtualBox/VBoxManage.exe
 INFO subprocess: Starting process: ["C:/Program Files/Oracle/VirtualBox/VBoxManage.exe", "--version"]
 INFO subprocess: Command not in installer, restoring original environment...
DEBUG subprocess: Selecting on IO
DEBUG subprocess: stdout: 5.0.12r104815
DEBUG subprocess: Waiting for process to exit. Remaining to timeout: 32000
DEBUG subprocess: Exit status: 0
DEBUG meta: Finding driver for VirtualBox version: 5.0.12
 INFO meta: Using VirtualBox driver: VagrantPlugins::ProviderVirtualBox::Driver::Version_5_0
DEBUG base: Windows, checking for VBoxManage on PATH first
DEBUG base: Windows. Trying VBOX_INSTALL_PATH for VBoxManage
DEBUG base: VBOX_INSTALL_PATH value: C:\Program Files\Oracle\VirtualBox\
 INFO base: VBoxManage path: C:/Program Files/Oracle/VirtualBox/VBoxManage.exe
DEBUG command: Getting target VMs for command. Arguments:
DEBUG command:  -- names: ["default"]
DEBUG command:  -- options: {:provider=>nil}
DEBUG command: Finding machine that match name: default
 INFO loader: Set "24787596_machine_default" = []
 INFO loader: Loading configuration in order: [:home, :root, "24787596_machine_default"]
DEBUG loader: Loading from: root (cache)
DEBUG loader: Configuration loaded successfully, finalizing and returning
DEBUG push: finalizing
DEBUG base: Windows, checking for VBoxManage on PATH first
DEBUG base: Windows. Trying VBOX_INSTALL_PATH for VBoxManage
DEBUG base: VBOX_INSTALL_PATH value: C:\Program Files\Oracle\VirtualBox\
 INFO base: VBoxManage path: C:/Program Files/Oracle/VirtualBox/VBoxManage.exe
DEBUG meta: Finding driver for VirtualBox version: 5.0.12
 INFO meta: Using VirtualBox driver: VagrantPlugins::ProviderVirtualBox::Driver::Version_5_0
DEBUG base: Windows, checking for VBoxManage on PATH first
DEBUG base: Windows. Trying VBOX_INSTALL_PATH for VBoxManage
DEBUG base: VBOX_INSTALL_PATH value: C:\Program Files\Oracle\VirtualBox\
 INFO base: VBoxManage path: C:/Program Files/Oracle/VirtualBox/VBoxManage.exe
 INFO environment: Getting machine: default (virtualbox)
 INFO environment: Uncached load of machine.
DEBUG base: Windows, checking for VBoxManage on PATH first
DEBUG base: Windows. Trying VBOX_INSTALL_PATH for VBoxManage
DEBUG base: VBOX_INSTALL_PATH value: C:\Program Files\Oracle\VirtualBox\
 INFO base: VBoxManage path: C:/Program Files/Oracle/VirtualBox/VBoxManage.exe
DEBUG meta: Finding driver for VirtualBox version: 5.0.12
 INFO meta: Using VirtualBox driver: VagrantPlugins::ProviderVirtualBox::Driver::Version_5_0
DEBUG base: Windows, checking for VBoxManage on PATH first
DEBUG base: Windows. Trying VBOX_INSTALL_PATH for VBoxManage
DEBUG base: VBOX_INSTALL_PATH value: C:\Program Files\Oracle\VirtualBox\
 INFO base: VBoxManage path: C:/Program Files/Oracle/VirtualBox/VBoxManage.exe
 INFO loader: Set "24787596_machine_default" = []
 INFO loader: Loading configuration in order: [:home, :root, "24787596_machine_default"]
DEBUG loader: Loading from: root (cache)
DEBUG loader: Configuration loaded successfully, finalizing and returning
DEBUG push: finalizing
 INFO box_collection: Box found: boxcutter/ubuntu1404 (virtualbox)
 INFO loader: Set :"30791160_boxcutter/ubuntu1404_virtualbox" = ["#<Pathname:C:/Users/vagrant/.vagrant.d/boxes/boxcutter-VAGRANTSLASH-ubuntu1404/2.0.13/virtualbox/Vagrantfile>"]
DEBUG loader: Populating proc cache for #<Pathname:C:/Users/vagrant/.vagrant.d/boxes/boxcutter-VAGRANTSLASH-ubuntu1404/2.0.13/virtualbox/Vagrantfile>
DEBUG loader: Load procs for pathname: C:/Users/vagrant/.vagrant.d/boxes/boxcutter-VAGRANTSLASH-ubuntu1404/2.0.13/virtualbox/Vagrantfile
 INFO loader: Loading configuration in order: [:"30791160_boxcutter/ubuntu1404_virtualbox", :home, :root, "24787596_machine_default"]
DEBUG loader: Loading from: 30791160_boxcutter/ubuntu1404_virtualbox (evaluating)
DEBUG loader: Loading from: root (cache)
DEBUG loader: Configuration loaded successfully, finalizing and returning
DEBUG push: finalizing

I only can reproduce it if I add a directory that contains "cygwin" to my PATH (but this directory does not exist):

PS C:\Users\vagrant\Documents> $env:PATH="$env:PATH;C:\cygwin"
DEBUG host: Trying: windows
 INFO host: Detected: windows!
 INFO runner: Preparing hooks for middleware sequence...
 INFO runner: 1 hooks defined.
 INFO runner: Running action: environment_unload #<Vagrant::Action::Builder:0x2f7fb88>
ERROR vagrant: Vagrant experienced an error! Details:
ERROR vagrant: #<Vagrant::Errors::ProviderNotUsable: The provider 'virtualbox' that was requested to back the machine
'default' is reporting that it isn't usable on this system. The
reason is shown below:

The executable 'cygpath' Vagrant is trying to run was not
found in the %PATH% variable. This is an error. Please verify
this software is installed and on the path.>
ERROR vagrant: The provider 'virtualbox' that was requested to back the machine
'default' is reporting that it isn't usable on this system. The
reason is shown below:

The executable 'cygpath' Vagrant is trying to run was not
found in the %PATH% variable. This is an error. Please verify
this software is installed and on the path.

This is caused by this assumption: https://github.com/mitchellh/vagrant/blob/master/lib/vagrant/util/platform.rb#L20-L23

So what does your PATH environment contain?

@jamestoyer
Copy link

Doh. That's rather simple. I can't believe I didn't look at that.

I do have cygwin in my PATH (c:\bin\cygwin for what it matters), but I don't have the bin folder in my PATH. I installed cygwin a while back using Chocolatey so I guess it didn't add that to the PATH. In my case, I'll just uninstall cygwin

@Tillaert
Copy link
Author

Tillaert commented Jan 8, 2016

My path contains c:\tools\cygwin, but not to c:\tools\cygwin\bin. I guess that's some remnant from a chocolatey install.

@Swoogan
Copy link

Swoogan commented Jan 27, 2016

I ran into this bug as well. I just installed vagrant via chocolatey and get the same error.

I see that my path includes C:\ProgramData\chocolatey\lib\Cygwin\tools\cygwin, which I assume was put there by chocolately.

That implies that a clean install of Windows + Chocolately + vagrant will fail. Or, in other words, vagrant won't work when installed via chocolatey.

@kstruis
Copy link

kstruis commented Apr 20, 2016

I found this is an issue on my osx Vagrant setup as well... having any cygwin reference in your PATH renders Vagrant to error out not able to find the cygpath executable

@smks
Copy link

smks commented May 31, 2016

I found changing from "C:\tools\cygwin" to "C:\tools\cygwin\bin" made it work.

@sethvargo
Copy link
Contributor

Hi all,

This appears to be a bug in the chocolately installer. Has anyone raised the issue with those maintainers?

@ferventcoder
Copy link

Just learned of this - Chocolatey doesn't create the Cygwin variable nor does it depend on Cygwin. So more appropriately this is an issue with the community package for Cygwin on the default community repository - that package is maintained in this repo - https://github.com/chocolatey/chocolatey-coreteampackages. Please raise the issue there. Thanks!

@ferventcoder
Copy link

ferventcoder commented Jun 16, 2016

I also never ran into this issue and I have a Chocolatey-installed Vagrant (even 1.8.1 for the verifier service), so I'm pretty sure this is more an issue only if you've also installed the cygwin package as well.

@Swoogan the cygwin package is what creates the PATH variable you are seeing.

@ferventcoder
Copy link

FWIW I looked at the code @StefanScherer pointed out - you can take Choco out of the equation entirely.

Just put the word cygwin in your PATH variable somewhere. :)

@ferventcoder
Copy link

ferventcoder commented Jun 16, 2016

As an explanation for the cygwin package because I think I know what is going on - the path to the cygwin setup exe is needed for running cyg-get (another package that helps manage cygwin packages), the actual packages installed by cygwin are not put on PATH, they are left for when you start the bash shell to keep from conflicting with Windows tools.

@PatrickLang
Copy link
Contributor

I just hit this while running my own build from source. I'm not sure what changed on my system because this all worked when I submitted PR #7738 .

For reference, here's my $ENV:PATH

C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;C:\Windows\System32\WindowsPowerShell\v1.0\;C:\ProgramData\chocolatey\bin;C:\Program Fil
es (x86)\vim\vim74;C:\Program Files\Mercurial;C:\Program Files\TortoiseHg\;C:\tools\python2;C:\tools\python2-x86_32;C:\Program Files (x86)\IVI F
oundation\VISA\WinNT\Bin;C:\Program Files\IVI Foundation\VISA\Win64\Bin\;C:\Program Files (x86)\IVI Foundation\VISA\WinNT\Bin\;C:\Program Files
(x86)\GTK2-Runtime\bin;C:\Program Files (x86)\Symantec\VIP Access Client\;C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS\System32\Wbem;C:\WINDOWS\Sys
tem32\WindowsPowerShell\v1.0\;C:\Program Files\Git\cmd;C:\Program Files (x86)\Windows Kits\8.1\Windows Performance Toolkit\;C:\Program Files (x8
6)\Skype\Phone\;C:\Program Files (x86)\Microsoft SQL Server\Client SDK\ODBC\130\Tools\Binn\;C:\Program Files (x86)\Microsoft SQL Server\130\Tool
s\Binn\;C:\Program Files (x86)\Microsoft SQL Server\130\DTS\Binn\;C:\Program Files (x86)\Microsoft SQL Server\130\Tools\Binn\ManagementStudio\;C
:\Program Files (x86)\PuTTY\;C:\HashiCorp\Vagrant\bin;C:\Go\bin;C:\Program Files (x86)\Microsoft VS Code\bin;C:\Users\Patrick\AppData\Local\Micr
osoft\WindowsApps;$GOPATH/bin;C:\Program Files\docker\;C:\Program Files\dotnet\;C:\Program Files\Microsoft DNX\Dnvm\;C:\Program Files\nodejs\;C:
\Program Files (x86)\Microsoft VS Code\bin;C:\Users\Patrick\AppData\Local\Microsoft\WindowsApps;$GOPATH/bin;C:\Users\Patrick\AppData\Roaming\npm

@PatrickLang
Copy link
Contributor

I downloaded http://www.paehl.com/open_source/?download=curl_750_2.zip and extracted curl.exe to c:\ruby22\bin\curl.exe, tried again, and it got further but still failed. I suspect the best goal here is to get CURB working instead on my Win32 setup and hopefully it won't need curl.exe. hmm.

PS C:\Users\Patrick.coffee\Source\Repos\packer-windows> ruby ..\vagrant\exec\vagrant box add --name .\windows_2016_docke
r .\windows_2016_docker_hyperv.box
Vagrant appears to be running in a Bundler environment. Your
existing Gemfile will be used. Vagrant will not auto-load any plugins
installed with `vagrant plugin`. Vagrant will autoload any plugins in
the 'plugins' group in your Gemfile. You can force Vagrant to take over
with VAGRANT_FORCE_BUNDLER.

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.
==> box: Box file was not detected as metadata. Adding it directly...
==> box: Adding box '.\windows_2016_docker' (v0) for provider:
    box: Unpacking necessary files from: file://C:/Users/Patrick.coffee/Source/Repos/packer-windows/windows_2016_docker_
hyperv.box
    box: Progress: 100% (Rate: 113M/s, Estimated time remaining: --:--:--)
The box failed to unpackage properly. Please verify that the box
file you're trying to add is not corrupted and try again. The
output from attempting to unpackage (if any):

x Vagrantfile
x Virtual Hard Disks\\WindowsServer2016TP5Docker.vhdx: Write failed
x Virtual Machines\\530E190E-FFED-445A-AEBC-452DE5F2498B.VMRS
x Virtual Machines\\530E190E-FFED-445A-AEBC-452DE5F2498B.vmcx
x Virtual Machines\\box.xml
x metadata.json
bin/bsdtar.EXE: Error exit delayed from previous errors.

@StefanScherer
Copy link
Contributor

What about using all the tools that are in the embedded folder of the Vagrant installation?
Seems to me we should put all the dev dependencies into a Windows Dockerfile, that would be a thing :-)

@chrisroberts chrisroberts added this to the 1.9 milestone Oct 3, 2016
@chrisroberts
Copy link
Member

Closing this now as it seems to be mainly related to non-standard installation issues and local configurations. If the problem persists, please open a new issue. Thanks!

@ferventcoder
Copy link

ferventcoder commented Dec 9, 2016

@chrisroberts so there is better cygwin detection now - vagrant doesn't simply look for cygwin in the PATH?

@ferventcoder
Copy link

Sorry, that was a question. If that is not fixed then it is still an issue.

@ferventcoder
Copy link

There is a good repro and what is causing the issue in @StefanScherer 's comments at #6788 (comment)

@masaeedu
Copy link

masaeedu commented Jul 2, 2017

Why is vagrant even looking at my PATH to detect cygwin? I have cygwin on my path for other work, why does this make it impossible to use vagrant?

@masaeedu
Copy link

masaeedu commented Jul 2, 2017

@chrisroberts This is not a "non-standard installation issue", vagrant is checking for something on my PATH that has nothing to do with vagrant, then making some incorrect assumptions and choking. The bug is with vagrant, not cygwin or the environment in which the problem arises.

@masaeedu
Copy link

masaeedu commented Jul 2, 2017

Also, at the very least the error message is nonsense because the problem only arises when I do have cygpath on my PATH.

cygpath bug

For reference, cygpath is a tool for translating between Windows and "cygwin-ized" Unix paths.

@chrisroberts
Copy link
Member

@masaeedu Okay, so the core of the problem is having Cygwin installed, but running vagrant outside of Cygwin which results in errors because it is getting a false positive of running within a Cygwin environment. Is that a correct assessment?

@masaeedu
Copy link

masaeedu commented Jul 3, 2017

@chrisroberts I'm not familiar with how Vagrant detects cygwin internally, and for what purpose, but that seems like a good assessment. I have cygwin installed, and I have the binaries on my PATH, but I am not running vagrant from a bash shell.

@ghost
Copy link

ghost commented Apr 1, 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 Apr 1, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging a pull request may close this issue.