1 |
Hi! |
2 |
|
3 |
On Sat, 06 Nov 2004, Tobias Klausmann wrote: |
4 |
> The problem is this: rsyncd logs various stuff after chrooting |
5 |
> (for example the "wrote X read Y total size Z" line. |
6 |
> Unfortunately, at this point /etc/localtime is inaccesible, |
7 |
> resulting in UTC times being used. Other log lines (most notably |
8 |
> the per -session "rsync on gentoo-portage from NAME (IP)" are |
9 |
> written *outside* the chroot(), resulting in localized times. |
10 |
> |
11 |
> At first I thought this might be fixed by using syslog logging, |
12 |
> but as the syslog call is used (i.e. not syslog-over-UDP) , the |
13 |
> problem remains. |
14 |
> |
15 |
> So I thought, I'd deactivate chroot()ing in order to narrow down |
16 |
> the problem. And bing: using use chroot=false "fixes" the |
17 |
> timestamps. |
18 |
> |
19 |
> Loging with broken timestamps is damn near unusable, so what |
20 |
> should we do about it? I've written to the rsync maintainers (via |
21 |
> their mailing list) but got no feedback whatsoever :-( |
22 |
|
23 |
After finally devoting some time to thinking about it, I have a |
24 |
solution: just add an appropriate etc/localtime to your rsync |
25 |
tree (where the chroot happens). You have to do a little more |
26 |
stuff, though, otherwise people will get that file/dir when |
27 |
they sync. Hence: |
28 |
|
29 |
- Change your syncing job to exclude your timezone file. In my |
30 |
case, it now reads: |
31 |
rsync -rlptDvz --exclude /etc --delete \ |
32 |
rsync://rsync1.us.gentoo.org/gentoo-portage/ /var/rsync/gentoo/ |
33 |
Note the "--exclude /etc" part. Excludes are always relative |
34 |
the published tree. |
35 |
This prevents your half-hour sync from nuking your localtime |
36 |
file. |
37 |
|
38 |
- Change your rsyncd.conf to exclude the same tree (People out |
39 |
there probably don't care much about it :) |
40 |
|
41 |
My config looks like this: |
42 |
|
43 |
motd file = /etc/rsync/rsyncd.motd |
44 |
log file = /var/log/rsync.log |
45 |
pid file = /var/run/rsyncd.pid |
46 |
timeout = 150 |
47 |
uid=nobody |
48 |
gid=nogroup |
49 |
[gentoo-x86-portage] |
50 |
path = /var/rsync/gentoo |
51 |
comment = Gentoo Linux Portage tree (deprecated) |
52 |
use chroot = true |
53 |
exclude = /etc |
54 |
[gentoo-portage] |
55 |
path = /var/rsync/gentoo |
56 |
comment = Gentoo Linux Portage tree |
57 |
use chroot = true |
58 |
exclude = /etc |
59 |
|
60 |
Note the two exclude= lines. Again, those includes are relative |
61 |
to the specified path. |
62 |
|
63 |
- Restart your rsync daemon (in case you don't use inetd |
64 |
|
65 |
- Now copy your /etc/localtime to your tree, in my case that's |
66 |
/var/rsync/gentoo/etc/localtime |
67 |
|
68 |
Voilá! Correct timestamps and chroot() working as expected. |
69 |
|
70 |
Hope this helps people who've had the same trouble as I did. |
71 |
|
72 |
Regards, |
73 |
Tobias (rsync5.de) |
74 |
|
75 |
PS: When will gentoo-x86-portage be phased out for good? |
76 |
|
77 |
-- |
78 |
export DISPLAY=vt100 |
79 |
|
80 |
-- |
81 |
gentoo-mirrors@g.o mailing list |