Vagrant: Vagrant ssh throws winpty.exe file does not exist

Created on 27 Dec 2017  ยท  18Comments  ยท  Source: hashicorp/vagrant

Vagrant version

2.0.1.

Host operating system

Windows 10 64-bit

Guest operating system

Ubuntu 64-bit

Expected behavior

After vagrant ssh connected screen should appear.

Actual behavior

It throws error:
Exec error: exec: "C:\HashiCorp\Vagrant\embedded\bin\cygwin\winpty.exe": file does not exist
When I opened cygwin dir I saw directories 32 a 64 there and both contains winpty.exe file

Steps to reproduce

  1. Run vagrant up in dir with Vagrantfile
  2. Run vagrant ssh
hoswindows

Most helpful comment

Same error here.

All 18 comments

@mesiarm - Could you please provide a gist link with the debug log? Thanks!

Same error here.

How can I generate a debug log from this command?
The workaround is to open a powershell prompt in the same directory, then 'vagrant ssh' works for me.

OK, that's interesting. I saw this thread https://github.com/hashicorp/vagrant/issues/9027 which shows me the undocumented debug command, but also, shows that 'vagrant --debug ssh' does actually connect fine..

I'll acquire the debug log for you in a mo.

Log: https://github.com/ryanhalley/vagrantssh

Since 'vagrant --debug ssh' works without an error, this may not help you.

Same error:
Exec error: exec: "C:\\HashiCorp\\Vagrant\\embedded\\bin\\cygwin\\winpty.exe": file does not exist

vagrant --debug ssh

It seems the winpty.exe and associated files have been moved one layer deeper in the file structure: C:\HashiCorp\Vagrant\embedded\bin\cygwin\64\winpty.exe

Copying the files up into cygwin fixes the original error but creates a new one:
C:/HashiCorp/Vagrant/bin/vagrant.exe: error while loading shared libraries: ?: cannot open shared object file: No such file or directory

Copying the files up into cygwin fixes the original error but creates a new one:
C:/HashiCorp/Vagrant/bin/vagrant.exe: error while loading shared libraries: ?: cannot open shared object file: No such file or directory

That workaround works for me, but make sure to copy the right winpty.exe version: if you installed the 32-bit vagrant, you'll want to copy the C:\HashiCorp\Vagrant\embedded\bin\cygwin\32\winpty.exe.

Copy the files do not solved the problem:

[2018-01-30 09:48.09] ~/Vagrant/devstation
[brimr.BRITOLIVEFL596C] โžค vagrant.exe ssh
โœ˜
โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€
[2018-01-30 09:48.53] ~/Vagrant/devstation

Now, simply do nothing.

After upgrade (2.0.2):

[brimr.BRITOLIVEFL596C] โžค vagrant.exe ssh
C:/HashiCorp/Vagrant/embedded/gems/gems/vagrant-2.0.2/lib/vagrant/util/subprocess.rb:146:in rescue in execute': (216) (Vagrant::Util::Subprocess::LaunchError) from C:/HashiCorp/Vagrant/embedded/gems/gems/vagrant-2.0.2/lib/vagrant/util/subprocess.rb:139:inexecute'
from C:/HashiCorp/Vagrant/embedded/gems/gems/vagrant-2.0.2/lib/vagrant/util/subprocess.rb:22:in execute' from C:/HashiCorp/Vagrant/embedded/gems/gems/vagrant-2.0.2/lib/vagrant/util/ssh.rb:96:inexec'
from C:/HashiCorp/Vagrant/embedded/gems/gems/vagrant-2.0.2/lib/vagrant/action/builtin/ssh_exec.rb:39:in call' from C:/HashiCorp/Vagrant/embedded/gems/gems/vagrant-2.0.2/lib/vagrant/action/warden.rb:34:incall'
from C:/HashiCorp/Vagrant/embedded/gems/gems/vagrant-2.0.2/plugins/providers/virtualbox/action/check_running.rb:16:in call' from C:/HashiCorp/Vagrant/embedded/gems/gems/vagrant-2.0.2/lib/vagrant/action/warden.rb:34:incall'
from C:/HashiCorp/Vagrant/embedded/gems/gems/vagrant-2.0.2/plugins/providers/virtualbox/action/check_accessible.rb:18:in call' from C:/HashiCorp/Vagrant/embedded/gems/gems/vagrant-2.0.2/lib/vagrant/action/warden.rb:34:incall'
from C:/HashiCorp/Vagrant/embedded/gems/gems/vagrant-2.0.2/plugins/providers/virtualbox/action/check_created.rb:16:in call' from C:/HashiCorp/Vagrant/embedded/gems/gems/vagrant-2.0.2/lib/vagrant/action/warden.rb:34:incall'
from C:/HashiCorp/Vagrant/embedded/gems/gems/vagrant-2.0.2/plugins/providers/virtualbox/action/check_virtualbox.rb:17:in call' from C:/HashiCorp/Vagrant/embedded/gems/gems/vagrant-2.0.2/lib/vagrant/action/warden.rb:34:incall'
from C:/HashiCorp/Vagrant/embedded/gems/gems/vagrant-2.0.2/lib/vagrant/action/builder.rb:116:in call' from C:/HashiCorp/Vagrant/embedded/gems/gems/vagrant-2.0.2/lib/vagrant/action/runner.rb:66:inblock in run'
from C:/HashiCorp/Vagrant/embedded/gems/gems/vagrant-2.0.2/lib/vagrant/util/busy.rb:19:in busy' from C:/HashiCorp/Vagrant/embedded/gems/gems/vagrant-2.0.2/lib/vagrant/action/runner.rb:66:inrun'
from C:/HashiCorp/Vagrant/embedded/gems/gems/vagrant-2.0.2/lib/vagrant/machine.rb:227:in action_raw' from C:/HashiCorp/Vagrant/embedded/gems/gems/vagrant-2.0.2/lib/vagrant/machine.rb:202:inblock in action'
from C:/HashiCorp/Vagrant/embedded/gems/gems/vagrant-2.0.2/lib/vagrant/machine.rb:184:in block in action' from C:/HashiCorp/Vagrant/embedded/gems/gems/vagrant-2.0.2/lib/vagrant/machine.rb:188:inaction'
from C:/HashiCorp/Vagrant/embedded/gems/gems/vagrant-2.0.2/plugins/commands/ssh/command.rb:66:in block in execute' from C:/HashiCorp/Vagrant/embedded/gems/gems/vagrant-2.0.2/lib/vagrant/plugin/v2/command.rb:238:inblock in with_target_vms'
from C:/HashiCorp/Vagrant/embedded/gems/gems/vagrant-2.0.2/lib/vagrant/plugin/v2/command.rb:232:in each' from C:/HashiCorp/Vagrant/embedded/gems/gems/vagrant-2.0.2/lib/vagrant/plugin/v2/command.rb:232:inwith_target_vms'
from C:/HashiCorp/Vagrant/embedded/gems/gems/vagrant-2.0.2/plugins/commands/ssh/command.rb:46:in execute' from C:/HashiCorp/Vagrant/embedded/gems/gems/vagrant-2.0.2/lib/vagrant/cli.rb:46:inexecute'
from C:/HashiCorp/Vagrant/embedded/gems/gems/vagrant-2.0.2/lib/vagrant/environment.rb:269:in cli' from C:/HashiCorp/Vagrant/embedded/gems/gems/vagrant-2.0.2/bin/vagrant:151:in

'
โœ˜
โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€
[2018-01-30 11:42.43] ~/Vagrant/devstation
[brimr.BRITOLIVEFL596C] โžค

See if you have an environment variable called VAGRANT_DETECTED_OS. Setting this was necessary to fix a Vagrant/Cygwin bug in earlier versions of Vagrant. Try removing this variable.

Here is what fixed this issue for for me.

  • Do not copy the winpty executables up one level as suggested in earlier posts. Leave things where they were installed.
  • If you have the VAGRANT_DETECTED_OS variable set, then unset it. This should allow Vagrant to find winpty,exe inside the 32/64 subdirectories. VAGRANT_DETECTED_OS was used to address a Cygwin/Vagrant bug in earlier versions of Vagrant.
  • export VAGRANT_PREFER_SYSTEM_BIN=1. See https://github.com/hashicorp/vagrant/issues/9143#issuecomment-343311263
  • Now try your vagrant ssh command.

@neilluna nailed it. To save anyone else the search for unsetting environment variables:

  1. unset VAGRANT_DETECTED_OS
  2. export VAGRANT_PREFER_SYSTEM_BIN=1

Upon closer inspection, export VAGRANT_DETECTED_OS=cygwin was in my .bashrc, so I removed and replaced it with export VAGRANT_PREFER_SYSTEM_BIN=1.

The error continues:

[2018-02-07 08:19.32] ~/Vagrant/devstation
[brimr.BRITOLIVEFL596C] โžค set | grep -i vagrant
PATH='/bin:/drives/c/Users/brimr/DOCUME~1/MobaXterm/slash/bin:/drives/c/windows:/drives/c/windows/system32:/drives/c/ProgramData/Oracle/Java/javapath:/drives/c/windows/system32:/drives/c/windows:/drives/c/windows/System32/Wbem:/drives/c/windows/System32/WindowsPowerShell/v1.0:/drives/c/Program Files (x86)/Common Files/EMC:/drives/c/Program Files/Intel/WiFi/bin:/drives/c/Program Files/Common Files/Intel/WirelessCommon:/drives/c/Program Files/Git/cmd:/drives/c/Program Files/Git/mingw64/bin:/drives/c/Program Files/Git/usr/bin:/drives/c/HashiCorp/Vagrant/bin:/drives/c/Program Files/Intel/WiFi/bin:/drives/c/Program Files/Common Files/Intel/WirelessCommon'
PWD=/home/mobaxterm/Vagrant/devstation
VAGRANT_PREFER_SYSTEM_BIN=1
WINPATH='C:\ProgramData\Oracle\Java\javapath;C:\windows\system32;C:\windows;C:\windows\System32\Wbem;C:\windows\System32\WindowsPowerShell\v1.0\;C:\Program Files (x86)\Common Files\EMC\;C:\Program Files\Intel\WiFi\bin\;C:\Program Files\Common Files\Intel\WirelessCommon\;C:\Program Files\Git\cmd;C:\Program Files\Git\mingw64\bin;C:\Program Files\Git\usr\bin;C:\HashiCorp\Vagrant\bin;C:\Program Files\Intel\WiFi\bin\;C:\Program Files\Common Files\Intel\WirelessCommon\'

โ”€
[2018-02-07 08:19.25] ~/Vagrant/devstation
[brimr.BRITOLIVEFL596C] โžค vagrant.exe ssh
C:/HashiCorp/Vagrant/embedded/gems/gems/vagrant-2.0.2/lib/vagrant/util/subprocess.rb:146:in rescue in execute': (216) (Vagrant::Util::Subprocess::LaunchError) from C:/HashiCorp/Vagrant/embedded/gems/gems/vagrant-2.0.2/lib/vagrant/util/subprocess.rb:139:inexecute'
from C:/HashiCorp/Vagrant/embedded/gems/gems/vagrant-2.0.2/lib/vagrant/util/subprocess.rb:22:in execute' from C:/HashiCorp/Vagrant/embedded/gems/gems/vagrant-2.0.2/lib/vagrant/util/ssh.rb:96:inexec'
from C:/HashiCorp/Vagrant/embedded/gems/gems/vagrant-2.0.2/lib/vagrant/action/builtin/ssh_exec.rb:39:in call' from C:/HashiCorp/Vagrant/embedded/gems/gems/vagrant-2.0.2/lib/vagrant/action/warden.rb:34:incall'
from C:/HashiCorp/Vagrant/embedded/gems/gems/vagrant-2.0.2/plugins/providers/virtualbox/action/check_running.rb:16:in call' from C:/HashiCorp/Vagrant/embedded/gems/gems/vagrant-2.0.2/lib/vagrant/action/warden.rb:34:incall'
from C:/HashiCorp/Vagrant/embedded/gems/gems/vagrant-2.0.2/plugins/providers/virtualbox/action/check_accessible.rb:18:in call' from C:/HashiCorp/Vagrant/embedded/gems/gems/vagrant-2.0.2/lib/vagrant/action/warden.rb:34:incall'
from C:/HashiCorp/Vagrant/embedded/gems/gems/vagrant-2.0.2/plugins/providers/virtualbox/action/check_created.rb:16:in call' from C:/HashiCorp/Vagrant/embedded/gems/gems/vagrant-2.0.2/lib/vagrant/action/warden.rb:34:incall'
from C:/HashiCorp/Vagrant/embedded/gems/gems/vagrant-2.0.2/plugins/providers/virtualbox/action/check_virtualbox.rb:17:in call' from C:/HashiCorp/Vagrant/embedded/gems/gems/vagrant-2.0.2/lib/vagrant/action/warden.rb:34:incall'
from C:/HashiCorp/Vagrant/embedded/gems/gems/vagrant-2.0.2/lib/vagrant/action/builder.rb:116:in call' from C:/HashiCorp/Vagrant/embedded/gems/gems/vagrant-2.0.2/lib/vagrant/action/runner.rb:66:inblock in run'
from C:/HashiCorp/Vagrant/embedded/gems/gems/vagrant-2.0.2/lib/vagrant/util/busy.rb:19:in busy' from C:/HashiCorp/Vagrant/embedded/gems/gems/vagrant-2.0.2/lib/vagrant/action/runner.rb:66:inrun'
from C:/HashiCorp/Vagrant/embedded/gems/gems/vagrant-2.0.2/lib/vagrant/machine.rb:227:in action_raw' from C:/HashiCorp/Vagrant/embedded/gems/gems/vagrant-2.0.2/lib/vagrant/machine.rb:202:inblock in action'
from C:/HashiCorp/Vagrant/embedded/gems/gems/vagrant-2.0.2/lib/vagrant/machine.rb:184:in block in action' from C:/HashiCorp/Vagrant/embedded/gems/gems/vagrant-2.0.2/lib/vagrant/machine.rb:188:inaction'
from C:/HashiCorp/Vagrant/embedded/gems/gems/vagrant-2.0.2/plugins/commands/ssh/command.rb:66:in block in execute' from C:/HashiCorp/Vagrant/embedded/gems/gems/vagrant-2.0.2/lib/vagrant/plugin/v2/command.rb:238:inblock in with_target_vms'
from C:/HashiCorp/Vagrant/embedded/gems/gems/vagrant-2.0.2/lib/vagrant/plugin/v2/command.rb:232:in each' from C:/HashiCorp/Vagrant/embedded/gems/gems/vagrant-2.0.2/lib/vagrant/plugin/v2/command.rb:232:inwith_target_vms'
from C:/HashiCorp/Vagrant/embedded/gems/gems/vagrant-2.0.2/plugins/commands/ssh/command.rb:46:in execute' from C:/HashiCorp/Vagrant/embedded/gems/gems/vagrant-2.0.2/lib/vagrant/cli.rb:46:inexecute'
from C:/HashiCorp/Vagrant/embedded/gems/gems/vagrant-2.0.2/lib/vagrant/environment.rb:269:in cli' from C:/HashiCorp/Vagrant/embedded/gems/gems/vagrant-2.0.2/bin/vagrant:151:in

'

[2018-02-07 08:23.02] ~/Vagrant/devstation
[brimr.BRITOLIVEFL596C] โžค vagrant.exe version
Installed Version: 2.0.2
Latest Version: 2.0.2

You're running an up-to-date version of Vagrant!

Hi all. Problem resolved for me.

  1. I had the problem with Vagrant 2.0.1
  2. I did not already have VAGRANT_DETECTED_OS, so no change made.
  3. I already had VAGRANT_PREFER_SYSTEM_BIN=1, so no change made.
  4. I installed Vagrant 2.0.2, rebooted, ran 'vagrant plugin repair', 'vagrant up', then 'vagrant ssh' - problem is now gone.

Thanks for help.

@rodrigobrim What shell are you running vagrant within? Do you have an ssh executable installed on your system that is available in your PATH?

Hey there,

I am going to close this due to lack of response. If this is still occurring, please open a _new issue_ and follow the provided issue template that appears when you click the "New Issue" button. This will help us in getting a reproduction and fix. Thanks! ๐Ÿ˜„

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

Related issues

jsirex picture jsirex  ยท  3Comments

cbednarski picture cbednarski  ยท  3Comments

luispabon picture luispabon  ยท  3Comments

DreadPirateShawn picture DreadPirateShawn  ยท  3Comments

barkingfoodog picture barkingfoodog  ยท  3Comments