Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 231857 - net-dns/avahi are shown with GMT timezone instead of system one because of missing file in /etc/avahi
Summary: net-dns/avahi are shown with GMT timezone instead of system one because of mi...
Status: CONFIRMED
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: Current packages (show other bugs)
Hardware: All Linux
: High normal (vote)
Assignee: No maintainer - Look at https://wiki.gentoo.org/wiki/Project:Proxy_Maintainers if you want to take care of it
URL: http://avahi.org/ticket/221
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2008-07-15 10:49 UTC by Pacho Ramos
Modified: 2023-01-28 20:08 UTC (History)
2 users (show)

See Also:
Package list:
Runtime testing required: ---


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Pacho Ramos gentoo-dev 2008-07-15 10:49:13 UTC
I already reported this to upstream:
http://avahi.org/ticket/221

I have GMT+1 as my timezone, but avahi logs in /var/log/messages are shown in GMT date instead. Seems that date is not being changed when avahi runs, simply is a problem showing logs

Lennart explained me the cause:

"Avahi runs in a chroot. Because libc works the way it works it needs /etc/localtime around for correct tz configuration. This is by default not available in the chroot. Which is usually not a problem, since most reasonable syslog implementations ignore the sender timestamps of local syslog clients anyway and always fill in the local reception timestamp instead. However, some of the crazier syslog implementations don't do this. Also, networked syslog doesn't (and shouldn't).

I made downstream maintainers aware of this a while back. They should copy (or bind mount) /etc/localtime into the chroot before starting avahi. Please file a bug regarding this to your gentoo maintainers. Debian/Ubuntu and other distros do this properly."

I simply copied /etc/localtime to /etc/avahi/etc/localtime and now is fixed (other option could be mount it with bind)

Thanks a lot

Reproducible: Always
Comment 1 Pacho Ramos gentoo-dev 2009-01-30 12:38:06 UTC
Any news on this? Thanks
Comment 2 Pacho Ramos gentoo-dev 2009-05-09 10:46:49 UTC
Is this so hard to fix? Maybe linking the file instead of copying it would be better...

Thanks
Comment 3 Jacob Welsh 2009-07-14 21:31:06 UTC
(In reply to comment #2)
> Is this so hard to fix? Maybe linking the file instead of copying it would be
> better...
> 
> Thanks
> 

Symlinking won't work because then the actual contents of the file are outside the chroot jail and thus cannot be read.

Adding "use_time_recvd(yes);" to the options section in /etc/syslog-ng/syslog-ng.conf seems to work to make syslog-ng report actual message receipt times rather than client reported times. Debian's syslog would appear to have this behavior by default.
Comment 4 Pacho Ramos gentoo-dev 2012-03-19 13:13:39 UTC
(In reply to comment #3)
> (In reply to comment #2)
> > Is this so hard to fix? Maybe linking the file instead of copying it would be
> > better...
> > 
> > Thanks
> > 
> 
> Symlinking won't work because then the actual contents of the file are
> outside the chroot jail and thus cannot be read.
> 
> Adding "use_time_recvd(yes);" to the options section in
> /etc/syslog-ng/syslog-ng.conf seems to work to make syslog-ng report actual
> message receipt times rather than client reported times. Debian's syslog
> would appear to have this behavior by default.

Will ask syslog-ng maintainer then
Comment 5 Jacob Welsh 2012-03-20 00:34:39 UTC
> > Symlinking won't work because then the actual contents of the file are
> > outside the chroot jail and thus cannot be read.
> > 
> > Adding "use_time_recvd(yes);" to the options section in
> > /etc/syslog-ng/syslog-ng.conf seems to work to make syslog-ng report actual
> > message receipt times rather than client reported times. Debian's syslog
> > would appear to have this behavior by default.
> 
> Will ask syslog-ng maintainer then

Actually, I now suggest not relying only on use_time_recvd, since as Lennart notes there are cases where you don't want that (whether it's a good default or not). A different chrooted daemon on CentOS (BIND) does this in the init script:

if [ -s /etc/localtime ]; then
    cp -fp /etc/localtime ${ROOTDIR}/etc/localtime
fi

And roughly the same for avahi-daemon. It's a bit ugly I suppose, but probably less so than a bind mount.
Comment 6 Anthony Basile gentoo-dev 2013-05-28 02:28:07 UTC
Pacho, I'm a bit confused about this bug.  Do we still want to do this or not.  Its a trivial fix, but I'm not sure given the comments about syslog-ng.
Comment 7 Pacho Ramos gentoo-dev 2013-05-28 18:24:59 UTC
In fedora:
http://pkgs.fedoraproject.org/cgit/avahi.git/tree/avahi.spec

I see they are copying localtime inside chroot and, since they use systemd logging capabilities and Lennart is taking care of both, I guess current syslog behavior is not "so crazy" and we should do the changes in avahi instead of syslog-ng config