5

I have rsyncd running as a Windows service, but when I try to access a module and sync from it, I get the files I want, as well as a lot that I do not — because they are not located in that module on the remote end. To test, I put just one single file in the backup folder, called "the_only_file". From my local machine:

username@local:~$ rsync username@remote::backup .

receiving incremental file list
file has vanished: "/proc" (in backup)
file has vanished: "/cygdrive/c" (in backup)
file has vanished: "/cygdrive/d" (in backup)
skipping non-regular file "dev/clipboard"
skipping non-regular file "dev/conin"
skipping non-regular file "dev/conout"
skipping non-regular file "dev/console"
skipping non-regular file "dev/dsp"
skipping non-regular file "dev/full"
skipping non-regular file "dev/kmsg"
skipping non-regular file "dev/null"
skipping non-regular file "dev/ptmx"
skipping non-regular file "dev/pty0"
skipping non-regular file "dev/random"
skipping non-regular file "dev/scd0"
skipping non-regular file "dev/sda"
skipping non-regular file "dev/sda1"
skipping non-regular file "dev/sda2"
skipping non-regular file "dev/sr0"
skipping non-regular file "dev/tty"
skipping non-regular file "dev/urandom"
skipping non-regular file "dev/windows"
skipping non-regular file "dev/zero"
./
the_only_file
cygdrive/
dev/

sent 70 bytes  received 613 bytes  455.33 bytes/sec
total size is 0  speedup is 0.00
rsync warning: some files vanished before they could be transferred (code 24) at main.c(1708) [generator=3.1.0]

username@local:~$ ls
cygdrive dev the_only_file

I used the following commands in cygwin to create the service:

cygrunsrv --install "rsyncd" --path "$(which rsync)" --args "--daemon --no-detach" --desc "Starts rsync daemon to accept rsync connections" --disp "rsync daemon" --type "auto"

And my rsyncd.conf is pretty straightforward:

chroot = yes
charset = UTF-8
log file = /var/log/rsyncd.log

[backup]
      uid = username
      secrets file = /cygdrive/c/cygwin/etc/rsyncd.secrets
      auth users = username
      path = /cygdrive/c/Users/username/backup
      list = false
      readonly = false
      dont compress = *.gz *.tgz *.zip *.z *.rpm *.deb *.iso *.bz2 *.tbz *.7z

What can I do to make Cygwin's rsyncd behave like it's supposed to? (Why would it try to send me the /proc directory? So weird...)

courtlandj
  • 171
  • 6

2 Answers2

2

I "solved" this by doing it the way I sort of didn't want to do: I added the following line to my rsyncd.conf:

    exclude from = /cygdrive/c/cygwin/etc/rsyncd.exclude

And rsyncd.exclude is:

- /dev/*
- /dev
- /cygdrive/*
- /cygdrive
- /proc

Now it works as intended, with the caveat that this means I can't have directories / files named "dev", "proc" or "cygdrive" in my share's root directory. Probably doesn't matter to most; it would be confusing to have a "cygdrive" or "proc" folder, but an argument could be made that a folder for devs would be called "dev" or something like that. Again, seems somewhat minor, maybe most won't care.

courtlandj
  • 171
  • 6
  • See Spooky's answer for a definitive fix. – oligofren May 03 '16 at 16:36
  • I can't verify that as a fix unfortunately. I've remade my initial circumstances from scratch (no more rsyncd.exclude, just one file in one module), and this problem just doesn't happen anymore. Perhaps this has been fixed by Cygwin upstream since my problem. Also, for whatever difference it might make: I never used cwRsync as Spooky's non-English doc refers to. – courtlandj May 03 '16 at 17:53
  • Cwrsync is just Cygwin RSync bundled with the minimum amount of Cygwin dlls – oligofren May 03 '16 at 21:08
  • I am aware of what cwRsync is supposed to be. I neither used nor tested against that more limited environment & whatever differences it might have between my full Cygwin installation. – courtlandj May 04 '16 at 15:44
2

I solved this by adding use chroot = false to my /etc/rsyncd.conf.

Spooky
  • 125
  • 1
  • 7
  • There are always issues with providing a link as an answer... In this case the answers appear to be in chinese, and of no use in resolving the apparent contradiction in the answer. I will attest that adding use chroot = false to the rsyncd file (either globally or per module) will actually SOLVE the problem described. I put this here 'cause I don't know if I have enough juice to edit in this section. – BISI Jul 06 '20 at 23:15
  • @BISI The link is not the answer -- the answer was the answer, and the link was supplementary. I'll remove it. I can't read Chinese, but it was the only thing that helped me at the time. The translated relevant part is just "If used, there will be the following Error: file has vanished [...]". There's no further explanation, but it put me on the right track. – Spooky Jul 07 '20 at 17:47
  • @BISI The rsyncd.conf(5) manpage refers to `use chroot` as a "parameter". Although perhaps unclear, there was no contradiction: `use chroot = false` _disables_ the `use chroot` parameter, and that's what fixed it for me (and you). `use chroot = true` (the default) _enables_ the parameter, which seemed to be the cause of the issue. – Spooky Jul 07 '20 at 17:47