Bryan Kadzban bryan at kadzban.is-a-geek.net
Wed Jun 24 21:05:38 PDT 2009

Bruce Dubbs wrote:
> I believe there was some discussion of setting the system clock via
> udev a while back, but I can't find the thread right now.


is the actual change.  You could probably find that though.  :-)

I'm not sure where the thread was either.  Anyway...

> I had a short email conversation with the util-linux-ng maintainer
> about putting /etc/adjtime in /var/lib like is done in LFS.  He asked
> about the timing of mounting partitions (S40mountfs for us) and
> running hwclock (S25setclock for us).

Well, S20udev now...  but yeah.  :-)

> We modify the code to make the default location of adjtime to be
> /var/lib, but we don't warn about making /var a separate partition.
> If that is done, hwclock will not be able to save it's drift
> adjustment parameters.  It may be a non issue for us because I
> haven't heard anyone complain and the error message should be in the
> logs.

The error message might be in the logs -- if /var/log was mounted and
sysklogd was running.  :-P  (Or if hwclock printed out whatever error
message it generates today.  I haven't seen this though, and my /var is
a separate partition to prevent logs from filling the rootfs.  I don't
know if udevd will log that output if it exists...)

That being said, I use NTP, so if the lack of drift-records are actually
hurting me (and hwclock is silently failing to record drift), that's why
I never noticed.

> If we use udev to set the clock, we may get into a race problem with
> certain configurations.

I doubt it'll be a race; that's what the udevsettle is supposed to
prevent.  (...Not that it's a perfect solution either; I still add a
"sleep 5 ; udevsettle" onto the end of that script because otherwise it
misses various USB devices.  But it shouldn't miss the RTC.)

setclock will always fail to read/write adjtime when run before mountfs,
so it's probably much more likely that it just fails when run from udev

> I don't know if this is worth spending a lot of time, but I'd like to
> see a system that can have / mounted read only.

Then you're going to *NEED* the adjtime file somewhere other than the
rootfs...  :-)

> The problem areas during boot are /etc/mtab, /etc/blkid.tab, and
> /etc/adjtime.  With the move of libblkid and libuuid to
> util-linux-ng, the first two are being addressed in the relatively 
> near future,

Mmm?  Did mount stop writing to /etc/mtab or something?  That needs to
be writable no matter which blkid / uuid library you use.  Unless you
don't mind having "-o user" broken (I don't, but others probably do);
then you can symlink it to /proc/mounts.

blkid.tab may not be required anymore, though.  I don't know the status
of that.

> but we should get adjtime right for any reasonable configuration.

A warning in the book regarding /var might be in order.  Mentioning that
NTP probably doesn't require the adjtime file at all (depending on
whether the user wants a more-accurate clock before NTP starts) may be a
good idea as well.

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 260 bytes
Desc: OpenPGP digital signature
URL: <http://lists.linuxfromscratch.org/pipermail/lfs-dev/attachments/20090624/0a0058b2/attachment.sig>

More information about the lfs-dev mailing list