[arch-projects] hwclock adjust file

Tom Gundersen teg at jklm.no
Mon Jun 6 13:43:31 EDT 2011

On Mon, Jun 6, 2011 at 7:12 PM, Dan McGee <dpmcgee at gmail.com> wrote:
> We moved this out of /etc because it is written to, and /etc/ should
> be treated as read-only by system scripts if I'm not mistaken. I think
> your logic is totally off here, as /etc/ should be read only?
> https://bugs.archlinux.org/task/26

You are right that this is not ideal, but the problem is ultimately an
upstream one (writing to /etc on --adjust).

That said, it is ok for system scripts to write to /etc as a result of
manual invocation (--set or --systohc), just not automatically. So the
only problem we have is with the --adjust on shutdown (which atm is
not a big problem since /etc is rw on shutdown anyway).

If /etc was already able to be used ro, I would not have suggested
this, but it is not, and will not be for some time (waiting for
libmount support to reach all the tools might take some time). I think
it is better to do the writes in /etc in the short-term and submit a
proper fix upstream for the long-term (this I will do, unless it
becomes clear that my approach is flawed).

The problem we have now is that the UTC/LOCALTIME value is stored on
two different places (rc.conf and /var/lib/hwclock/adjtime), and the
manpages of hwclock refer to a third one (/etc/adjtime). This means
that when hwclock is called from initscripts it uses the value in
rc.conf (as /var might not be mounted), but if the admin calls hwclock
manually the value in /var will be used. These values might not be in
sync, and then confusion/havoc would ensue (as apparently has happened
for many users).

In case it was not clear, I suggest the following:

Now: stop patching util-linux (move adjtime to /etc).

Soon: submit a patch to util-linux that keeps the "time of last write
to rtc" in /var, and "driftrate" and "UTC/LOCAL" in /etc; apply this
in our package if/when it is accepted upstream. If it is not accepted,
surely they must have another approach, as they too want /etc to be

Makes sense?


I'm a huge proponent of ro /etc, so I wouldn't do anything to jeopardise that.

More information about the arch-projects mailing list