Bug 104888

Summary: Should not adjust hardware clock on shutdown
Product: [openSUSE] SUSE LINUX 10.0 Reporter: Joerg Arndt <joerg.arndt>
Component: KernelAssignee: Dr. Werner Fink <werner>
Status: RESOLVED WORKSFORME QA Contact: E-mail List <qa-bugs>
Severity: Critical    
Priority: P5 - None CC: aj, lnussel, ro
Version: unspecified   
Target Milestone: ---   
Hardware: All   
OS: All   
Whiteboard:
Found By: Other Services Priority:
Business Priority: Blocker: ---
Marketing QA Status: --- IT Deployment: ---

Description Joerg Arndt 2005-08-16 09:46:06 UTC
The script boot.clock "adjusts" the hardware clock upon shutdown.
This often leads to an exponential (in terms of powerdowns) drift
of the time.
- Without ntp writing to the hwclock is pure evil
- With ntp there is no point to do so
Additional problem occur with a dual boot configuration.
Comment 1 Dr. Werner Fink 2005-08-16 10:08:40 UTC
I do NOT agree, I want to ajust the hwclock of my mainboard
to the correct system time. This because without there is no
control how big the drift of the mainboard clock is between
two reboots.
Comment 2 Joerg Arndt 2005-08-16 10:38:06 UTC
How (without ntp) can Linux possibly know better than the hwclock?
I seen the following scenario an various machines and SL versions:
(about) the first 5 sessions: no notable offset
next: 2 minutes off 
next: 5 min off
next: 10 min off
next: 20 min off   etc.
This is really bad.
Comment 3 Dr. Werner Fink 2005-08-16 10:50:40 UTC
Beside NTP it is possible to use e.g. the system time of the TV
channel or transponder configured in VDR or using the system time
of the ISDN provider like the Telekom.
Comment 4 Joerg Arndt 2005-08-16 12:46:09 UTC
Still, with no external time reference, never modify the hwclock.
Comment 5 Dr. Werner Fink 2005-08-16 13:55:12 UTC
Rudi?
Comment 6 Ludwig Nussel 2005-08-16 14:53:22 UTC
I vote for disabling the drift compensation feature (/etc/adjtime) by default 
instead as that's what confuses people who don't know about it. Not syncing 
the system time to the hwclock at shutdown would mean changes like the ones 
done by vdr would be lost I guess. 
Comment 7 Dr. Werner Fink 2005-08-16 15:07:18 UTC
Args ... I hate recordings in the future.  I vote for the
drift compensation feature.
Comment 8 Ludwig Nussel 2005-08-16 15:25:00 UTC
For people like you and me who know this feature exists and how it works it 
may be useful. However, it drives people nuts that sometimes set their time in 
Linux, sometimes in the BIOS and sometimes in Windows because they are unaware 
of /etc/adjtime. So what about introducing HWCLOCK_ADJTIME and HWCLOCK_SYSTOHC 
in /etc/sysconfig/clock? 
Comment 9 Dr. Werner Fink 2005-08-16 16:22:48 UTC
The hwclock setting is absolute required to to the fact that
if _no_ ntp is running the system clock is much more accurate
than the cmos.  The question which remains:  Why do jj
see an exponential increase of the offset, this looks like
an other bug.

IMHO this could be a kernel problem.
Comment 10 Joerg Arndt 2005-08-16 16:29:35 UTC
What magic is done by the system that it has a more accurate time
than a quartz clock?  Read: I don't believe it.
Comment 11 Olaf Kirch 2005-08-17 08:51:31 UTC
Hubert is on vacation. 
 
The cumulative time drift jj observed might be a case of lost timer ticks, 
but then the drift would be linear. 
The clock drift was backwards, not forward, right? 
 
Losing several minutes per session is bad though. Have you observed this 
behavior with SL10.0? If so, on what hardware? 
Comment 12 Joerg Arndt 2005-08-19 08:35:06 UTC
The drift is more often a forward drift (clock shows future).
The direction of the drift depends on the particular machine.
Observed on x86, amd64 and (intel) notebooks, all SL9.x.
Didn't try SL10 (as the problem only starts to show after,
say, 10 reboots within 2 weeks, there is little point in trying).

 
Comment 13 Olaf Kirch 2005-08-19 09:55:49 UTC
So it's not loss of timer ticks. 
 
If it goes in both directions, my suspicion would be that there's a systematic 
rounding error in the code that updates the adjtime file, and that simply 
accumulates as time goes by. 
Comment 14 Hubert Mantel 2005-08-31 15:40:07 UTC
Does not sound like a kernel bug to me.
Comment 15 Hendrik Vogelsang 2005-08-31 15:51:53 UTC
does not sound like a ntp bug to me because jj isnt using ntp. And now?
Comment 16 Joerg Arndt 2005-08-31 15:58:14 UTC
Who is responsible for the boot.clock script?
Assign to him/her.

Btw. the script shouldn't say "setting up the CMOS clock"
when it really only sets the system time.
Comment 17 Hendrik Vogelsang 2005-08-31 16:07:41 UTC
werner is responsible for the boot.clock script. i dont like bug ping pong
Comment 18 Ruediger Oertel 2005-09-01 10:19:57 UTC
mmj: heard of any such problems with hwclock before ? 
Comment 19 Mads Martin Joergensen 2005-09-01 10:33:56 UTC
Never
Comment 20 Andreas Kleen 2005-09-01 10:36:59 UTC
Me neither.
Comment 21 Joerg Arndt 2005-09-06 11:27:37 UTC
msommer (added to CC) has seen the bug, emap has seen it, I have
seen it.  You insinuate it does not exist?
It is not a ntp issue, CMOS clock should be left alone
when no (more reliable) timesource is used.
If you 'correct' the CMOS clock without ntp or equivalent
you will mess it up in almost all cases.
That simple.
Comment 22 Hendrik Vogelsang 2005-09-06 15:40:36 UTC
ok back to werner then
Comment 23 Dr. Werner Fink 2005-09-06 15:55:12 UTC
Then your systems are broken. I've never ever seen that
with a correct configured system.
Comment 25 Dr. Werner Fink 2005-09-07 10:02:08 UTC
Not using UTC in CMOS toghether with a wrong configuration
within /etc/sysconfig/clock _is_ broken.  Assuming that the
system clock is less accurate than the CMOS clock is also
broken.  Not using the drift between system clock and
HW clock after a reboot is also broken.

I've systems with and NTP and all work as they  should.
Also the systems around here do their job. It was discussed
here and the current solution is correct.  This because
a simple reboot should not through the systen backward
in time.  This would cause many troubles like files put
into the future.
Comment 26 Martin Sommer 2005-09-07 10:22:26 UTC
Why I can use "local time" in CMOS if it's not a good idea?
How can I have a wrong configuration in /etc/sysconfig/clock if I never touch
this settings?

I also have systems WITH NTP and all they work well. But the systems without NTP
don't work.
Comment 27 Michael Gross 2005-09-10 13:14:09 UTC
I have observed this behaviour myself on varous machines (workstations with
regular reboots) and a friend of mine reported the same problems to me. I think
it would really make sense to change this.
Comment 28 Michael Gross 2005-09-10 13:16:27 UTC
Or why not making this an option, which is disabled by default? So everyone
could be made happy here. I'd consider this a fine enhancement if you will.