-
Notifications
You must be signed in to change notification settings - Fork 4.4k
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 fails – lacks /cygdrive prefix #4073
Comments
I experienced this problem on Windows 7 with cwrsync. Somehow Vagrant won't execute cygpath command because it depends on cygwin detection which may fail for some reason. I still have to edit vagrant's source manually to make it execute cygpath. |
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:
|
This seems like a possible solution: #3925 |
You could change cygdrive prefix from default /cygdrive to /. See #3913 |
@mitchellh Will this ever get looked at? Has been a bug for a few months, without any attention given. It should be a very simple fix. |
Hi, I tried to use rsync on a windows machine but failed on each attempt. I installed cygwin with openssh rsync packages. But now when I boot the machine it always boot up with the default vagrant box, and not the one that I was using before using rsync. |
hello if you change your shell, in windows, sometimes the HOME change in this home, is usally where the virtualbox default folder is created. Open the virtualbox gui and see if there are any extra vms. if you want/need recover some data/work from those vms, turn them one using if you changed shell, and on a new vagrant up a new box created, my advise bear in mind that the vagrant way is vagrant destroy && vagrant up to Alvaro On Wed, Oct 1, 2014 at 7:44 PM, fabiangarga notifications@github.com
|
Hi Alvaro, When i changed the shell from mingw to CygWin it created a new vms, i deleted the new vms, but now i don't know how to associate my project folder to that specific vm. The only way to pull the data from my Virtual machine is to log in and get the data? There's no way to reassociate? FIX** I'm new using vagrant, it was a month of transition coming from xamp c: |
Okay, so here is Vagrant's cygwin detection: https://github.com/mitchellh/vagrant/blob/da91741b7c011bc69668267842c4796cf34ab6e8/lib/vagrant/util/platform.rb#L12 How can this be improved for your platforms? |
Where does VAGRANT_DETECTED_OS get set? (Had a search for it, but couldn't find) Once the cygwin check is improved, then we also need to fix: |
@matt-richardson Hm, that used to be a cygwin check but I thought that all rsync implementations on Windows expect Cygwin paths? |
cwrsync doesn't seem to use that - it expects a path in the format c:/blah/blah. |
any solution for this issue |
@abilash222, I run If you are running Vagrant commands from common Windows |
is there any other solution other than cygwin? |
Yes, move to Linux if you can.
|
There is another way to fix this bug other then to manually edit the source files: |
This! |
Since it is in another project, perhaps someone following here could help/follow there: hashicorp/vagrant-installers#49 ? |
From my testing, if you are using cygwin, use the solution by @osroot25 . If you are using cwRsync and do not have cygwin, there is no workaround using Vagrant except editing the source code (see #3230 (comment)). My workaround that works for me is to bypass Vagrant altogether and use cwRsync directly. This works for me because I am syncing a folder that hardly ever changes. I might change it quite a few times in one day (so I have to remember step 2 below each time), but I then go weeks (or months) without any changes. Remember that to use cwRsync you have to edit and use the cwrsync.cmd script. Attempting to access the rsync.exe command directly or by adding it to your path will fail. Step 1: I added the following line to the end of cwrsync.cmd (in the installed folder):
Step 2: I have a separate cmd window open that I run the cwrsync.cmd using the full path. Then if I need to sync changes onto the VM, I activate that window, up-arrow, return and updating is instant! Modifying ENV to set cygwin fix by @osroot25 doesn't work with cwRsync because when you force cygwin detection, the "vagrant ssh" command will not work because it requires the cygpath command in cygwin, which you won't have, so you cannot ssh into the VM. Well you can if you use the ssh command directly with all the right options. the fixTo answer @mitchellh, the code pointed to by @matt-richardson looks correct. cwRsync (and probably MSYS's rsync) require the /cygdrive prefix, (which seems to be a standard for posix commands on Windows). So I think the logic should be: if Platform:windows then add the prefix. But this is not happening. Either the windows flag isn't being set or this code isn't being executed or the cygwin_path() isn't producing the correct result as of Vagrant 1.6.5. |
Then the following code fails:
(lib/vagrant/util/platform.rb lines71-76 in v 1.6.5) as I have no idea how this code-fragment works, I can't help here. |
haha, could it be, that
should be
because -c expects a string (so the string passed to the process has to contain a string) Question is, if this command can be executed with cwRsync... |
Interesting.. I do have a bash command in the path. I get the expected results (no prepended /cygdrive). I found one one more interesting/annoying issue with rsync on Windows while doing further testing:
I see two easy solutions (for now)
|
👍 good research @1jerry |
Is there any rsync executable that "just works" with vagrant? (apart from a full cygwin install that is) |
@hunternnm Got similar problem with win7x64, vagrant 1.7.4, cygwin (rsync + ssh) and Git Bash.
Hope this can help. |
My solution for GitBash + cygwin + Vagrant After installing cygwin, add to your # Add cygwin to path for rsync:
export PATH=$PATH:/c/cygwin/bin # your cygwin path
# Tell vagrant, we have cygwin:
export VAGRANT_DETECTED_OS=cygwin |
Fixed with @vteivans comment (I am using just plain Cygwin, no GitBash):
|
Confirmed working on Windows 10 using cygwin (rsync + openssh); making sure cygwin is before GIT in PATH and following this guide: http://micahasmith.github.io/2015/01/22/coreos-vagrant-windows-file-share/. |
I use GitBash without Cygwin. Still not sure what I should do. Any suggestions? |
The error is still present in version 1.7.4. "/cygdrive" was added, cygwin was installed and rsync, openssh inside. All variables in path exist. Nothing helped. What else should I do? Os: win 10. |
While not directly related to this issue: cygwin rsync (and I think also cwRysnc) will both fail to run on the latest Windows 10 "major update" (from Nov. 12 2015). I had the cygwin rsync working flawlessly on Windows 8.1 and Windows 10 (and latest versions of Vagrant and Virtual Box); then it failed after applying the Windows service pack. Errors are along the lines of
I'm investigating how best to report the issue to cygwin. |
OKAY! This should finally be fixed (I hope) with Vagrant 1.8. We now automatically convert all paths for rsync on Windows to the cygwin path format since every implementation of cygwin requires that. |
I'm running into the same problem as @jamesvl after updating to Windows 10 Threshold 2.
|
I fixed my issue, I had the 64-bit version of cygwin installed. I deleted that and installed the 32-bit version instead. Now it's working fine again on Windows 10. FYI @jamesvl |
Thanks @kurttomlinson ! Downgrading cygwin from 64-bit to 32-bit version also worked for me on the latest Windows 10 update. |
Downgrading to 32-bit didnt worked. |
I had the same issue, fork: can't reserve memory for parent stack, using rsync in msys2-x86_64-20150916.exe from http://msys2.github.io/ on Microsoft Windows 10.0.10586. 0 [main] rsync 8900 C:\msys64\usr\bin\rsync.EXE: *** fatal error in forked process - fork: can't reserve memory for parent stack 0x600000 - 0x800000, (child has 0x400000 - 0x600000), Win32 error 487 And I fixed my issue by using the 32-bit msys2-i686-20150916.exe (32-bit) instead. ==> centos-atomic-host-01: Configuring and enabling network interfaces...
==> centos-atomic-host-01: Rsyncing folder: /d/vagrant-docker-ansible/ => /home/vagrant/sync |
In case of someone will still have an issue after previous instructions, don't forget to install rsync and openssh in msys2 32bit using pacman. |
Guess the reason why rsync from msys2-x86_64 failed is vagrant is running 32-bit mode. So you have to use 32-bit msys2's rsync. |
What weird is that I used msys2 64 bit before and it worked flawlessly. Problems started after windows 10 recent upgrade. |
@firestalk Thanks for your information. |
Here's a note from 16-12-2015. I am using cygwin 64 bit, I am not looking forward to downgrading. It seems like the cygwin-detection of this helper script is faulty and either fails to detect cygwin, or fails to construct the proper path. This error occurs when using a Debian-box (jesse, 8.2.2), but not with Ubuntu (ubuntu still shares directory with vboxsf). Please... fix this. This error stems from 2014, it's a year and a half old. |
coreos-01: Rsyncing folder: /d/vagrant-lab/ => /vagrant
There was an error when attempting to rsync a synced folder.
Please inspect the error message below for more info.
Host path: /d/vagrant-lab/
Guest path: /vagrant
Command: rsync --verbose --rsync-path='sudo rsync' --archive --delete -zz --chmod=ugo=rwX --no-perms --no-owner --no-group --rsync-path sudo rsync -e ssh -p 2222 -o ControlMaster=auto -o ControlPath=C:/msys32/tmp/ssh.702 -o ControlPersist=10m -o StrictHostKeyChecking=no -o IdentitiesOnly=true -o UserKnownHostsFile=/dev/null -i 'C:/Users/<user_name>/.vagrant.d/insecure_private_key' --exclude .vagrant/ /d/vagrant-lab/ core@127.0.0.1:/vagrant
Error: Warning: Permanently added '[127.0.0.1]:2222' (ED25519) to the list of known hosts.
mm_receive_fd: no message header
process_mux_new_session: failed to receive fd 0 from slave
mux_client_request_session: read from master failed: Connection reset by peer
Failed to connect to new control master
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] see also #4586 |
@jeancasman 's solution worked for me - especially the switch to windows cmd just for vagrant up part 👍 |
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. |
For more details, see #3230. No one on the vagrant team seems to be noticing it... so that's why I'm intentionally creating a duplicate issue here. Feel free to close / delete this when it is reopened.
The text was updated successfully, but these errors were encountered: