vagrant icon indicating copy to clipboard operation
vagrant copied to clipboard

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

Open balajisivaraman opened this issue 12 years ago • 67 comments

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/ [email protected]:/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.

balajisivaraman avatar Mar 15 '14 14:03 balajisivaraman

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 avatar Mar 16 '14 13:03 kylemacfarlane

@kylemacfarlane Thanks! Works like a charm!

balajisivaraman avatar Mar 16 '14 20:03 balajisivaraman

@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 avatar Jun 10 '14 19:06 brianreavis

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

francislavoie avatar Jun 15 '14 07:06 francislavoie

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 avatar Jun 16 '14 18:06 kriserickson

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

gitTrusty avatar Jun 19 '14 00:06 gitTrusty

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

kellyselden avatar Jun 19 '14 20:06 kellyselden

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

francislavoie avatar Jun 19 '14 20:06 francislavoie

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

brianreavis avatar Jun 20 '14 02:06 brianreavis

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

machek avatar Jun 20 '14 11:06 machek

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/ [email protected]:/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 avatar Jun 25 '14 22:06 starrychloe

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 avatar Jun 25 '14 22:06 francislavoie

+1

nomasprime avatar Jul 02 '14 10:07 nomasprime

+1

ckatzorke avatar Jul 10 '14 18:07 ckatzorke

+1

mickdelaney avatar Jul 11 '14 17:07 mickdelaney

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 avatar Jul 11 '14 17:07 kriserickson

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 avatar Jul 11 '14 17:07 kylemacfarlane

+1

rarkins avatar Jul 21 '14 07:07 rarkins

+1 same issue

khromov avatar Jul 27 '14 18:07 khromov

+1 same issue vagrant 1.6.3

n0v3xx avatar Aug 15 '14 15:08 n0v3xx