关于 Red Hat Enterprise Linux 如何处理六月三十日的闰秒情况说明

 

Leap Seconds in Red Hat Enterprise Linux

Issue

  • Does Red Hat Enterprise Linux properly handle leap seconds?
  • IERS have announced a leap second due at midnight, June 30th this year.  Red Hat needs to release an updated tzdata, so it can transition smoothly along precise NTP systems.
  • There will be a leap second end of June 2012. We would like to know if our servers with Red Hat 5.X (5.3, 5.4, 5.5, 5.7) will support it correctly.
  • How will RHEL 5 and RHEL 6 deal with this leap second?  We also have some legacy RHEL 2.1, RHEL 3, RHEL 4. Would there be anything to be aware of there?
  • Can the leap second message hang the kernel?

Environment

  • Red Hat Enterprise Linux versions 4, 5 and 6

Resolution

The resolution of this issue depends on whether or not the Red Hat Enterprise Linux system is running an NTP (Network Time Protocol) daemon.

Systems running NTP

Systems running any version of Red Hat Enterprise Linux should automatically account for leap second corrections if they are using the NTP (Network Time Protocol) daemon to synchronize their local timekeeping with an NTP server. During the last day before a leap second correction, NTP servers should notify their clients that a leap second will occur, and at 23:59:59 UTC, the Linux kernel should add or remove an extra second by making the 60th second twice as long or removing it entirely. Thus, Red Hat Enterprise Linux systems running an NTP client during the last leap second correction should have counted time as follows:

2008-12-31 23:59:59 UTC 2008-12-31 23:59:59 UTC 2009-01-01 00:00:00 UTC 

When the leap second occurs, the kernel prints a message to the system log.  There is a chance that the printing of this message can cause the kernel to crash in Red Hat Enterprise Linux 4 and 5.  To avoid this situation, please update to the latest version of the kernel available:

                                         

Red Hat Enterprise Linux (RHEL) Version Minimum Kernel Version Minimum RHEL Update Red Hat Errata
RHEL 4 kernel-2.6.9-89.EL 4.8 RHSA-2009:1024-1
RHEL 5 kernel-2.6.18-164.el5 5.4 RHSA-2009:1243-3
RHEL 6 RHEL 6 kernel is not affected by this problem

Please note that PPC and IA64 kernels may not insert the leap second properly.  For systems running on those architectures, the method below for systems not running NTP should be used.

Systems not running NTP

By default, Linux systems not using NTP to synchronize their timekeeping will not correct for leap seconds, and the time reported by these systems will have a one-second difference relative to UTC after the leap second correction. You should reset the clock manually after leap seconds occur.

You can also configure non-NTP systems to report time corrected for leap seconds by updating the tzdata package to the latest version available, copying the appropriate file from the /usr/share/zoneinfo/right directory hierarchy to /etc/localtime, and resetting the clock to the correct local time.  The files in /usr/share/zoneinfo/right contain local time information corrected for all leap seconds that have occurred since the beginning of the Epoch on 1970-01-01 00:00:00 UTC.  The other time zone files in /usr/share/zoneinfo do not have leap second corrections added.  After the 2008 leap second, there were 24 leap seconds added since the Epoch.

As an example, if a system is in the America/Los_Angeles (US Pacific) time zone, you can reconfigure the system to report leap-second-corrected time by running the following and resetting the clock to Pacific Time:

cp /usr/share/zoneinfo/right/America/Los_Angeles /etc/localtime 

Older tzdata packages in Red Hat Enterprise Linux will not account for the leap second added at the end of June, 2012. To ensure that non-NTP systems account properly for all leap seconds, please ensure that you have the following, or newer, versions of tzdata installed:

Red Hat Enterprise Linux (RHEL) Version Minimum tzdata Version
RHEL 3 tzdata-2011n-2.el3
RHEL 4 tzdata-2011n-2.el4
RHEL 5 tzdata-2011n-2.el5
RHEL 6 tzdata-2011n-2.el6

For additional information on the update to tzdata, please refer to RHEA-2012:0356-1

Root Cause

"Leap seconds" are extra seconds that are added or removed to keep Civil Time, which is based on Universal Coordinated Time (UTC), within 0.9 seconds of the Earth's rotational time (UT1).  The last leap second was added at 2008-12-31 23:59:59 UTC.  At that time, clocks keeping track of time based on UTC should have counted as follows:

2008-12-31 23:59:59 UTC 2008-12-31 23:59:60 UTC 2009-01-01 00:00:00 UTC 

Note that the leap second corrections are made at midnight UTC, which is at different local times around the world. For example, the most recent leap second was added at 3:59:60 pm in the US Pacific time zone (2008-12-31 15:59:60 PST).
Additional information on leap seconds and how they are handled in Linux and by NTP can be found at the following links:

  • Leap Seconds
  • The NTP Timescale and Leap Seconds
  • NTP in real Life: What happens during a Leap Second?
 

你可能感兴趣的:(ntp)