Skip to content
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 functionality on Windows fails; requires cygwin and/or cygwin pathing? #7046

Closed
humidair1999 opened this issue Feb 17, 2016 · 7 comments · Fixed by #7012
Closed

rsync functionality on Windows fails; requires cygwin and/or cygwin pathing? #7046

humidair1999 opened this issue Feb 17, 2016 · 7 comments · Fixed by #7012

Comments

@humidair1999
Copy link

On Vagrant 1.8.1, Windows 10.

I've attempted to get rsync shared folders working using both MinGW and cwRsync, with the same result on both:

==> default: Rsyncing folder: /c/Users/Josh/Projects/vagrant-boilerplate/ => /vagrant
==> default:   - Exclude: [".vagrant/", ".git/"]
There was an error when attempting to rsync a synced folder.
Please inspect the error message below for more info.

Host path: /c/Users/Josh/Projects/vagrant-boilerplate/
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/Josh/AppData/Local/Temp/ssh.49 -o ControlPersist=10m -o StrictHostKeyChecking=no -o IdentitiesOnly=true -o UserKnownHostsFile=/dev/null -i 'C:/Users/Josh/Projects/vagrant-boilerplate/.vagrant/machines/default/virtualbox/private_key' --exclude .vagrant/ --exclude .git/ /c/Users/Josh/Projects/vagrant-boilerplate/ vagrant@127.0.0.1:/vagrant
Error: Could not create directory '/home/Josh/.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]

The root of the problem SEEMS to be some pathing issues: in the error, the /c/Users/Josh/Projects/vagrant-boilerplate/ and /home/Josh/.ssh are both pretty alarming, given that this particular instance of vagrant reload was run within Powershell, so obviously neither of those directories exists in a Windows filesystem context.

rsync and ssh are both properly referenced in the PATH before any other entries.

If I had to guess, I'd say this commit is either the culprit or a direct contributor. It also appears to be a rather presumptuous commit, as it assumes every Windows user will be using cygwin for rsync functionality.

There seem to be a lot of issues regarding rsync functionality on Windows right now, so I'll link them for posterity's sake, as I'm not sure if they're directly related or not: #3230 #6702 #4586

@dbbernstein
Copy link

I ran into identical symptoms today, also Win 10 and Vagrant 1.8.1.

David@noe /cygdrive/c/git/wd/om/eclps/oms
$ vagrant up
Bringing machine 'default' up with 'virtualbox' provider...
==> default: Importing base box 'debian/jessie64'...
==> default: Matching MAC address for NAT networking...
==> default: Checking if box 'debian/jessie64' is up to date...
==> default: Setting the name of the VM: oms_default_1455927955147_68968
==> default: Clearing any previously set network interfaces...
==> default: Preparing network interfaces based on configuration...
    default: Adapter 1: nat
==> default: Forwarding ports...
    default: 22 (guest) => 2222 (host) (adapter 1)
==> 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:
    default: Vagrant insecure key detected. Vagrant will automatically replace
    default: this with a newly generated keypair for better security.
    default:
    default: Inserting generated public key within guest...
    default: Removing insecure key from the guest if it's present...
    default: Key inserted! Disconnecting and reconnecting using new SSH key...
==> default: Machine booted and ready!
==> default: Checking for guest additions in VM...
    default: No guest additions were detected on the base box for this VM! Guest
    default: additions are required for forwarded ports, shared folders, host only
    default: networking, and more. If SSH fails on this machine, please install
    default: the guest additions and repackage the box to continue.
    default:
    default: This is not an error message; everything may continue to work properly,
    default: in which case you may ignore this message.
==> default: Installing rsync to the VM...
==> default: Rsyncing folder: /cygdrive/c/git/wd/om/eclps/oms/ => /vagrant
There was an error when attempting to rsync a synced folder.
Please inspect the error message below for more info.

Host path: /cygdrive/c/git/wd/om/eclps/oms/
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=D:/cygwin64/tmp/ssh.523 -o ControlPersist=10m -o StrictHostKeyChecking=no -o IdentitiesOnly=true -o UserKnownHostsFile=/dev/null -i 'C:/git/wd/om/eclps/oms/.vagrant/machines/default/virtualbox/private_key' --exclude .vagrant/ /cygdrive/c/git/wd/om/eclps/oms/ [email protected]:/vagrant
Error: 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]


David@noe /cygdrive/c/git/wd/om/eclps/oms
...
$ David@noe ~
$ vagrant version
Installed Version: 1.8.1
Latest Version: 1.8.1

You're running an up-to-date version of Vagrant!

David@noe ~
$ systeminfo

Host Name:                 NOE
OS Name:                   Microsoft Windows 10 Pro
OS Version:                10.0.10586 N/A Build 10586
.
.
.

I was running from Cygwin bash, but got the same result from a Windows shell. Curiously, the failure appeared when I added

config.vm.box = "debian/jessie64"
config.vm.box_version = "8.3.0"

to the Vagrantfile and disappeared when I changed it back to

config.vm.box = "hashicorp/precise64"

.

@hron
Copy link

hron commented Feb 22, 2016

I have made some debugging on this and it seems the problem is in additional options Vagrant passes to ssh: -o ControlMaster auto. Without this rsync works great. 45a8a59 is the source of problem.

It was introduced in 1.8.0, so downgrading to 1.7.4 should resolve the issue.

asyrjasalo added a commit to asyrjasalo/vagrant-syncer that referenced this issue Mar 9, 2016
@kichik
Copy link

kichik commented Jun 17, 2016

I tried manually removing -o ControlMaster auto and it doesn't seem to be enough. I still get an error. The first command is with -o ControlMaster auto and the second is without it.

I renamed rsync.exe to _rsync.exe and put rsync.bat in the path with just pause command in it. This way I could try many different command combinations without modifying VirtualBox source code. I only tried cwRsync.

C:\Users\x\Documents\code>_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/x/AppData/Local/Temp/ssh.494 -o ControlPersist=10m -o StrictHostKeyChecking=no -o IdentitiesOnly=true -o UserKnownHostsFile=/dev/null -i 'C:/Users/x/Documents/code/.vagrant/machines/default/virtualbox/private_key'" --exclude .vagrant/ /c/Users/x/Documents/code/ [email protected]:/home/ubuntu/code"
Could not create directory '/home/x/.ssh'.
Warning: Permanently added '[127.0.0.1]:2222' (ECDSA) to the list of known hosts.
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]

C:\Users\x\Documents\code>_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 ControlPath=C:/Users/x/AppData/Local/Temp/ssh.494 -o ControlPersist=10m -o StrictHostKeyChecking=no -o IdentitiesOnly=true -o UserKnownHostsFile=/dev/null -i 'C:/Users/x/Documents/code/.vagrant/machines/default/virtualbox/private_key'" --exclude .vagrant/ /c/Users/x/Documents/code/ [email protected]:/home/ubuntu/code"
buffer_append_space: insufficient buffer space
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]

@rafd123
Copy link

rafd123 commented Jun 21, 2016

I concur with @hron.

Removing the Control* parameters from C:\HashiCorp\Vagrant\embedded\gems\gems\vagrant-1.8.4\plugins\synced_folders\rsync\helper.rb (effectively reverting 45a8a59) fixed the issue for me.

Also found a similar bug reported against the knife-solo project that root-causes this to broken ControlMaster support in Cygwin.

See matschaffer/knife-solo#450 and http://www.cygwin.com/ml/cygwin/2015-01/msg00123.html

@rafd123
Copy link

rafd123 commented Jun 21, 2016

Turns out there's already a PR for this: #7012

Sorry for the chatter.

@mohanramanujam
Copy link

Windows 10 Build 14393
Vagrant 1.8.5
Cygwin setup 2.874 64 bit

resorted to using cygwin since problem persisted regardless of downgrading vagrant 1.7.4 or trying the other suggested fixes. With cygwin all I had to do was, from cygwin terminal, edit /etc/nsswitch.conf
and set 'db_home: windows'. I no longer had rsync problems

@tannakartikey
Copy link

@mohanramanujam strange solution but it worked. Can you explain the problem under the hood?

@ghost ghost locked and limited conversation to collaborators Apr 4, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

8 participants