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

Rsync on Windows using cwRsync fails with No such file or directory (2) #3230

Closed
balajisivaraman opened this Issue Mar 15, 2014 · 66 comments

Comments

Projects
None yet
@balajisivaraman

balajisivaraman commented Mar 15, 2014

Hi,

I am trying to set up an Rsync share on a Windows 8 machine with a Ubuntu 12.04 LTS Guest VM, and it fails with the following error.

Balaji@GANESHA-PC /c/Coding/Ruby/discourse (master)
$ vagrant up
Bringing machine 'default' up with 'virtualbox' provider...
==> default: Importing base box 'discourse-0.9.7'...
==> default: Matching MAC address for NAT networking...
==> default: Setting the name of the VM: discourse_default_1394892063920_77253
==> default: Clearing any previously set network interfaces...
==> default: Preparing network interfaces based on configuration...
    default: Adapter 1: nat
    default: Adapter 2: hostonly
==> default: Forwarding ports...
    default: 3000 => 4000 (adapter 1)
    default: 1080 => 4080 (adapter 1)
    default: 22 => 2222 (adapter 1)
==> default: Running 'pre-boot' VM customizations...
==> default: Booting VM...
==> default: Waiting for machine to boot. This may take a few minutes...
    default: SSH address: 127.0.0.1:2222
    default: SSH username: vagrant
    default: SSH auth method: private key
    default: Error: Connection timeout. Retrying...
==> default: Machine booted and ready!
==> default: Checking for guest additions in VM...
    default: The guest additions on this VM do not match the installed version of
    default: VirtualBox! In most cases this is fine, but in rare cases it can
    default: prevent things such as shared folders from working properly. If you see
    default: shared folder errors, please make sure the guest additions within the
    default: virtual machine match the version of VirtualBox you have installed on
    default: your host and reload your VM.
    default:
    default: Guest Additions Version: 4.2.0
    default: VirtualBox Version: 4.3
==> default: Configuring and enabling network interfaces...
==> default: Rsyncing folder: /c/Coding/Ruby/discourse/ => /vagrant
There was an error when attempting to rsync a synced folder.
Please inspect the error message below for more info.

Host path: /c/Coding/Ruby/discourse/
Guest path: /vagrant
Command: rsync --verbose --archive --delete -z -e ssh -p 2222 -o StrictHostKeyChecking=no -i 'C:/Users/Balaji/.vagrant.d/insecure_private_key' --exclude .vagrant/ /c/Coding/Ruby/discourse/ vagrant@127.0.0.1:/vagrant
Error: rsync: change_dir "/c/Coding/Ruby/discourse" failed: No such file or directory (2)
FATAL I/O ERROR: dying to avoid a --delete-during issue with a pre-3.0.7 receiver.
rsync error: requested action not supported (code 4) at flist.c(1882) [sender=3.1.0]

I am using cwRsync version 3.1.0 downloaded from the following location: https://www.itefix.no/download/cwRsync_5.2.2_Free.zip

I am running this in a Git Bash window with Administrative Privileges. My user is also the owner of the directory being shared, so I doubt whether it could be an issue where I don't have enough privileges.

The Rsync version in the Guest is 3.0.9. At first, I thought that was the issue. But even if I manually install 3.1.0 from source, I am getting the same error.

Any advice? Thanks in advance.

@kylemacfarlane

This comment has been minimized.

Show comment
Hide comment
@kylemacfarlane

kylemacfarlane Mar 16, 2014

I had these problems yesterday.

  1. First you need to upgrade rsync on the virtual machine to avoid the issue with --delete-during. After installing 3.1.0 from source make sure you reboot the guest or clear the path cache.

  2. Then there's a bug with Vagrant and cwrsync that I mentioned in #3086. For now, just edit C:\HashiCorp\Vagrant\embedded\gems\gems\vagrant-1.5.1\plugins\synced_folders\rsync\helper.rb and add hostpath = "/cygdrive" + hostpath to line 74. It's a terrible solution but quick and simple.

kylemacfarlane commented Mar 16, 2014

I had these problems yesterday.

  1. First you need to upgrade rsync on the virtual machine to avoid the issue with --delete-during. After installing 3.1.0 from source make sure you reboot the guest or clear the path cache.

  2. Then there's a bug with Vagrant and cwrsync that I mentioned in #3086. For now, just edit C:\HashiCorp\Vagrant\embedded\gems\gems\vagrant-1.5.1\plugins\synced_folders\rsync\helper.rb and add hostpath = "/cygdrive" + hostpath to line 74. It's a terrible solution but quick and simple.

@balajisivaraman

This comment has been minimized.

Show comment
Hide comment
@balajisivaraman

balajisivaraman Mar 16, 2014

@kylemacfarlane Thanks! Works like a charm!

balajisivaraman commented Mar 16, 2014

@kylemacfarlane Thanks! Works like a charm!

@brianreavis

This comment has been minimized.

Show comment
Hide comment
@brianreavis

brianreavis Jun 10, 2014

@balajisi Can we reopen this? This is still an issue on 1.6.3 (and shouldn't have to be fixed by editing the vagrant source).

https://github.com/mitchellh/vagrant/blob/master/plugins/synced_folders/rsync/helper.rb#L43

brianreavis commented Jun 10, 2014

@balajisi Can we reopen this? This is still an issue on 1.6.3 (and shouldn't have to be fixed by editing the vagrant source).

https://github.com/mitchellh/vagrant/blob/master/plugins/synced_folders/rsync/helper.rb#L43

@francislavoie

This comment has been minimized.

Show comment
Hide comment
@francislavoie

francislavoie Jun 15, 2014

+1, this should be re-opened. I had to make this change as well to get rsync working.

francislavoie commented Jun 15, 2014

+1, this should be re-opened. I had to make this change as well to get rsync working.

@kriserickson

This comment has been minimized.

Show comment
Hide comment
@kriserickson

kriserickson Jun 16, 2014

Also having this problem in 1.6.3. I found that platform.rb wasn't detecting cygwin, so switching to see if ENV path contained cygwin fixed it, but this a pretty bad hack.

kriserickson commented Jun 16, 2014

Also having this problem in 1.6.3. I found that platform.rb wasn't detecting cygwin, so switching to see if ENV path contained cygwin fixed it, but this a pretty bad hack.

@gitTrusty

This comment has been minimized.

Show comment
Hide comment
@gitTrusty

gitTrusty Jun 19, 2014

+1, re-open please. Also having this problem in 1.6.3. I had to make this change to get rsync working.

gitTrusty commented Jun 19, 2014

+1, re-open please. Also having this problem in 1.6.3. I had to make this change to get rsync working.

@kellyselden

This comment has been minimized.

Show comment
Hide comment
@kellyselden

kellyselden Jun 19, 2014

It now needs to be applied on line 43:
hostpath = "/cygdrive" + Vagrant::Util::Platform.cygwin_path(hostpath)

kellyselden commented Jun 19, 2014

It now needs to be applied on line 43:
hostpath = "/cygdrive" + Vagrant::Util::Platform.cygwin_path(hostpath)

@francislavoie

This comment has been minimized.

Show comment
Hide comment
@francislavoie

francislavoie Jun 19, 2014

I think someone should probably make a new issue, this won't get any attention since it's already closed.

francislavoie commented Jun 19, 2014

I think someone should probably make a new issue, this won't get any attention since it's already closed.

@brianreavis

This comment has been minimized.

Show comment
Hide comment
@brianreavis

brianreavis Jun 20, 2014

@francislavoie I think you're right. One final attempt: @mitchellh Re-open?

brianreavis commented Jun 20, 2014

@francislavoie I think you're right. One final attempt: @mitchellh Re-open?

@machek

This comment has been minimized.

Show comment
Hide comment
@machek

machek Jun 20, 2014

same problem and "/cygdrive" + helped, should be fixed

machek commented Jun 20, 2014

same problem and "/cygdrive" + helped, should be fixed

@starrychloe

This comment has been minimized.

Show comment
Hide comment
@starrychloe

starrychloe Jun 25, 2014

Version 1.5.4 worked, but version 1.6.3 broke. It treats c:\Users as /c/Users, which doesn't work on Windows. It should use the colon: c:/Users. (Wait - should not use colon. Every other Cygwin binary is tolerant of c: except rsync, which treats it as host:path. Use /cygdrive/c/path instead.)

==> default: Rsyncing folder: /c/Users/Chloe/Documents/ODesk/AIDC/BK-Development/ => /rsync/BK-Development
There was an error when attempting to rsync a synced folder.
Please inspect the error message below for more info.

Host path: /c/Users/Chloe/Documents/ODesk/AIDC/BK-Development/
Guest path: /rsync/BK-Development
Command: rsync --verbose --archive --delete -z --copy-links --chmod=ugo=rwX --no-perms --no-owner --no-group --rsync-path sudo rsync -e ssh -p 2222 -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null -i 'C:/Users/Chloe/.vagrant.d/insecure_private_key' --exclude .vagrant/ /c/Users/Chloe/Documents/ODesk/AIDC/BK-Development/ vagrant@127.0.0.1:/rsync/BK-Development
Error: Warning: Permanently added '[127.0.0.1]:2222' (RSA) to the list of known hosts.
rsync: change_dir "/c/Users/Chloe/Documents/ODesk/AIDC/BK-Development" failed: No such file or directory (2)
FATAL I/O ERROR: dying to avoid a --delete-during issue with a pre-3.0.7 receiver.
rsync error: requested action not supported (code 4) at /home/lapo/package/rsync-3.0.9-1/src/rsync-3.0.9/flist.c(1800) [sender=3.0.9]

starrychloe commented Jun 25, 2014

Version 1.5.4 worked, but version 1.6.3 broke. It treats c:\Users as /c/Users, which doesn't work on Windows. It should use the colon: c:/Users. (Wait - should not use colon. Every other Cygwin binary is tolerant of c: except rsync, which treats it as host:path. Use /cygdrive/c/path instead.)

==> default: Rsyncing folder: /c/Users/Chloe/Documents/ODesk/AIDC/BK-Development/ => /rsync/BK-Development
There was an error when attempting to rsync a synced folder.
Please inspect the error message below for more info.

Host path: /c/Users/Chloe/Documents/ODesk/AIDC/BK-Development/
Guest path: /rsync/BK-Development
Command: rsync --verbose --archive --delete -z --copy-links --chmod=ugo=rwX --no-perms --no-owner --no-group --rsync-path sudo rsync -e ssh -p 2222 -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null -i 'C:/Users/Chloe/.vagrant.d/insecure_private_key' --exclude .vagrant/ /c/Users/Chloe/Documents/ODesk/AIDC/BK-Development/ vagrant@127.0.0.1:/rsync/BK-Development
Error: Warning: Permanently added '[127.0.0.1]:2222' (RSA) to the list of known hosts.
rsync: change_dir "/c/Users/Chloe/Documents/ODesk/AIDC/BK-Development" failed: No such file or directory (2)
FATAL I/O ERROR: dying to avoid a --delete-during issue with a pre-3.0.7 receiver.
rsync error: requested action not supported (code 4) at /home/lapo/package/rsync-3.0.9-1/src/rsync-3.0.9/flist.c(1800) [sender=3.0.9]
@francislavoie

This comment has been minimized.

Show comment
Hide comment
@francislavoie

francislavoie Jun 25, 2014

That's not the problem. Cygwin uses unix style paths and mounts the C drive in it's own /cygdrive directory. The path /cygdrive/c/users is the correct path when using cygwin.

francislavoie commented Jun 25, 2014

That's not the problem. Cygwin uses unix style paths and mounts the C drive in it's own /cygdrive directory. The path /cygdrive/c/users is the correct path when using cygwin.

@nomasprime

This comment has been minimized.

Show comment
Hide comment
@nomasprime

nomasprime commented Jul 2, 2014

+1

2 similar comments
@ckatzorke

This comment has been minimized.

Show comment
Hide comment
@ckatzorke

ckatzorke commented Jul 10, 2014

+1

@mickdelaney

This comment has been minimized.

Show comment
Hide comment
@mickdelaney

mickdelaney commented Jul 11, 2014

+1

@kriserickson

This comment has been minimized.

Show comment
Hide comment
@kriserickson

kriserickson Jul 11, 2014

As I briefly stated above (but not very clearly I see) the problem is the test in HashiCorp/Vagrant/embedded/gems/gems/vagrant-1.6.3/lib/vagrant/util/platform.rb for ENV["VAGRANT_DETECTED_OS"] that no longer properly detects cygwin. VAGRANT_DETECTED_OS is coming from uname. My guess is that is because on a lot of people's system uname is being hijacked by mysgit and coming back as MING32_NT rather than CYGWIN_NT. I fixed this by hacking the test for cygwin to be a test for whether cygwin in the ENV["PATH"] and that seemed to fix my problem, however I don't think it is the appropriate way to check for cygwin but I can submit that patch if people desire.

kriserickson commented Jul 11, 2014

As I briefly stated above (but not very clearly I see) the problem is the test in HashiCorp/Vagrant/embedded/gems/gems/vagrant-1.6.3/lib/vagrant/util/platform.rb for ENV["VAGRANT_DETECTED_OS"] that no longer properly detects cygwin. VAGRANT_DETECTED_OS is coming from uname. My guess is that is because on a lot of people's system uname is being hijacked by mysgit and coming back as MING32_NT rather than CYGWIN_NT. I fixed this by hacking the test for cygwin to be a test for whether cygwin in the ENV["PATH"] and that seemed to fix my problem, however I don't think it is the appropriate way to check for cygwin but I can submit that patch if people desire.

@kylemacfarlane

This comment has been minimized.

Show comment
Hide comment
@kylemacfarlane

kylemacfarlane Jul 11, 2014

The problem specifically with cwRsync (which this ticket is about) is that it's a standalone version of rsync for Windows and doesn't require Cygwin to be installed. So with a regular standalone cwRsync installation, Cygwin will never be on the PATH and Vagrant will never add the required /cygdrive prefix.

The solution I think is to add a configuration setting that allows users to set their own prefix. Currently Vagrant tries to be smart and detect the environment but it obviously doesn't work reliably.

kylemacfarlane commented Jul 11, 2014

The problem specifically with cwRsync (which this ticket is about) is that it's a standalone version of rsync for Windows and doesn't require Cygwin to be installed. So with a regular standalone cwRsync installation, Cygwin will never be on the PATH and Vagrant will never add the required /cygdrive prefix.

The solution I think is to add a configuration setting that allows users to set their own prefix. Currently Vagrant tries to be smart and detect the environment but it obviously doesn't work reliably.

@rarkins

This comment has been minimized.

Show comment
Hide comment
@rarkins

rarkins commented Jul 21, 2014

+1

@khromov

This comment has been minimized.

Show comment
Hide comment
@khromov

khromov Jul 27, 2014

+1 same issue

khromov commented Jul 27, 2014

+1 same issue

@n0v3xx

This comment has been minimized.

Show comment
Hide comment
@n0v3xx

n0v3xx Aug 15, 2014

+1 same issue vagrant 1.6.3

n0v3xx commented Aug 15, 2014

+1 same issue vagrant 1.6.3

@JVMartin

This comment has been minimized.

Show comment
Hide comment
@JVMartin

JVMartin Aug 18, 2014

+1 same here.

JVMartin commented Aug 18, 2014

+1 same here.

@Venorcis

This comment has been minimized.

Show comment
Hide comment
@Venorcis

Venorcis Sep 1, 2014

+1 in vagrant 1.6.3 as well (with cwRsync installed and on PATH)

Changing line 43 in C:\HashiCorp\Vagrant\embedded\gems\gems\vagrant-1.6.3\plugins\synced_folders\rsync\helper.rb to hostpath = "/cygdrive" + Vagrant::Util::Platform.cygwin_path(hostpath) does work though

Venorcis commented Sep 1, 2014

+1 in vagrant 1.6.3 as well (with cwRsync installed and on PATH)

Changing line 43 in C:\HashiCorp\Vagrant\embedded\gems\gems\vagrant-1.6.3\plugins\synced_folders\rsync\helper.rb to hostpath = "/cygdrive" + Vagrant::Util::Platform.cygwin_path(hostpath) does work though

@mdoelker

This comment has been minimized.

Show comment
Hide comment
@mdoelker

mdoelker Sep 3, 2014

I also had trouble with vagrant not detecting cygwin. After reading @kriserickson 's comment and inspecting the source, manually adding VAGRANT_DETECTED_OS=cygwin to the environment fixed it for me. I'm on Vagrant 1.6.3 with rsync 3.0.9 on both win (via cygwin, non-standalone) and vm. The issue is still valid though, as manually setting this should not be necessary.

mdoelker commented Sep 3, 2014

I also had trouble with vagrant not detecting cygwin. After reading @kriserickson 's comment and inspecting the source, manually adding VAGRANT_DETECTED_OS=cygwin to the environment fixed it for me. I'm on Vagrant 1.6.3 with rsync 3.0.9 on both win (via cygwin, non-standalone) and vm. The issue is still valid though, as manually setting this should not be necessary.

@kummerer94

This comment has been minimized.

Show comment
Hide comment
@kummerer94

kummerer94 Sep 6, 2014

I got the newest Vagrant Version installed (1.6.5) and I have the same problem. I have Cygwin and rsync installed.

My output is:

Host path: /cygdrive/c/Users/Alexander/repos/stipnetz/
Guest path: /var/www
Command: rsync --verbose --archive --delete -z --copy-links --chmod=ugo=rwX --no
-perms --no-owner --no-group --rsync-path sudo rsync -e ssh -p 2222 -o StrictHos
tKeyChecking=no -o UserKnownHostsFile=/dev/null -i 'C:/Users/Alexander/.vagrant.
d/insecure_private_key' --exclude .vagrant/ /cygdrive/c/Users/Alexander/repos/st
ipnetz/ vagrant@127.0.0.1:/var/www
Error: rsync: Failed to exec ssh: No such file or directory (2)
rsync error: error in IPC code (code 14) at /usr/src/ports/rsync/rsync-3.0.9-1/s
rc/rsync-3.0.9/pipe.c(84) [sender=3.0.9]
rsync: writefd_unbuffered failed to write 4 bytes to socket [sender]: Broken pip
e (32)
rsync error: error in IPC code (code 14) at /usr/src/ports/rsync/rsync-3.0.9-1/s
rc/rsync-3.0.9/io.c(1532) [sender=3.0.9]

I tried to change live 43 of helper.rb but that did not work for me. The same for adding VAGRANT_DETECTED_OS = "cygwin"to my Vagrantfile.

kummerer94 commented Sep 6, 2014

I got the newest Vagrant Version installed (1.6.5) and I have the same problem. I have Cygwin and rsync installed.

My output is:

Host path: /cygdrive/c/Users/Alexander/repos/stipnetz/
Guest path: /var/www
Command: rsync --verbose --archive --delete -z --copy-links --chmod=ugo=rwX --no
-perms --no-owner --no-group --rsync-path sudo rsync -e ssh -p 2222 -o StrictHos
tKeyChecking=no -o UserKnownHostsFile=/dev/null -i 'C:/Users/Alexander/.vagrant.
d/insecure_private_key' --exclude .vagrant/ /cygdrive/c/Users/Alexander/repos/st
ipnetz/ vagrant@127.0.0.1:/var/www
Error: rsync: Failed to exec ssh: No such file or directory (2)
rsync error: error in IPC code (code 14) at /usr/src/ports/rsync/rsync-3.0.9-1/s
rc/rsync-3.0.9/pipe.c(84) [sender=3.0.9]
rsync: writefd_unbuffered failed to write 4 bytes to socket [sender]: Broken pip
e (32)
rsync error: error in IPC code (code 14) at /usr/src/ports/rsync/rsync-3.0.9-1/s
rc/rsync-3.0.9/io.c(1532) [sender=3.0.9]

I tried to change live 43 of helper.rb but that did not work for me. The same for adding VAGRANT_DETECTED_OS = "cygwin"to my Vagrantfile.

@mdoelker

This comment has been minimized.

Show comment
Hide comment
@mdoelker

mdoelker Sep 6, 2014

@kummerer94 you seem to be missing SSH which is used by rsync. Install it from network category in Cygwin.

mdoelker commented Sep 6, 2014

@kummerer94 you seem to be missing SSH which is used by rsync. Install it from network category in Cygwin.

@deancsmith

This comment has been minimized.

Show comment
Hide comment
@deancsmith

deancsmith Sep 20, 2014

+1 still getting this issue on 1.6.5.

deancsmith commented Sep 20, 2014

+1 still getting this issue on 1.6.5.

@iamsteveholmes

This comment has been minimized.

Show comment
Hide comment
@iamsteveholmes

iamsteveholmes May 6, 2015

None of the Vagrant workarounds seem to work for me. I'm on 32 bit cygwin and windows 7.

iamsteveholmes commented May 6, 2015

None of the Vagrant workarounds seem to work for me. I'm on 32 bit cygwin and windows 7.

@NathanielMichael

This comment has been minimized.

Show comment
Hide comment
@NathanielMichael

NathanielMichael May 13, 2015

+1 Editing the library worked for me.

The machine I'm testing with has Cygwin installed but last on the PATH (just for rsync). Mainly using Git Bash + Cmder, so it's not detected as Cygwin properly.

Is there a way to test the rsync binary directly to determine if it's a Cygwin distributed binary? That may be the best option to support as many configurations as possible.

NathanielMichael commented May 13, 2015

+1 Editing the library worked for me.

The machine I'm testing with has Cygwin installed but last on the PATH (just for rsync). Mainly using Git Bash + Cmder, so it's not detected as Cygwin properly.

Is there a way to test the rsync binary directly to determine if it's a Cygwin distributed binary? That may be the best option to support as many configurations as possible.

@chrisg123

This comment has been minimized.

Show comment
Hide comment
@chrisg123

chrisg123 Jul 13, 2015

@osroot25 's solution works, however if you also use windows cmd for vagrant calls (ex. I run a script in phpstorm that uses windows cmd) then you should add your cygwin bin file to your %PATH% variables. Otherwise you will get errors like:

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.

VagrantFile

    Vagrant.configure(2) do |config|
      ... your own config...etc.


            ENV["VAGRANT_DETECTED_OS"] = ENV["VAGRANT_DETECTED_OS"].to_s + " cygwin"

    end

chrisg123 commented Jul 13, 2015

@osroot25 's solution works, however if you also use windows cmd for vagrant calls (ex. I run a script in phpstorm that uses windows cmd) then you should add your cygwin bin file to your %PATH% variables. Otherwise you will get errors like:

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.

VagrantFile

    Vagrant.configure(2) do |config|
      ... your own config...etc.


            ENV["VAGRANT_DETECTED_OS"] = ENV["VAGRANT_DETECTED_OS"].to_s + " cygwin"

    end
@jamesvl

This comment has been minimized.

Show comment
Hide comment
@jamesvl

jamesvl Jul 14, 2015

For some reason it doesn't work for me - editing the Vagrantfile to modify ENV never made it to the helper or plugin scripts in Vagrant, both in vagrant up or vagrant rsync.

I traced through the code; even though cygwin_path() is getting called in platform.rb (since my platform comes back as "mingw32"), it uses the alternate bash script to detect the path, which leaves off the necessary /cygdrive prefix (~ line 74).

I ended up adding an additional check in cygwin? using an ENV variable that was set properly: TERM.

Edit: embedded\gems\gems\vagrant-1.7.3\lib\vagrant\util\platform.rb on line 16 (Vagrant 1.7.3):

return true if ENV["TERM"] &&
  ENV["TERM"].downcase.include?("cygwin")

After this, the vagrant commands up, rsync, and rsync-auto all work as expected for me.

jamesvl commented Jul 14, 2015

For some reason it doesn't work for me - editing the Vagrantfile to modify ENV never made it to the helper or plugin scripts in Vagrant, both in vagrant up or vagrant rsync.

I traced through the code; even though cygwin_path() is getting called in platform.rb (since my platform comes back as "mingw32"), it uses the alternate bash script to detect the path, which leaves off the necessary /cygdrive prefix (~ line 74).

I ended up adding an additional check in cygwin? using an ENV variable that was set properly: TERM.

Edit: embedded\gems\gems\vagrant-1.7.3\lib\vagrant\util\platform.rb on line 16 (Vagrant 1.7.3):

return true if ENV["TERM"] &&
  ENV["TERM"].downcase.include?("cygwin")

After this, the vagrant commands up, rsync, and rsync-auto all work as expected for me.

@AnthonyMastrean

This comment has been minimized.

Show comment
Hide comment
@AnthonyMastrean

AnthonyMastrean Aug 31, 2015

@jamesvl Only the MSYS or Git Bash terminal reports its TERM as cygwin. What about native Windows consoles, where Vagrant should also work, like cmd.exe and PowerShell?

AnthonyMastrean commented Aug 31, 2015

@jamesvl Only the MSYS or Git Bash terminal reports its TERM as cygwin. What about native Windows consoles, where Vagrant should also work, like cmd.exe and PowerShell?

@lucassch

This comment has been minimized.

Show comment
Hide comment
@lucassch

lucassch Sep 3, 2015

Works for me:

Install Cygwin
Instal rsync package: apt-cyg install rsync
Changing line 43 in C:\HashiCorp\Vagrant\embedded\gems\gems\vagrant-1.6.X\plugins\synced_folders\rsync\helper.rb to hostpath = "/cygdrive" + Vagrant::Util::Platform.cygwin_path(hostpath)
Thanks @Venorcis.

Works for me too! Thanks @Venorcis @brunowego

lucassch commented Sep 3, 2015

Works for me:

Install Cygwin
Instal rsync package: apt-cyg install rsync
Changing line 43 in C:\HashiCorp\Vagrant\embedded\gems\gems\vagrant-1.6.X\plugins\synced_folders\rsync\helper.rb to hostpath = "/cygdrive" + Vagrant::Util::Platform.cygwin_path(hostpath)
Thanks @Venorcis.

Works for me too! Thanks @Venorcis @brunowego

@AnthonyMastrean

This comment has been minimized.

Show comment
Hide comment
@AnthonyMastrean

AnthonyMastrean Sep 3, 2015

We still need a solution that works without cygwin on Windows. i'm putting together some info now. Will post later.

AnthonyMastrean commented Sep 3, 2015

We still need a solution that works without cygwin on Windows. i'm putting together some info now. Will post later.

@GBuella

This comment has been minimized.

Show comment
Hide comment
@GBuella

GBuella Oct 12, 2015

Hi, just a note:
An easier way to set VAGRANT_DETECTED_OS is to set it as an environment variable in cygwin, this worked for me:

VAGRANT_DETECTED_OS=cygwin vagrant up

or if needed, place it in your bash startup file .profile, .bashrc in your cygwin home , whatever.
This way, things still work with cmd.exe, as the you would only set the environment variable in cygwin.

GBuella commented Oct 12, 2015

Hi, just a note:
An easier way to set VAGRANT_DETECTED_OS is to set it as an environment variable in cygwin, this worked for me:

VAGRANT_DETECTED_OS=cygwin vagrant up

or if needed, place it in your bash startup file .profile, .bashrc in your cygwin home , whatever.
This way, things still work with cmd.exe, as the you would only set the environment variable in cygwin.

@ccimpoi

This comment has been minimized.

Show comment
Hide comment
@ccimpoi

ccimpoi Oct 14, 2015

I have tried cwRsync, MinGW and cygwin on Windows 7.1 and the only way I got rsync working is with cygwin by using the cygwin shell and setting

ENV["VAGRANT_DETECTED_OS"] = ENV["VAGRANT_DETECTED_OS"].to_s + " cygwin"

in the Vagrant file.
For me this would go into the Vagrant file because I require each developer to customize these files anyways.

ccimpoi commented Oct 14, 2015

I have tried cwRsync, MinGW and cygwin on Windows 7.1 and the only way I got rsync working is with cygwin by using the cygwin shell and setting

ENV["VAGRANT_DETECTED_OS"] = ENV["VAGRANT_DETECTED_OS"].to_s + " cygwin"

in the Vagrant file.
For me this would go into the Vagrant file because I require each developer to customize these files anyways.

@JaminShanti

This comment has been minimized.

Show comment
Hide comment
@JaminShanti

JaminShanti Dec 3, 2015

@binarycrafts nice, share your solution with mitchell....

JaminShanti commented Dec 3, 2015

@binarycrafts nice, share your solution with mitchell....

@AnthonyMastrean

This comment has been minimized.

Show comment
Hide comment
@AnthonyMastrean

AnthonyMastrean Dec 4, 2015

@JaminShanti cygwin and the cygwin shell are not a solution that I can use and I suspect that others will have the same restriction. For rsync to be fully supported on Windows, it must be possible in any shell.

AnthonyMastrean commented Dec 4, 2015

@JaminShanti cygwin and the cygwin shell are not a solution that I can use and I suspect that others will have the same restriction. For rsync to be fully supported on Windows, it must be possible in any shell.

@hotnuts21

This comment has been minimized.

Show comment
Hide comment
@hotnuts21

hotnuts21 Dec 21, 2015

Im just trying to get my first ever vagrant box up!

Installed the latest versions of Virtualbox, Vagrant, Putty, and then when i got rsync errors I installed Cygwin with rsync.

have tried both the options here, moved the rsync so it comes before git in the global path and still I get the following error when trying to run vagrant up in a cmd. (with ENV["VAGRANT_DETECTED_OS"] = ENV["VAGRANT_DETECTED_OS"].to_s + " cygwin" in the vagrant file)

Bringing machine 'default' up with 'virtualbox' provider...
==> default: Importing base box 'centos/7'...
==> default: Matching MAC address for NAT networking...
==> default: Checking if box 'centos/7' is up to date...
==> default: Setting the name of the VM: gettingStarted-centos7_default_14507149
03141_9313
==> default: Clearing any previously set network interfaces...
==> default: Preparing network interfaces based on configuration...
default: Adapter 1: nat
==> default: Forwarding ports...
default: 22 => 2222 (adapter 1)
==> default: Booting VM...
==> default: Waiting for machine to boot. This may take a few minutes...
default: SSH address: 127.0.0.1:2222
default: SSH username: vagrant
default: SSH auth method: private key
default: Warning: Connection timeout. Retrying...
default:
default: Vagrant insecure key detected. Vagrant will automatically replace
default: this with a newly generated keypair for better security.
default:
default: Inserting generated public key within guest...
default: Removing insecure key from the guest if it's present...
default: Key inserted! Disconnecting and reconnecting using new SSH key...
==> default: Machine booted and ready!
==> default: Checking for guest additions in VM...
default: No guest additions were detected on the base box for this VM! Guest

default: additions are required for forwarded ports, shared folders, host on

ly
default: networking, and more. If SSH fails on this machine, please install
default: the guest additions and repackage the box to continue.
default:
default: This is not an error message; everything may continue to work prope
rly,
default: in which case you may ignore this message.
==> default: Installing rsync to the VM...
==> default: Rsyncing folder: /cygdrive/c/Users/paul/Projects/gettingStarted-cen
tos7/ => /home/vagrant/sync
There was an error when attempting to rsync a synced folder.
Please inspect the error message below for more info.

Host path: /cygdrive/c/Users/paul/Projects/gettingStarted-centos7/
Guest path: /home/vagrant/sync
Command: rsync --verbose --archive --delete -z --copy-links --chmod=ugo=rwX --no
-perms --no-owner --no-group --rsync-path sudo rsync -e ssh -p 2222 -o StrictHos
tKeyChecking=no -o IdentitiesOnly=true -o UserKnownHostsFile=/dev/null -i 'C:/Us
ers/paul/Projects/gettingStarted-centos7/.vagrant/machines/default/virtualbox/pr
ivate_key' --exclude .vagrant/ /cygdrive/c/Users/paul/Projects/gettingStarted-ce
ntos7/ vagrant@127.0.0.1:/home/vagrant/sync
Error: rsync: Failed to exec ssh: No such file or directory (2)
rsync error: error in IPC code (code 14) at pipe.c(85) [sender=3.1.1]
rsync: connection unexpectedly closed (0 bytes received so far) [sender]
rsync error: error in rsync protocol data stream (code 12) at io.c(226) [sender=
3.1.1]

Any ideas greatly appreciated.

hotnuts21 commented Dec 21, 2015

Im just trying to get my first ever vagrant box up!

Installed the latest versions of Virtualbox, Vagrant, Putty, and then when i got rsync errors I installed Cygwin with rsync.

have tried both the options here, moved the rsync so it comes before git in the global path and still I get the following error when trying to run vagrant up in a cmd. (with ENV["VAGRANT_DETECTED_OS"] = ENV["VAGRANT_DETECTED_OS"].to_s + " cygwin" in the vagrant file)

Bringing machine 'default' up with 'virtualbox' provider...
==> default: Importing base box 'centos/7'...
==> default: Matching MAC address for NAT networking...
==> default: Checking if box 'centos/7' is up to date...
==> default: Setting the name of the VM: gettingStarted-centos7_default_14507149
03141_9313
==> default: Clearing any previously set network interfaces...
==> default: Preparing network interfaces based on configuration...
default: Adapter 1: nat
==> default: Forwarding ports...
default: 22 => 2222 (adapter 1)
==> default: Booting VM...
==> default: Waiting for machine to boot. This may take a few minutes...
default: SSH address: 127.0.0.1:2222
default: SSH username: vagrant
default: SSH auth method: private key
default: Warning: Connection timeout. Retrying...
default:
default: Vagrant insecure key detected. Vagrant will automatically replace
default: this with a newly generated keypair for better security.
default:
default: Inserting generated public key within guest...
default: Removing insecure key from the guest if it's present...
default: Key inserted! Disconnecting and reconnecting using new SSH key...
==> default: Machine booted and ready!
==> default: Checking for guest additions in VM...
default: No guest additions were detected on the base box for this VM! Guest

default: additions are required for forwarded ports, shared folders, host on

ly
default: networking, and more. If SSH fails on this machine, please install
default: the guest additions and repackage the box to continue.
default:
default: This is not an error message; everything may continue to work prope
rly,
default: in which case you may ignore this message.
==> default: Installing rsync to the VM...
==> default: Rsyncing folder: /cygdrive/c/Users/paul/Projects/gettingStarted-cen
tos7/ => /home/vagrant/sync
There was an error when attempting to rsync a synced folder.
Please inspect the error message below for more info.

Host path: /cygdrive/c/Users/paul/Projects/gettingStarted-centos7/
Guest path: /home/vagrant/sync
Command: rsync --verbose --archive --delete -z --copy-links --chmod=ugo=rwX --no
-perms --no-owner --no-group --rsync-path sudo rsync -e ssh -p 2222 -o StrictHos
tKeyChecking=no -o IdentitiesOnly=true -o UserKnownHostsFile=/dev/null -i 'C:/Us
ers/paul/Projects/gettingStarted-centos7/.vagrant/machines/default/virtualbox/pr
ivate_key' --exclude .vagrant/ /cygdrive/c/Users/paul/Projects/gettingStarted-ce
ntos7/ vagrant@127.0.0.1:/home/vagrant/sync
Error: rsync: Failed to exec ssh: No such file or directory (2)
rsync error: error in IPC code (code 14) at pipe.c(85) [sender=3.1.1]
rsync: connection unexpectedly closed (0 bytes received so far) [sender]
rsync error: error in rsync protocol data stream (code 12) at io.c(226) [sender=
3.1.1]

Any ideas greatly appreciated.

@hotnuts21

This comment has been minimized.

Show comment
Hide comment
@hotnuts21

hotnuts21 Dec 23, 2015

Fixed my own problem and putting instructions here for anyone else in similar problem. The issue is that SSh is not installed on windows and even though I had installed it via cygwin, it was not set up to run as a service.
Heres a handy guide on getting it running under windows http://www.howtogeek.com/howto/41560/how-to-get-ssh-command-line-access-to-windows-7-using-cygwin/

hotnuts21 commented Dec 23, 2015

Fixed my own problem and putting instructions here for anyone else in similar problem. The issue is that SSh is not installed on windows and even though I had installed it via cygwin, it was not set up to run as a service.
Heres a handy guide on getting it running under windows http://www.howtogeek.com/howto/41560/how-to-get-ssh-command-line-access-to-windows-7-using-cygwin/

@smolinari

This comment has been minimized.

Show comment
Hide comment
@smolinari

smolinari Jan 2, 2016

The suggestion with

ENV["VAGRANT_DETECTED_OS"] = ENV["VAGRANT_DETECTED_OS"].to_s + " cygwin"

fixed my problem. Thanks @osroot25! 👍

Scott

smolinari commented Jan 2, 2016

The suggestion with

ENV["VAGRANT_DETECTED_OS"] = ENV["VAGRANT_DETECTED_OS"].to_s + " cygwin"

fixed my problem. Thanks @osroot25! 👍

Scott

PropTim added a commit to PropTim/vagrant that referenced this issue Feb 2, 2016

Fixing rsync 'file not found' issues with windows
Windows 10 (untested on other versions) has issues with rsync, as the file "/c/some/directory" can't be found. Adding the "/cygwin" + fixes it. See related thread and comments: hashicorp#3230 (comment)
@PropTim

This comment has been minimized.

Show comment
Hide comment
@PropTim

PropTim Feb 2, 2016

The original problem is still on windows 10. The line edit fixed it:

hostpath = "/cygwin" + Vagrant::Util::Platform.cygwin_path(hostpath)

PropTim commented Feb 2, 2016

The original problem is still on windows 10. The line edit fixed it:

hostpath = "/cygwin" + Vagrant::Util::Platform.cygwin_path(hostpath)

@smolinari

This comment has been minimized.

Show comment
Hide comment
@smolinari

smolinari Feb 29, 2016

This issue is still in 1.8.1 too.

Scott

smolinari commented Feb 29, 2016

This issue is still in 1.8.1 too.

Scott

@terrancesnyder

This comment has been minimized.

Show comment
Hide comment
@terrancesnyder

terrancesnyder Jun 5, 2016

+1 Still doesnt work on 10

terrancesnyder commented Jun 5, 2016

+1 Still doesnt work on 10

@AgentCormac

This comment has been minimized.

Show comment
Hide comment
@AgentCormac

AgentCormac Jun 9, 2016

+1 Vagrant 1.8.1 & Win7

AgentCormac commented Jun 9, 2016

+1 Vagrant 1.8.1 & Win7

@hollowimage

This comment has been minimized.

Show comment
Hide comment
@hollowimage

hollowimage Aug 19, 2016

+1 on win10 w/ embedded git bins into powershell.

hollowimage commented Aug 19, 2016

+1 on win10 w/ embedded git bins into powershell.

@strarsis

This comment has been minimized.

Show comment
Hide comment
@strarsis

strarsis Aug 22, 2016

+1 Vagrant 1.8.5 on Windows 10

strarsis commented Aug 22, 2016

+1 Vagrant 1.8.5 on Windows 10

@hollowimage

This comment has been minimized.

Show comment
Hide comment
@hollowimage

hollowimage Aug 31, 2016

Updating to lates (1.8.5) fixed the issue for me.

@strarsis if you got 1.8.5 and its not working, maybe the upgrade didnt finish properly? How does the rsync_helper.rb look for you? Maybe the installation got messed up?

meanwhile, try this: #3230 (comment)

hollowimage commented Aug 31, 2016

Updating to lates (1.8.5) fixed the issue for me.

@strarsis if you got 1.8.5 and its not working, maybe the upgrade didnt finish properly? How does the rsync_helper.rb look for you? Maybe the installation got messed up?

meanwhile, try this: #3230 (comment)

@strarsis

This comment has been minimized.

Show comment
Hide comment
@strarsis

strarsis Aug 31, 2016

I am using cygwin rsync now instead of cwRsync and it works fine.

strarsis commented Aug 31, 2016

I am using cygwin rsync now instead of cwRsync and it works fine.

@craigsagit

This comment has been minimized.

Show comment
Hide comment
@craigsagit

craigsagit commented Aug 6, 2018

Thank you @starrychloe

@chebaby

This comment has been minimized.

Show comment
Hide comment
@chebaby

chebaby Oct 11, 2018

@mdoelker you pointed me in to the right direction

thank you

chebaby commented Oct 11, 2018

@mdoelker you pointed me in to the right direction

thank you

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment