Vagrant rsync error: Error: Could not create direc

2019-07-18 04:56发布

问题:

I installer Vagrant 1.8.1 on Windows 10 and as well cygwin and cwRsync. Now i get this error when do vagrant up:

There was an error when attempting to rsync a synced folder.
Please inspect the error message below for more info.

Host path: /cygdrive/m/development/Projects/www.webapp.local/
Guest path: /vagrant
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 ControlMaster=auto -o ControlPath=C:/Users/Eric/AppData/Local/Temp/ssh.202 -o ControlPersist=10m -o StrictHostKeyChecking=no -o IdentitiesOnly=true -o UserKnownHostsFile=/dev/null -i 'M:/development/Projects/www.webapp.local/.vagrant/machines/default/virtualbox/private_key' --exclude .vagrant/ /cygdrive/m/development/Projects/www.webapp.local/ vagrant@127.0.0.1:/vagrant
Error: Could not create directory '/home/Eric/.ssh'.
Warning: Permanently added '[127.0.0.1]:2222' (ECDSA) 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.2]

I already tried the suggestions in this post: http://ekawas.blogspot.co.uk/2007/03/solving-pesky-ssh-issues-in-cygwin.html

But no success.

回答1:

For now I tried to use another Debian 8 box and it suprised me that this box works in one time without the need to install rsync and cygwin seperate, like the way how Vagrant has to work in my opinion: install and setup without hassle. Also syncing the /vagrant folder works in both directions.

I really don't understand why some boxes need the hassle with installing rsync and cygwin and doing hacks in Vagrant files and other boxes just work with the basic setup of Vagrant.

Well I'm not a Vagrant expert, so maybe I miss something in this way? Maybe someone can explain?



回答2:

This seems to be a known issue with Vagrant >=1.8.0 and Windows hosts.

For the ones still struggling, remove the following code in $VAGRANT_HOME\embedded\gems\gems\vagrant-1.8.0\plugins\synced_folders\rsync\helper.rb (lines 77 to 79):

"-o ControlMaster=auto " +
"-o ControlPath=#{controlpath} " +
"-o ControlPersist=10m " +

Source