Do not set the hardware clock to the system time on shutdown
As discovered when looking into a similar problem on Jessie (#9363 (closed)),
util-linux
’s hwclock.sh
on Wheezy is supposed to set the hardware
clock to the system time on shutdown, which contradicts one of our
design goals.
And indeed, on Tails 1.3.2 this seems to be confirmed by:
root@amnesia:~# hwclock -r
Sat May 9 13:05:37 2015 -0.469382 seconds
root@amnesia:~# hwclock --set --date="2010-01-01 12:00:00"
root@amnesia:~# hwclock -r
Fri Jan 1 12:00:04 2010 -0.767842 seconds
root@amnesia:~# date
Sat May 9 13:06:29 UTC 2015
root@amnesia:~# /etc/init.d/hwclock.sh stop
[info] Saving the system clock.
[info] Hardware Clock updated to Sat May 9 13:06:36 UTC 2015.
root@amnesia:~# hwclock -r
Sat May 9 13:06:40 2015 -0.500988 seconds
I didn’t check on bare metal whether the time set in the hardware clock survives a reboot yet. I’m pretty sure I did verify that it didn’t in the past, but it was surely during Squeeze (or even Lenny) area, so perhaps it was caused by a bug that was fixed in Wheezy.
Sadly, if we tried to fix this by setting HWCLOCKACCESS=no
in
/etc/default/hwclock
, then this would also disable sync’ing system
time from the hardware clock on startup, which is not desirable. So,
we’ll have to patch the initscript’s LSB headers so that it’s not run
at shutdown/reboot time. Not worth improving this in Debian, since that
initscript is obsolete in Jessie anyway.
Feature Branch: bugfix/9364-do-not-modify-hardware-clock
Related issues
- Related to #9363 (closed)
- Related to #9557 (closed)
Original created by @intrigeri on 9364 (Redmine)