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

Vagrant not working with rsync on Windows 10 #6677

Closed
LondonAppDev opened this issue Dec 16, 2015 · 12 comments
Closed

Vagrant not working with rsync on Windows 10 #6677

LondonAppDev opened this issue Dec 16, 2015 · 12 comments

Comments

@LondonAppDev
Copy link

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/ vagrant@127.0.0.1:/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.

@Perni1984
Copy link

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!

@stefda
Copy link

stefda commented Dec 29, 2015

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/ vagrant@127.0.0.1:/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/ vagrant@127.0.0.1:/home/citypantry/project/frontend

@LondonAppDev
Copy link
Author

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.

@Perni1984
Copy link

@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.

@erSitzt
Copy link
Contributor

erSitzt commented Jan 16, 2016

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/ docker@127.0.0.1:/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.

@nuncanada
Copy link

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 notifications@github.com 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/ docker@127.0.0.1:/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
#6677 (comment).

@clns
Copy link

clns commented Feb 15, 2016

@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

@ctaorminainn
Copy link

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

@kwakwaversal
Copy link

@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.

@chrisroberts chrisroberts added this to the 1.9 milestone Oct 3, 2016
@kenorb
Copy link
Contributor

kenorb commented Dec 2, 2016

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.

@chrisroberts
Copy link
Member

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

@ghost
Copy link

ghost commented Apr 3, 2020

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.

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

No branches or pull requests