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

Can't synchronize folders using rsync on windows #3913

Closed
pgibler opened this issue May 27, 2014 · 10 comments
Closed

Can't synchronize folders using rsync on windows #3913

pgibler opened this issue May 27, 2014 · 10 comments

Comments

@pgibler
Copy link

pgibler commented May 27, 2014

Hey there,

My settings - Windows 8.1, Vagrant 1.6.2, rsync attempt using Cygwin and then Msys

I've been banging my head against a wall all day trying to figure out how to get better filesystem performance with Vagrant in windows. I gave smb a shot - failed to load on my machine (story for another ticket). The NFS plugin for vagrant does not work with the current version. I decided to give rsync a shot since it sounded like a pretty nice solution to the issue. However, when I attempt to use it, it gives me a strange problem - first, as you'll see in my console output, when I get to the point where I'm prompted for my secret_key passphrase and vagrant password, my console goes a little bit haywire and I have to carefully, slowly type in my 'vagrant' password to fulfill the password portion. It then gives the subsequent error, even if I put in the right password or hit Ctrl+C to break it out (because it actually hangs up the terminal when this issue happens). I don't know how the permissions of that file are relevant to rsync, but vagrant ssh is no problemo.

This is my folder setting in my Vagrantfile

config.vm.synced_folder ".", "/vagrant", type: "rsync",
                          rsync__exclude: ".git/"

This is my console output when attempting to use these settings:

$ vagrant reload
==> default: Attempting graceful shutdown of VM...
==> 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: 3000 => 3000 (adapter 1)
    default: 1234 => 1234 (adapter 1)
    default: 22 => 2222 (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: Machine booted and ready!
Got different reports about installed GuestAdditions version:
Virtualbox on your host claims:   4.2.0
VBoxService inside the vm claims: 4.3.12
Going on, assuming VBoxService is correct...
GuestAdditions seems to be installed (4.3.12) correctly, but not running.
Got different reports about installed GuestAdditions version:
Virtualbox on your host claims:   4.2.0
VBoxService inside the vm claims: 4.3.12
Going on, assuming VBoxService is correct...
stdin: is not a tty
Starting the VirtualBox Guest Additions ...done.
Got different reports about installed GuestAdditions version:
Virtualbox on your host claims:   4.2.0
VBoxService inside the vm claims: 4.3.12
Going on, assuming VBoxService is correct...
Got different reports about installed GuestAdditions version:
Virtualbox on your host claims:   4.2.0
VBoxService inside the vm claims: 4.3.12
Going on, assuming VBoxService is correct...
==> default: Checking for guest additions in VM...
    default: The guest additions on this VM do not match the installed version o
f
    default: VirtualBox! In most cases this is fine, but in rare cases it can
    default: prevent things such as shared folders from working properly. If you
 see
    default: shared folder errors, please make sure the guest additions within t
he
    default: virtual machine match the version of VirtualBox you have installed
on
    default: your host and reload your VM.
    default:
    default: Guest Additions Version: 4.2.0
    default: VirtualBox Version: 4.3
==> default: Setting hostname...
==> default: Rsyncing folder: /cygdrive/c/Users/Paul/git/FuzBuny/ => /vagrant
==> default:   - Exclude: [".vagrant/", ".git/"]
Enter passphrase for key 'C:/Users/Paul/.vagrant.d/insecure_private_key':
vgrnt
Enter passphrase for key 'C:/Users/Paul/.vagrant.d/insecure_private_key':
vagrant@127.0.0.1's password: a

vagvagrant@127.0.0.1's password:
vagrant@127.0.0.1's password:
There was an error when attempting to rsync a synced folder.
Please inspect the error message below for more info.

Host path: /cygdrive/c/Users/Paul/git/FuzBuny/
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 StrictHos
tKeyChecking=no -o UserKnownHostsFile=/dev/null -i 'C:/Users/Paul/.vagrant.d/ins
ecure_private_key' --exclude .vagrant/ --exclude .git/ /cygdrive/c/Users/Paul/gi
t/FuzBuny/ vagrant@127.0.0.1:/vagrant
Error: Warning: Permanently added '127.0.0.1' (RSA) to the list of known hosts.
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
@         WARNING: UNPROTECTED PRIVATE KEY FILE!          @
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
Permissions 0444 for 'C:/Users/Paul/.vagrant.d/insecure_private_key' are too ope
n.
It is recommended that your private key files are NOT accessible by others.
This private key will be ignored.
bad permissions: ignore key: C:/Users/Paul/.vagrant.d/insecure_private_key
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
@         WARNING: UNPROTECTED PRIVATE KEY FILE!          @
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
Permissions 0444 for 'C:/Users/Paul/.vagrant.d/insecure_private_key' are too ope
n.
It is recommended that your private key files are NOT accessible by others.
This private key will be ignored.
bad permissions: ignore key: C:/Users/Paul/.vagrant.d/insecure_private_key
Permission denied, please try again.
Permission denied, please try again.
rsync: connection unexpectedly closed (0 bytes received so far) [Receiver]
rsync error: error in rsync protocol data stream (code 12) at io.c(605) [Receive
r=3.0.9]
rsync: read error: Connection reset by peer (104)
rsync error: error in rsync protocol data stream (code 12) at /usr/src/rsync/rsy
nc-3.0.8/io.c(760) [sender=3.0.8]

It's very unfortunate that I can't get this working. Help?

@pgibler
Copy link
Author

pgibler commented May 27, 2014

The vagrant rsync command produces similar output:

Paul@Paul-PC /cygdrive/c/Users/Paul/git/AlmsGive
$ vagrant rsync
==> default: Rsyncing folder: /cygdrive/c/Users/Paul/git/AlmsGive/ => /vagrant
==> default:   - Exclude: [".vagrant/", ".git/"]
Enter passphrase for key 'C:/Users/Paul/.vagrant.d/insecure_private_key':
vagrant@127.0.0.1's password:
There was an error when attempting to rsync a synced folder.
Please inspect the error message below for more info.

Host path: /cygdrive/c/Users/Paul/git/AlmsGive/
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 StrictHos
tKeyChecking=no -o UserKnownHostsFile=/dev/null -i 'C:/Users/Paul/.vagrant.d/ins
ecure_private_key' --exclude .vagrant/ --exclude .git/ /cygdrive/c/Users/Paul/gi
t/AlmsGive/ vagrant@127.0.0.1:/vagrant
Error: Warning: Permanently added '127.0.0.1' (RSA) to the list of known hosts.
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
@         WARNING: UNPROTECTED PRIVATE KEY FILE!          @
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
Permissions 0444 for 'C:/Users/Paul/.vagrant.d/insecure_private_key' are too ope
n.
It is recommended that your private key files are NOT accessible by others.
This private key will be ignored.
bad permissions: ignore key: C:/Users/Paul/.vagrant.d/insecure_private_key
rsync: connection unexpectedly closed (0 bytes received so far) [Receiver]
rsync error: error in rsync protocol data stream (code 12) at io.c(605) [Receive
r=3.0.9]
rsync: read error: Connection reset by peer (104)
rsync error: error in rsync protocol data stream (code 12) at /usr/src/rsync/rsy
nc-3.0.8/io.c(760) [sender=3.0.8]

@mitchellh
Copy link
Contributor

Looks like the issue is with the permissions. I was under the impression that permissions on Windows with rsync weren't really a thing, so I'm not sure what to make of this. Is this only in Cygwin or other shells as well?

@pgibler
Copy link
Author

pgibler commented May 27, 2014

This is the Msys output (installed openssh and rsync)

C:\Users\Paul\git\AlmsGive>vagrant reload
==> default: Attempting graceful shutdown of VM...
==> 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: 3000 => 3000 (adapter 1)
    default: 1234 => 1234 (adapter 1)
    default: 22 => 2222 (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: Machine booted and ready!
Got different reports about installed GuestAdditions version:
Virtualbox on your host claims:   4.2.0
VBoxService inside the vm claims: 4.3.12
Going on, assuming VBoxService is correct...
GuestAdditions seems to be installed (4.3.12) correctly, but not running.
Got different reports about installed GuestAdditions version:
Virtualbox on your host claims:   4.2.0
VBoxService inside the vm claims: 4.3.12
Going on, assuming VBoxService is correct...
stdin: is not a tty
Starting the VirtualBox Guest Additions ...done.
Got different reports about installed GuestAdditions version:
Virtualbox on your host claims:   4.2.0
VBoxService inside the vm claims: 4.3.12
Going on, assuming VBoxService is correct...
Got different reports about installed GuestAdditions version:
Virtualbox on your host claims:   4.2.0
VBoxService inside the vm claims: 4.3.12
Going on, assuming VBoxService is correct...
==> default: Checking for guest additions in VM...
==> default: Setting hostname...
==> default: Rsyncing folder: /c/Users/Paul/git/AlmsGive/ => /vagrant
==> default:   - Exclude: [".vagrant/", "./git"]
Enter passphrase for key 'C:/Users/Paul/.vagrant.d/insecure_private_key':
vagrant@127.0.0.1's password:
There was an error when attempting to rsync a synced folder.
Please inspect the error message below for more info.

Host path: /c/Users/Paul/git/AlmsGive/
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 StrictHos
tKeyChecking=no -o UserKnownHostsFile=/dev/null -i 'C:/Users/Paul/.vagrant.d/ins
ecure_private_key' --exclude .vagrant/ --exclude ./git /c/Users/Paul/git/AlmsGiv
e/ vagrant@127.0.0.1:/vagrant
Error: Warning: Permanently added '127.0.0.1' (RSA) to the list of known hosts.
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
@         WARNING: UNPROTECTED PRIVATE KEY FILE!          @
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
Permissions 0644 for 'C:/Users/Paul/.vagrant.d/insecure_private_key' are too ope
n.
It is recommended that your private key files are NOT accessible by others.
This private key will be ignored.
bad permissions: ignore key: C:/Users/Paul/.vagrant.d/insecure_private_key
rsync: connection unexpectedly closed (0 bytes received so far) [Receiver]
rsync error: error in rsync protocol data stream (code 12) at io.c(605) [Receive
r=3.0.9]
rsync: read error: Connection reset by peer (104)
rsync error: error in rsync protocol data stream (code 12) at /usr/src/rsync/rsy
nc-3.0.8/io.c(760) [sender=3.0.8]

@pgibler
Copy link
Author

pgibler commented May 28, 2014

I was able to fix this within Cygwin by running chmod 400 on my insecure_private_key file.

chmod 400 C:/Users/Paul/.vagrant.d/insecure_private_key

For Vagrant, I doubt there's much that can be done to automatically handle this issue.

Let me know if you would prefer me to close this, unless you have an idea of what else could be done on Vagrant's end. I don't think is likely, but you would know best. Thanks for taking the time to review my issue.

As an aside, the performance of rsync has made this completely worth the effort. My project runs quite fast now.

@terrybu
Copy link

terrybu commented Jun 10, 2014

@pgibler hi pgibler, did you ever have a problem getting Rsync to work initially on Windows? When I do vagrant up, with your same settings in Vagrant file, it gives me error: "rsync" could not be found on your PATH. Make sure that rsync is properly installed on your system and available on the PATH ... even though I went into control panel and put in C:\cygwin64\bin as my PATH variable.

@pgibler
Copy link
Author

pgibler commented Jun 11, 2014

Hey bucifer,

Use the package manager for Cygwin to install both rsync & openssh. To get to the package manager, run installation executable you downloaded - setup-x86.exe (32-bit installation) or setup-x86_64.exe (64-bit installation). Navigate using the default options until you get to the packages screen. I've attached some screenshots showing what mine looks like. Your option will be Install, not Keep - I have them installed already.

image

image

@terrybu
Copy link

terrybu commented Jun 22, 2014

@pgibler thank you so much, the 32-bit worked for me better than 64-bit version for some reason (My Windows 7 is 64-bit version) ... I had to uninstall everything in the 64-bit and follow your instructions and then set environtment variables once again. It works now!!

@pgibler
Copy link
Author

pgibler commented Jun 22, 2014

Glad I could help bucifer =)

@schkovich
Copy link

In addition I had to change cygdrive prefix from default /cygdrive to /. Otherwise rsync will fail with following error:

rsync: change_dir "/d/Users/user.name/Projects/yourproject" failed: No such file or directory (2)
rsync error: some files/attrs were not transferred (see previous errors) (code 23) at main.c(1183) [sender=3.1.0]

@mitchellh
Copy link
Contributor

Closing for #4073

@ghost ghost locked and limited conversation to collaborators Apr 9, 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

4 participants