Vagrant: Vagrant not working with rsync on Windows 10

Created on 16 Dec 2015  ·  12Comments  ·  Source: hashicorp/vagrant

I am using Windows 10 with the latest updates. When I run vagrant up on a project which uses debian/jessie64 (virtualbox, 8.2.2), I get the following error:

==> uk1: Setting hostname...
==> uk1: Configuring and enabling network interfaces...
==> uk1: Installing rsync to the VM...
==> uk1: Rsyncing folder: /c/Users/mark/Workspace/SaltStatesDev/ => /vagrant
There was an error when attempting to rsync a synced folder.
Please inspect the error message below for more info.

Host path: /c/Users/mark/Workspace/SaltStatesDev/
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 2200 -o StrictHostKeyChecking=no -o IdentitiesOnly=true -o UserKnownHostsFile=/dev/null -i 'C:/Users/mark/Workspace/SaltStatesDev/.vagrant/machines/uk1/virtualbox/private_key' --exclude .vagrant/ /c/Users/mark/Workspace/SaltStatesDev/ [email protected]:/vagrant
Error: Warning: Permanently added '[127.0.0.1]:2200' (ECDSA) to the list of known hosts.
dup() in/out/err failed
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]

I am using VirtualBox 5.0.10 and I have installed rsync 3.1.1 with cygwin (32bit). Rsync is added to the system PATH.

bug hoswindows synced-folderrsync

Most helpful comment

@LondonAppDev @ctaorminainn I also had the dup() in/out/err failed error, but I managed to solve it.

I found that the issue was because I didn't have the ssh bundled with my Cygwin install. When you're installing Cygwin, it recommends you only install what you need. As such, I only selected rsync because I had a working ssh with my Windows git installation. As you've already guessed, they're not compatible!

The fix was to add Cygwin's version of ssh to the Cygwin installation, and for good measure, I removed the git PATH to make sure that rsync was using the ssh that was part of the same distribution as itself.

Hopefully this fixes it for you both.

All 12 comments

just if I may ask, what are you trying to achieve with rsync. If it's about synced folders, I would rather advise you to go for "smb" type folders, enforcing smb3 and mfsymlinks:

config.vm.synced_folder "../.", "/var/www", type: "smb", mount_options: ["vers=3.02","mfsymlinks"]

Advantages:

  • it's really fast on windows 10
  • linux symlinks are perfectly supported (I almost spent a week now to setup a node.js compatible environment, with those 2 mount options finally everything works as a breeze)
  • linux guest OS kernel must be >= 3.18!

I believe I'm having a similar problem (Windows 10, Cygwin (x64) with Rsync 3.1.1 and OpenSSH):

==> default: Setting hostname...
==> default: Configuring and enabling network interfaces...
==> default: Rsyncing folder: /c/Users/David/Sandbox/citypantry/frontend/ => /home/citypantry/project/frontend
==> default:   - Exclude: [".vagrant/", "app/cache/", "app/logs/", "node_modules"]
There was an error when attempting to rsync a synced folder.
Please inspect the error message below for more info.

Host path: /c/Users/David/Sandbox/citypantry/frontend/
Guest path: /home/citypantry/project/frontend
Command: rsync --verbose --archive -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:/cygwin64/tmp/ssh.974 -o ControlPersist=10m -o StrictHostKeyChecking=no -o IdentitiesOnly=true -o UserKnownHostsFile=/dev/null -i 'C:/Users/David/Sandbox/citypantry/vagrant/.vagrant/machines/default/virtualbox/private_key' --exclude .vagrant/ --exclude app/cache/ --exclude app/logs/ --exclude node_modules /c/Users/David/Sandbox/citypantry/frontend/ [email protected]:/home/citypantry/project/frontend
Error: Warning: Permanently added '[127.0.0.1]:2222' (ECDSA) to the list of known hosts.
select: Interrupted system call
rsync: [sender] write error: Broken pipe (32)
rsync error: error in socket IO (code 10) at io.c(820) [sender=3.1.1]

The directory structure gets synced, but no files are transferred. Calling the rsync command from above directly from the command line sometimes returns

Warning: Permanently added '[127.0.0.1]:2222' (ECDSA) to the list of known hosts.
sending incremental file list
.git/objects/pack/
.git/objects/pack/pack-cb32a421258e1ebf8b35ba37fb6b5931db70d8f9.pack
select: Interrupted system call
rsync: [sender] write error: Connection reset by peer (104)
rsync error: error in socket IO (code 10) at io.c(820) [sender=3.1.1]

but other times syncs the files as expected!

Exactly the same setup - same project, Vagrantfile and Cygwin/Rsync install - works for me on another machine on Windows 7. As far as I can tell, the "only" difference is the OS.

For clarity, here's the raw rsync command I'm calling from the command line that sometimes does and sometimes doesn't sync the files:

rsync --verbose --archive -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:/cygwin64/tmp/ssh.172 -o ControlPersist=10m -o StrictHostKeyChec
king=no -o IdentitiesOnly=true -o UserKnownHostsFile=/dev/null -i 'C:/Users/David/Sandbox/citypantry/vagrant/.vagrant/m
achines/default/virtualbox/private_key'" --exclude .vagrant/ --exclude app/cache/ --exclude app/logs/ --exclude node_mo
dules /c/Users/David/Sandbox/citypantry/frontend/ [email protected]:/home/citypantry/project/frontend

Hi @Perni1984 thanks for the suggestion. The issues with this are that it doesn't work reliably across all platforms. Also, it requires vagrant to be ran in administrator mode and needs the machines local username/password each time you run it.

Ideally I'd like to switch back to using the default VirtualBox synced folders, however unfortunately there is no way to do this. As it stands I have to use config.vm.box_version = "<=8.2.1" to hold back my Debian version until I can find a way to fix it.

@LondonAppDev: I understand, I have this Setup here working quite well in my Windows Environments. For smb3, I would only advise you to do so if you have Windows 8 & 10 as your host, as only those Support smb3. For Windows 7 you would have to switch back to smb 2 or just smb. Other than that supporting guest OS symlinks without touching my host OS file structure was key for me, that's what mfsymlinks does. Administrator mode is currently required that's true. I guess this could be worked around with having a dedicated user on the host system that is allowed to access smb shares, but I have not looked into that.

I have another Windows 10 / cygwin / rsync problem
Vagrant is v1.8.1

ersitzt@ersitzt-PC /cygdrive/d/docker
$ vagrant up
Bringing machine 'vertxdev' up with 'docker' provider...
==> vertxdev: Docker host is required. One will be created if necessary...
    vertxdev: Docker host VM is already ready.
==> vertxdev: Syncing folders to the host VM...
    default: The machine you're rsyncing folders to is configured to use
    default: password-based authentication. Vagrant can't script rsync to automatically
    default: enter this password, so you'll likely be prompted for a password
    default: shortly.
    default:
    default: If you don't want to have to do this, please enable automatic
    default: key insertion using `config.ssh.insert_key`.
    default: Rsyncing folder: /cygdrive/d/docker/ => /var/lib/docker/docker_1452939306_39851
There was an error when attempting to rsync a synced folder.
Please inspect the error message below for more info.

Host path: /cygdrive/d/docker/
Guest path: /var/lib/docker/docker_1452939306_39851
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:/cygwin/tmp/ssh.311 -o ControlPersist=10m -o StrictHostKeyChecking=no -o IdentitiesOnly=true -o UserKnownHostsFile=/dev/null --exclude .vagrant/ /cygdrive/d/docker/ [email protected]:/var/lib/docker/docker_1452939306_39851
Error: Warning: Permanently added '[127.0.0.1]:2222' (ECDSA) to the list of known hosts.
Permission denied, please try again.
Permission denied, please try again.
Permission denied (publickey,password,keyboard-interactive).
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]

It states that it may ask for a password, but it does not.

If i run rsync manually as someone did here (http://stackoverflow.com/questions/33751174/rsync-permission-denied-error-using-vagrants-docker-provider-on-windows/34812874#34812874)
it works.

The controlpath for cygwin seems wrong, it should have been /cygdrive/c/....

ControlPath=C:/cygwin/tmp/ssh.311

On Sat, Jan 16, 2016 at 8:28 AM, Dennis [email protected] wrote:

I have another Windows 10 / cygwin / rsync problem
Vagrant is v1.8.1

ersitzt@ersitzt-PC /cygdrive/d/docker
$ vagrant up
Bringing machine 'vertxdev' up with 'docker' provider...
==> vertxdev: Docker host is required. One will be created if necessary...
vertxdev: Docker host VM is already ready.
==> vertxdev: Syncing folders to the host VM...
default: The machine you're rsyncing folders to is configured to use
default: password-based authentication. Vagrant can't script rsync to automatically
default: enter this password, so you'll likely be prompted for a password
default: shortly.
default:
default: If you don't want to have to do this, please enable automatic
default: key insertion using config.ssh.insert_key.
default: Rsyncing folder: /cygdrive/d/docker/ => /var/lib/docker/docker_1452939306_39851
There was an error when attempting to rsync a synced folder.
Please inspect the error message below for more info.

Host path: /cygdrive/d/docker/
Guest path: /var/lib/docker/docker_1452939306_39851
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:/cygwin/tmp/ssh.311 -o ControlPersist=10m -o StrictHostKeyChecking=no -o IdentitiesOnly=true -o UserKnownHostsFile=/dev/null --exclude .vagrant/ /cygdrive/d/docker/ [email protected]:/var/lib/docker/docker_1452939306_39851
Error: Warning: Permanently added '[127.0.0.1]:2222' (ECDSA) to the list of known hosts.
Permission denied, please try again.
Permission denied, please try again.
Permission denied (publickey,password,keyboard-interactive).
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]

It states that it may ask for a password, but it does not.

If i run rsync manually as someone did here (
http://stackoverflow.com/questions/33751174/rsync-permission-denied-error-using-vagrants-docker-provider-on-windows/34812874#34812874
)
it works.


Reply to this email directly or view it on GitHub
https://github.com/mitchellh/vagrant/issues/6677#issuecomment-172181676.

@nuncanada Indeed this seems to be the issue. The ControlPath and the path to the private_key are set as Windows-style paths (e.g. C:/...), instead of /c/....

The same issue is #6696

Having this same issue. Windows 10 cygwin (64bit) rsync 3.1.2-1 Virtualbox 5.0.14

@LondonAppDev @ctaorminainn I also had the dup() in/out/err failed error, but I managed to solve it.

I found that the issue was because I didn't have the ssh bundled with my Cygwin install. When you're installing Cygwin, it recommends you only install what you need. As such, I only selected rsync because I had a working ssh with my Windows git installation. As you've already guessed, they're not compatible!

The fix was to add Cygwin's version of ssh to the Cygwin installation, and for good measure, I removed the git PATH to make sure that rsync was using the ssh that was part of the same distribution as itself.

Hopefully this fixes it for you both.

For _Broken pipe_ error while rsyncing (as per @stefda post), you need to increase server alive interval in your ~/.ssh/config, e.g.

Host *
  ServerAliveInterval 30
  ServerAliveCountMax 6

It will give more time for rsync command to calculate file checksums on the remote in order to find the differences.

Closing this as root cause seems to be configuration error. If the behavior persists, please feel free to open a new issue. Cheers!

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.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

jsirex picture jsirex  ·  3Comments

luispabon picture luispabon  ·  3Comments

barkingfoodog picture barkingfoodog  ·  3Comments

OtezVikentiy picture OtezVikentiy  ·  3Comments

Cbeck527 picture Cbeck527  ·  3Comments