Gentoo Archives: gentoo-mirrors

From: Tobias Klausmann <klausman@××××××××××××.de>
To: gentoo-mirrors@l.g.o
Subject: Re: [gentoo-mirrors] chroot() and broken logging with rsyncd
Date: Tue, 07 Dec 2004 12:59:11
Message-Id: 20041207125905.GA867@eric.schwarzvogel.de
In Reply to: [gentoo-mirrors] chroot() and broken logging with rsyncd by Tobias Klausmann
Hi! 

On Sat, 06 Nov 2004, Tobias Klausmann wrote:
> The problem is this: rsyncd logs various stuff after chrooting > (for example the "wrote X read Y total size Z" line. > Unfortunately, at this point /etc/localtime is inaccesible, > resulting in UTC times being used. Other log lines (most notably > the per -session "rsync on gentoo-portage from NAME (IP)" are > written *outside* the chroot(), resulting in localized times. > > At first I thought this might be fixed by using syslog logging, > but as the syslog call is used (i.e. not syslog-over-UDP) , the > problem remains. > > So I thought, I'd deactivate chroot()ing in order to narrow down > the problem. And bing: using use chroot=false "fixes" the > timestamps. > > Loging with broken timestamps is damn near unusable, so what > should we do about it? I've written to the rsync maintainers (via > their mailing list) but got no feedback whatsoever :-(
After finally devoting some time to thinking about it, I have a solution: just add an appropriate etc/localtime to your rsync tree (where the chroot happens). You have to do a little more stuff, though, otherwise people will get that file/dir when they sync. Hence: - Change your syncing job to exclude your timezone file. In my case, it now reads: rsync -rlptDvz --exclude /etc --delete \ rsync://rsync1.us.gentoo.org/gentoo-portage/ /var/rsync/gentoo/ Note the "--exclude /etc" part. Excludes are always relative the published tree. This prevents your half-hour sync from nuking your localtime file. - Change your rsyncd.conf to exclude the same tree (People out there probably don't care much about it :) My config looks like this: motd file = /etc/rsync/rsyncd.motd log file = /var/log/rsync.log pid file = /var/run/rsyncd.pid timeout = 150 uid=nobody gid=nogroup [gentoo-x86-portage] path = /var/rsync/gentoo comment = Gentoo Linux Portage tree (deprecated) use chroot = true exclude = /etc [gentoo-portage] path = /var/rsync/gentoo comment = Gentoo Linux Portage tree use chroot = true exclude = /etc Note the two exclude= lines. Again, those includes are relative to the specified path. - Restart your rsync daemon (in case you don't use inetd - Now copy your /etc/localtime to your tree, in my case that's /var/rsync/gentoo/etc/localtime Voilá! Correct timestamps and chroot() working as expected. Hope this helps people who've had the same trouble as I did. Regards, Tobias (rsync5.de) PS: When will gentoo-x86-portage be phased out for good? -- export DISPLAY=vt100 -- gentoo-mirrors@g.o mailing list