Util-Linux package development
 help / color / mirror / Atom feed
* hwclock's ADJPATH
@ 2011-07-26  0:06 Tom Gundersen
  2011-07-26 10:46 ` Karel Zak
  0 siblings, 1 reply; 2+ messages in thread
From: Tom Gundersen @ 2011-07-26  0:06 UTC (permalink / raw)
  To: util-linux

Hi guys,

Sami's latest hwclock patches reminded me of something I have long
been meaning to bring up:

I have been unable to figure out how to use hwclock in such a way that
we (Arch Linux) can set a reasonable ADJPATH.

These are the constraints we have:

/etc could possibly be mounted read-only.
/var might not be mounted at early boot.

This is the usage we have (in the cases where a machine does not use ntp):

1) At early boot we call "hwclock --systz", which require us to read
ADJPATH to determine if RTC is in UTC/LOCAL (so ADJTIME can not be in
/var).
2) From time to time (typically at shutdown), we call "hwclock
--adjust", which require us to write to ADJPATH (so ADJPATH can not be
in /etc).
3) The administrator should manually call "hwclock --set" and make
sure ADJPATH is writeable when this is done (for this, ADJPATH could
be either in /etc or /var).



Are these reasonable constraints and a reasonable usecase? If so, it
seems to me that the only way to make this work is to split ADJPATH
into two files, /etc/adjtime containing UTC/LOCAL and
/var/lib/hwclock/adjtime containing everything else. Or am I missing
something?

Cheers,

Tom

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: hwclock's ADJPATH
  2011-07-26  0:06 hwclock's ADJPATH Tom Gundersen
@ 2011-07-26 10:46 ` Karel Zak
  0 siblings, 0 replies; 2+ messages in thread
From: Karel Zak @ 2011-07-26 10:46 UTC (permalink / raw)
  To: Tom Gundersen; +Cc: util-linux

On Tue, Jul 26, 2011 at 02:06:20AM +0200, Tom Gundersen wrote:
> These are the constraints we have:
> 
> /etc could possibly be mounted read-only.
> /var might not be mounted at early boot.
> 
> This is the usage we have (in the cases where a machine does not use ntp):
> 
> 1) At early boot we call "hwclock --systz", which require us to read
> ADJPATH to determine if RTC is in UTC/LOCAL (so ADJTIME can not be in
> /var).
>
> 2) From time to time (typically at shutdown), we call "hwclock
> --adjust", which require us to write to ADJPATH (so ADJPATH can not be
> in /etc).
> 3) The administrator should manually call "hwclock --set" and make
> sure ADJPATH is writeable when this is done (for this, ADJPATH could
> be either in /etc or /var).
> 
> 
> 
> Are these reasonable constraints and a reasonable usecase? If so, it
> seems to me that the only way to make this work is to split ADJPATH
> into two files, /etc/adjtime containing UTC/LOCAL and
> /var/lib/hwclock/adjtime containing everything else. Or am I missing
> something?

 You're probably right. Note that you can use:

    hwclock --systz $(CLOCK_ZONE_OPTION)

 where the CLOCK_ZONE_OPTION will be --utc or --local from some extra
 file (e.g. /etc/sysconfig/hwclock), then /etc/adjtime will be
 unnecessary for --systz.

 And for hwclock --set or --adjust you can use
 --adjfile=/var/lib/hwclock/adjtime or so.


 Note that systemd will probably not call hwclock at all, it will read
 only /etc/adjtime to get UTC/LOCAL setting and call settimeofday().
 The --adjust is somehow unexpected on systems with systemd.

    Karel

-- 
 Karel Zak  <kzak@redhat.com>
 http://karelzak.blogspot.com

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2011-07-26 10:46 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-07-26  0:06 hwclock's ADJPATH Tom Gundersen
2011-07-26 10:46 ` Karel Zak

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox