10/14/2007
Solving rsync hangs with Cygwin
I was using Cygwin rsync on our two Windows laptops to copy our files over from the old laptop to the new laptop. Invariably, the rsync would copy a handful of files and then hang. Restarting the rsync would copy a few more files and then hang again. Searching around on the Web, I found a lot of people complaining about Cygwin rsync hanging and not a ton of helpful information, but a few bits here and there that suggested that the problem was limited to using rsync over ssh and that rsync to a rsync daemon works better. Probably the most helpful page I came across was this page (which I actually found after I had fixed the problem, while looking for a good link for this post).
Well, I tried it and yes, running an rsync in daemon mode on the “server” completely solved the problem. You can set up an rsync daemon as a Windows service using a command like this:
cygrunsrv --install "rsyncd" --path /usr/bin/rsync --args "--daemon --no-detach" --desc "Starts a rsync daemon for accepting incoming rsync connections" --disp "Rsync Daemon" --type auto
You also need an rsyncd.conf file. I actually already had one because I had previously installed a modified Cygwin rsyncd package from the backuppc project. I did run into a problem with that though because the rsync.exe in that package conflicted with my installed Cygwin (cygwin1.dll versioning problems I suspect). So I ended up modifying the rsyncd.conf to use cygwin paths instead of Windows paths and then used the regular cygwin rsync.exe.
Interestingly, neither the rsync FAQ nor the Cygwin FAQ mention this problem.
Del.icio.us
Digg
Reddit
Technorati
Possibly related posts
Comments
Leave a reply



i was pulling my hair out trying to set this rsync over ssh on win sbs 2k3. thanks to you it now works! i wish that chaps from cygwin project would include this in their bloody FAQ!
Thanks - I was stuck on this.
Since this is the top hit on Google for “rsync hangs windows”, I thought I’d outline how the paranoid amongst us can still use SSH:
1. On the server, set “hosts allow = 127.0.0.1″ in rsyncd.conf. This will only allow local connections to the rsync server
2. On the client, SSH in to the server, forwarding local port 873 to localhost:873. In PuTTY, this is configured through Connection->SSH->Tunnels in the PuTTY configuration.
3. On the client, change rsync://server/whatever to rsync://localhost/whatever and run rsync in the normal way
Basically, instead of getting the rsync client to talk to a remote rsync server, this uses a feature of SSH that fools the client and server into thinking they’re on the same computer. I have no idea why this should be any better, but it works fine for me.
- Andrew Sayers