[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Improving hwclock support in Debian (testing wanted)


The attached patch against current util-linux cleans up hwclock
handling with the following changes:

• There are currently two init scripts, hwclockfirst.sh and
  hwclock.sh.  The reasons for these two originally existing
  (/etc/localtime not being present until after /usr was
  mounted AFAICT) no longer exist.  I've removed hwclockfirst
  and adjusted the hwclock init script to run before checkroot.

• Currently the setting for if the hardware clock is in UTC or
  local time is set with the UTC setting in /etc/default/rcS.
  However, this needlessly duplicates the /existing/ setting in
  hwclock's own configuration file (/etc/adjtime).  This means
  hwclock's behaviour is overridden and its configuration
  overwritten *every shutdown*.  This patch migrates the existing
  UTC= setting to UTC/LOCAL in /etc/adjtime.

• The hwclock init scripts use the --utc and --localtime options
  (based on the UTC setting).  This patch changes hwclock to use
  the value in /etc/adjtime.

• The udev hwclock-set script now runs unconditionally in all
  cases using --tzset.  (It's a no-op for UTC.)

• If the user runs "hwclock --systohc (--utc|--localtime) this is
  now handled correctly.  The clock state is recorded in
  /etc/adjtime and correctly handled on restart.  This means the
  UTC setting in /etc/default/rcS doesn't screw things up by
  requiring two separate changes to do the same thing.

• systemd uses /etc/adjtime as for hwclock to store the hardware
  clock UTC/LOCAL configuration.  This change means there's a
  single place to store the hardware clock configuration for all
  init systems.

I've tested the patch on a powerpc system for a PST timezone using
UTC and LOCAL options both with and without udev support (commented
out the udev conditionals to test non-udev code).  It would be
great to have some testing on different hardware and setups with
UTC or local time to make sure this covers all possible
configurations without any regressions.

There's an additional patch for d-i clock-setup to make this work
for new installs as well (#660093).  I'll file a bug with this
patch against util-linux once this is properly tested.


  .''`.  Roger Leigh
 : :' :  Debian GNU/Linux    http://people.debian.org/~rleigh/
 `. `'   schroot and sbuild  http://alioth.debian.org/projects/buildd-tools
   `-    GPG Public Key      F33D 281D 470A B443 6756 147C 07B3 C8BC 4083 E800

Attachment: util-linux-hwclock-decruft.patch.bz2
Description: Binary data

Reply to: