[ntp:questions] Leap second indication (Linux NTPD specifically)

Dave Hart hart at ntp.org
Tue Mar 6 23:12:54 UTC 2012

On Tue, Mar 6, 2012 at 16:28, Phil Fisher <Phil.Fisher at ipaccess.com> wrote:
> Your message also seems to suggest there is a bug inserting the
> leap second in the kernel; AFAIK the bug is in the printk() routine
> not the actual kernel time code (kernel/timer.c on Linux).

Referring to the Linux kernel as "the" kernel is something I'd never
do.  I'd also never bother to distinguish that a bug exhibited by one
code path in the Linux kernel is in fact caused by a different Linux
kernel bug.  A kernel bug is a kernel bug to me.  I've heard of the
bug resulting in Linux systems crashing on leap second insertion, and
printk() rings a bell.  That is the only bug I've heard of regarding
leap seconds crashing systems.

> P.S. The reasons for NTPD shutdown for days prior to Leap Second
> event are because no-one has yet been able to tell me whether the
> Linux 2.6.9 kernel has "memory" of a LI event such that it _will_ try to
> deal with it independent of any further NTPd/NTP interaction.  And if
> such "memory" does exist then the suggestion I have will of course
> fail miserably.

This is a good point.  Using the antique kernel and ancient ntpd
you're locked into, it's quite possible the kernel will remember the
pending leap second insertion if ntpd has been run without "disable
kernel" since the OS started.  That also reminds me that prior to ntpd
4.2.7p214, anytime you switch between the kernel loop discipline and
ntpd's (with "disable kernel") you should reset the kernel loop
frequency to zero using "ntptime -f 0" to avoid ugliness due to both
ntpd and the kernel loop discipline applying similar frequency
corrections.  Restarting the OS also resets the kernel frequency
compensation to zero.

So long as ntpd has not engaged the kernel NTP code since the system
has started, the kernel code should not have any idea there is a leap
second pending to remember once ntpd stops or is restarted but
switched to the daemon (ntpd) loop discipline.

Please share the results of your testing with the group.

Dave Hart

More information about the questions mailing list