AKB
2017-Jan-13 04:15 UTC
Rsync tries to access unnecessary files/dirs after chrooting itself.
Hi. While debugging some encfs errors in the logs, I realized they are being generated because rsync (chrooted inside a encfs file system, --reverse) is trying to access files like: /root/.popt, /etc/localtime etc. This doesn't seem to be related to ID-name mapping as I already have numeric ids enabled in config. Here is the relevant strace output: [pid 25549] chroot("/chroot") = 0 [pid 25549] chdir("/") = 0 [pid 25549] setgid(0) = 0 [pid 25549] setgroups(1, [0]) = 0 [pid 25549] setuid(0) = 0 [pid 25549] setresuid(-1, 0, -1) = 0 [pid 25549] geteuid() = 0 [pid 25549] write(3, "@RSYNCD: OK\n", 12) = 12 [pid 25549] select(4, [3], NULL, [3], {60, 0}) = 1 (in [3], left {59, 961500}) [pid 25549] read(3, "-", 1) = 1 ........... ........... [pid 25549] select(4, [3], NULL, [3], {60, 0}) = 1 (in [3], left {59, 999994}) [pid 25549] read(3, "\0", 1) = 1 [pid 25549] open("/usr/etc/popt", O_RDONLY) = -1 ENOENT (No such file or directory) [pid 25549] open("/etc/popt", O_RDONLY) = -1 ENOENT (No such file or directory) [pid 25549] stat("/etc/popt.d", 0x7ffdf53cf1c0) = -1 ENOENT (No such file or directory) [pid 25549] open("/root/.popt", O_RDONLY) = -1 ENOENT (No such file or directory) [pid 25549] stat("/etc/localtime", 0x7ffdf53cd4e0) = -1 ENOENT (No such file or directory) [pid 25549] open("/etc/localtime", O_RDONLY|O_CLOEXEC) = -1 ENOENT (No such file or directory) [pid 25549] write(4, "2017/01/13 03:44:20 [25549] rsyn"..., 86) = 86 [pid 25549] fcntl(3, F_GETFL) = 0x802 (flags O_RDWR|O_NONBLOCK) [pid 25549] fcntl(3, F_GETFL) = 0x802 (flags O_RDWR|O_NONBLOCK) [pid 25549] write(3, "\16", 1) = 1 [pid 25549] write(3, "\24MxX", 4) = 4 [pid 25549] brk(0x7fef0557c000) = 0x7fef0557c000 [pid 25549] select(4, [3], [], [3], {60, 0}) = 1 (in [3], left {59, 883408}) [pid 25549] read(3, "\4\0\0\7\0\0\0\0", 32768) = 8 [pid 25549] open("/etc/localtime", O_RDONLY|O_CLOEXEC) = -1 ENOENT (No such file or directory) [pid 25549] write(4, "2017/01/13 03:44:20 [25549] buil"..., 47) = 47 [pid 25549] chdir("/") = 0 [pid 25549] lstat(".", {st_mode=S_IFDIR|0755, st_size=4096, ...}) = 0 [pid 25549] mmap(NULL, 266240, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x7fef05033000 [pid 25549] mmap(NULL, 266240, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x7fef04f55000 [pid 25549] openat(AT_FDCWD, ".", O_RDONLY|O_NONBLOCK|O_DIRECTORY|O_CLOEXEC) = 5 [pid 25549] getdents(5, /* 2 entries */, 32768) = 48 [pid 25549] getdents(5, /* 0 entries */, 32768) = 0 [pid 25549] close(5) = 0 [pid 25549] select(4, [3], [3], [3], {60, 0}) = 1 (out [3], left {59, 999991}) [pid 25549] write(3, "\17\0\0\7\31\1.\0\0\20X\374Kx\355A\0\0\0", 19) = 19 [pid 25549] select(4, [3], [], [3], {60, 0}) = 1 (in [3], left {59, 960181}) [pid 25549] read(3, "\1\0\0\7\0", 32768) = 5 [pid 25549] select(4, [3], [3], [3], {60, 0}) = 1 (out [3], left {59, 999993}) [pid 25549] write(3, "\1\0\0\7\0", 5) = 5 [pid 25549] select(4, [3], [], [3], {60, 0}) = 1 (in [3], left {59, 961272}) [pid 25549] read(3, "\2\0\0\7\0\0", 32768) = 6 [pid 25549] select(4, [3], [3], [3], {60, 0}) = 1 (out [3], left {59, 999993}) [pid 25549] write(3, "\2\0\0\7\0\0", 6) = 6 [pid 25549] select(4, [3], [3], [3], {60, 0}) = 1 (out [3], left {59, 999994}) [pid 25549] write(3, "\17\0\0\7\0\23\0\0\36\0\0\0\0\0\1\0\0\0\0", 19) = 19 [pid 25549] select(4, [3], [], [3], {60, 0}) = 1 (in [3], left {59, 883181}) [pid 25549] read(3, "\1\0\0\7\0", 32768) = 5 [pid 25549] rt_sigaction(SIGUSR1, {SIG_IGN, [], SA_RESTORER, 0x7fef043e50e0}, NULL, 8) = 0 [pid 25549] rt_sigaction(SIGUSR2, {SIG_IGN, [], SA_RESTORER, 0x7fef043e50e0}, NULL, 8) = 0 [pid 25549] open("/etc/localtime", O_RDONLY|O_CLOEXEC) = -1 ENOENT (No such file or directory) [pid 25549] write(4, "2017/01/13 03:44:20 [25549] sent"..., 75) = 75 Can this be prevented on rsync side? On every access to a non-existing file/dir, the underlying fs (encfs) generates a error in the logs. Thanks.
AKB
2017-Jan-13 13:13 UTC
Rsync tries to access unnecessary files/dirs after chrooting itself.
Please ignore. The issue wasn't rsync's fault. Rsync daemon was being launched from a different process using execv which resulted in these side effects. Rsync launched on its own is working as expected. -----Original Message----- From: rsync [mailto:rsync-bounces at lists.samba.org] On Behalf Of AKB Sent: Friday, January 13, 2017 9:45 AM To: rsync at lists.samba.org Subject: Rsync tries to access unnecessary files/dirs after chrooting itself. Hi. While debugging some encfs errors in the logs, I realized they are being generated because rsync (chrooted inside a encfs file system, --reverse) is trying to access files like: /root/.popt, /etc/localtime etc. This doesn't seem to be related to ID-name mapping as I already have numeric ids enabled in config. Here is the relevant strace output: [pid 25549] chroot("/chroot") = 0 [pid 25549] chdir("/") = 0 [pid 25549] setgid(0) = 0 [pid 25549] setgroups(1, [0]) = 0 [pid 25549] setuid(0) = 0 [pid 25549] setresuid(-1, 0, -1) = 0 [pid 25549] geteuid() = 0 [pid 25549] write(3, "@RSYNCD: OK\n", 12) = 12 [pid 25549] select(4, [3], NULL, [3], {60, 0}) = 1 (in [3], left {59, 961500}) [pid 25549] read(3, "-", 1) = 1 ........... ........... [pid 25549] select(4, [3], NULL, [3], {60, 0}) = 1 (in [3], left {59, 999994}) [pid 25549] read(3, "\0", 1) = 1 [pid 25549] open("/usr/etc/popt", O_RDONLY) = -1 ENOENT (No such file or directory) [pid 25549] open("/etc/popt", O_RDONLY) = -1 ENOENT (No such file or directory) [pid 25549] stat("/etc/popt.d", 0x7ffdf53cf1c0) = -1 ENOENT (No such file or directory) [pid 25549] open("/root/.popt", O_RDONLY) = -1 ENOENT (No such file or directory) [pid 25549] stat("/etc/localtime", 0x7ffdf53cd4e0) = -1 ENOENT (No such file or directory) [pid 25549] open("/etc/localtime", O_RDONLY|O_CLOEXEC) = -1 ENOENT (No such file or directory) [pid 25549] write(4, "2017/01/13 03:44:20 [25549] rsyn"..., 86) = 86 [pid 25549] fcntl(3, F_GETFL) = 0x802 (flags O_RDWR|O_NONBLOCK) [pid 25549] fcntl(3, F_GETFL) = 0x802 (flags O_RDWR|O_NONBLOCK) [pid 25549] write(3, "\16", 1) = 1 [pid 25549] write(3, "\24MxX", 4) = 4 [pid 25549] brk(0x7fef0557c000) = 0x7fef0557c000 [pid 25549] select(4, [3], [], [3], {60, 0}) = 1 (in [3], left {59, 883408}) [pid 25549] read(3, "\4\0\0\7\0\0\0\0", 32768) = 8 [pid 25549] open("/etc/localtime", O_RDONLY|O_CLOEXEC) = -1 ENOENT (No such file or directory) [pid 25549] write(4, "2017/01/13 03:44:20 [25549] buil"..., 47) = 47 [pid 25549] chdir("/") = 0 [pid 25549] lstat(".", {st_mode=S_IFDIR|0755, st_size=4096, ...}) = 0 [pid 25549] mmap(NULL, 266240, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x7fef05033000 [pid 25549] mmap(NULL, 266240, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x7fef04f55000 [pid 25549] openat(AT_FDCWD, ".", O_RDONLY|O_NONBLOCK|O_DIRECTORY|O_CLOEXEC) = 5 [pid 25549] getdents(5, /* 2 entries */, 32768) = 48 [pid 25549] getdents(5, /* 0 entries */, 32768) = 0 [pid 25549] close(5) = 0 [pid 25549] select(4, [3], [3], [3], {60, 0}) = 1 (out [3], left {59, 999991}) [pid 25549] write(3, "\17\0\0\7\31\1.\0\0\20X\374Kx\355A\0\0\0", 19) = 19 [pid 25549] select(4, [3], [], [3], {60, 0}) = 1 (in [3], left {59, 960181}) [pid 25549] read(3, "\1\0\0\7\0", 32768) = 5 [pid 25549] select(4, [3], [3], [3], {60, 0}) = 1 (out [3], left {59, 999993}) [pid 25549] write(3, "\1\0\0\7\0", 5) = 5 [pid 25549] select(4, [3], [], [3], {60, 0}) = 1 (in [3], left {59, 961272}) [pid 25549] read(3, "\2\0\0\7\0\0", 32768) = 6 [pid 25549] select(4, [3], [3], [3], {60, 0}) = 1 (out [3], left {59, 999993}) [pid 25549] write(3, "\2\0\0\7\0\0", 6) = 6 [pid 25549] select(4, [3], [3], [3], {60, 0}) = 1 (out [3], left {59, 999994}) [pid 25549] write(3, "\17\0\0\7\0\23\0\0\36\0\0\0\0\0\1\0\0\0\0", 19) = 19 [pid 25549] select(4, [3], [], [3], {60, 0}) = 1 (in [3], left {59, 883181}) [pid 25549] read(3, "\1\0\0\7\0", 32768) = 5 [pid 25549] rt_sigaction(SIGUSR1, {SIG_IGN, [], SA_RESTORER, 0x7fef043e50e0}, NULL, 8) = 0 [pid 25549] rt_sigaction(SIGUSR2, {SIG_IGN, [], SA_RESTORER, 0x7fef043e50e0}, NULL, 8) = 0 [pid 25549] open("/etc/localtime", O_RDONLY|O_CLOEXEC) = -1 ENOENT (No such file or directory) [pid 25549] write(4, "2017/01/13 03:44:20 [25549] sent"..., 75) = 75 Can this be prevented on rsync side? On every access to a non-existing file/dir, the underlying fs (encfs) generates a error in the logs. Thanks. -- Please use reply-all for most replies to avoid omitting the mailing list. To unsubscribe or change options: https://lists.samba.org/mailman/listinfo/rsync Before posting, read: http://www.catb.org/~esr/faqs/smart-questions.html