Closed balajisivaraman closed 10 years ago
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 Thanks! Works like a charm!
@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
+1, this should be re-opened. I had to make this change as well to get rsync working.
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.
+1, re-open please. Also having this problem in 1.6.3. I had to make this change to get rsync working.
It now needs to be applied on line 43: hostpath = "/cygdrive" + Vagrant::Util::Platform.cygwin_path(hostpath)
I think someone should probably make a new issue, this won't get any attention since it's already closed.
@francislavoie I think you're right. One final attempt: @mitchellh Re-open?
same problem and "/cygdrive" + helped, should be fixed
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]
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.
+1
+1
+1
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.
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.
+1
+1 same issue
+1 same issue vagrant 1.6.3
+1 same here.
+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
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.
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 you seem to be missing SSH which is used by rsync. Install it from network category in Cygwin.
+1 still getting this issue on 1.6.5.
+1 with 1.6.5
+1
+1 with 1.6.5
==> default: Rsyncing folder: /cygdrive/d/Servers/Homestead/www/ => /home/vagran
t/www
Vagrant::Errors::RSyncError: There was an error when attempting to rsync a synce
d folder.
Please inspect the error message below for more info.
Host path: /cygdrive/d/Servers/Homestead/www/
Guest path: /home/vagrant/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/bruno/.vagrant.d/in
secure_private_key' --exclude .vagrant/ /cygdrive/d/Servers/Homestead/www/ vagra
nt@127.0.0.1:/home/vagrant/www
Error: Warning: Permanently added '[127.0.0.1]:2222' (RSA) to the list of known
hosts.
rsync: connection unexpectedly closed (0 bytes received so far) [Receiver]
rsync error: error in rsync protocol data stream (code 12) at io.c(226) [Receive
r=3.1.0]
rsync: read error: Connection reset by peer (104)
rsync error: error in rsync protocol data stream (code 12) at io.c(759) [sender=
3.0.6]
Works for me:
Thanks @Venorcis.
doesn't work for me. My environment is: Windows 7 + cwRsync(cwRsync_5.3.0_Free).
Here is the log: 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.1pre1] rsync: connection unexpectedly closed (0 bytes received so far) [sender] rsync error: error in rsync protocol data stream (code 12) at io.c(235) [sender=3.1.1pre1]
Editing the libraries is always the last way, but I found another way, local in your Vagrantfile!
helping vagrant by giving it the (modified but right) ENV["VAGRANT_DETECTED_OS"] just solves the problem: in vagrantfile, have a line
ENV["VAGRANT_DETECTED_OS"] = ENV["VAGRANT_DETECTED_OS"].to_s + " cygwin"
then, in the libraries, /cygdrive/ is added to the path
@osroot25: Thanks for suggesting the Vagrantfile workaround. That solved it for me.
This is still an issue for me, sadly!
Windows 8.1, cwRsync, CentOS guest, Vagrant 1.6.5.
Had to mess with my Vagrantfile in the end. Many thanks to @osroot25 for the relatively elegant workaround.
and again, please check out https://github.com/mitchellh/vagrant-installers/issues/49 , I think I have pinpointed the source of the problem, but that project hasn't many watchers, the please spread this around to the right people
+1
@osroot25 +1 thanks for the workaround!
+1
+1
+1
+1
The vagrantfile workaround worked for me in msysgit but I also have cygwin installed, which is where it's getting rsync from:
Welcome to Git (version 1.9.4-preview20140611)
$ which rsync
/c/cygwin64/bin/rsync
None of the Vagrant workarounds seem to work for me. I'm on 32 bit cygwin and windows 7.
+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.
@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.
Vagrant.configure(2) do |config|
... your own config...etc.
ENV["VAGRANT_DETECTED_OS"] = ENV["VAGRANT_DETECTED_OS"].to_s + " cygwin"
end
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 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?
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
We still need a solution that works without cygwin on Windows. i'm putting together some info now. Will post later.
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.
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.
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.