Using rsync in windows with a roaming launch of CoreOS VM

I am using windows 8.1 Pro pc working with vagrant and cygwin rsync.

I configure as such:

config.vm.synced_folder "../sharedFolder", "/vagrant_data", type: "rsync" 

And when I do vagrant up , I get the following error:

 C:\dev\vagrantBoxes\coreOS>vagrant up Bringing machine 'default' up with 'virtualbox' provider... ==> default: Checking if box 'yungsang/coreos' is up to date... ==> default: Clearing any previously set forwarded ports... ==> 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: 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: core default: SSH auth method: private key default: Warning: Connection timeout. Retrying... ==> default: Machine booted and ready! ==> default: Rsyncing folder: /c/dev/vagrantBoxes/sharedFolder/ => /vagrant_data There was an error when attempting to rsync a synced folder. Please inspect the error message below for more info. Host path: /c/dev/vagrantBoxes/sharedFolder/ Guest path: /vagrant_data 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=/d ev/null -i 'C:/Users/aaron.axisa/.vagrant.d/insecure_private_key' --exclude .vagrant/ /c/dev/vagrantBoxes/sharedFolder/ core@127.0.0.1 :/vagrant_data Error: Warning: Permanently added '[127.0.0.1]:2222' (RSA) to the list of known hosts. rsync: change_dir "/c/dev/vagrantBoxes/sharedFolder" failed: No such file or directory (2) rsync error: some files/attrs were not transferred (see previous errors) (code 23) at /usr/src/ports/rsync/rsync-3.0.9-1/src/rsync-3.0.9/main.c(1052) [sender=3.0.9] 

I assume this is a problem with the way it changes the directory path to / c / dev, not C: \ dev

+5
source share
4 answers

From my testing, if you are using cygwin, use @ osroot25 solution.

If you use cwRsync and don't have cygwin, there is no workaround for using Vagrant other than editing source code like @Andrew Myers. Tested using Vagrant v1.6.5.

My workaround that works for me is to completely bypass the Tramp and use cwRsync directly. This works for me because I am syncing a folder that almost never changes. I can change it several times in one day (so I have to remember step 2 below each time), but then I study for weeks (or months) without any changes. Remember that to use cwRsync you need 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):

rsync -re "ssh -p 2222" /cygdrive/b/VCS/packages/ vagrant@localhost :packages --exclude ".git/"

Step 2: I have a separate cmd window that I run cwrsync.cmd using the full path. Then, if I need to synchronize the changes in the virtual machine, I activate this window, the up arrow, return and update instantly!

Changing the ENV for installing cygwin fix by @ osroot25 does not work with cwRsync, because when you force cygwin to be detected, the "tramp ssh" command will not work, because it requires the cygpath command in cygwin, which you will not have, so you cannot ssh to the virtual machine. It’s good if you use the ssh command directly with all the correct parameters.

+1
source

as I commented on the github problem, the next line in your Vagrantfile will surely fix your problem.

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

since this is local to your vagrantfile, the source files may remain untouched

+8
source

workaround: just ln -s /cygdrive/c/ /c on cygwin terminal

+3
source

There is a hacker way to fix this (worked for me anyway) where you need to change

 hostpath = Vagrant::Util::Platform.cygwin_path(hostpath) 

to

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

on line 43 in C:\HashiCorp\Vagrant\embedded\gems\gems\vagrant-[VERSION]\plugins\synced_folders\rsync\helper.rb

This is different from 1.5.x, here you can read this topic: https://github.com/mitchellh/vagrant/issues/3230

However, I will be the first to admit that editing the kernel is far from ideal.

+2
source

Source: https://habr.com/ru/post/1201911/


All Articles