setting system clock

Dan Nicholson dbn.lists at gmail.com
Fri Nov 9 10:33:55 PST 2007


On Nov 9, 2007 9:31 AM, Alexander E. Patrakov <patrakov at gmail.com> wrote:
>
> I have two questions about the setclock script.
>
> 1) It sets CLOCKPARAMS to the empty string _after_ sourcing the
> /etc/sysconfig/clock configuration file, and then appends either --utc
> or --localtime there. Is this a thinko? Did you mean to set CLOCKPARAMS
> to the empty string _before_ sourcing the configuration file, so that a
> user might place, e.g., CLOCKPARAMS="--directisa" or
> CLOCKPARAMS="--rtc=/dev/rtc0" there?

Yeah, that's definitely wrong. The rest of the script even tries to
handle the fact that CLOCKPARAMS may not be null.

> 2) With the hardware clock in UTC, the bootscript executes "hwclock
> --hctosys --utc", however, "strace -e open hwclock --hctosys --utc"
> indicates that the /usr/share/zoneinfo/Universal file is also being
> opened. However, the setclock script runs before mounting /usr. Is this
> a problem? (with --localtime, it doesn't open any files from /usr).

Good catch. I don't know what to do here. What happens is that if
--utc is given, hwclock sets TZ="" and then does tzset(), which grabs
the Universal tzfile if TZ is set but empty. You can see this easily:

#include <time.h>
int main()
{
    tzset();
}

Set TZ="" and strace that.

I suppose the only way is to move setclock after checkfs mountfs in
rcsysinit.d, but that seems like a bad idea. I guess that shows how
many people have /usr on a separate mount :)

--
Dan



More information about the lfs-dev mailing list