Bug 102612 - Wrong time set upon boot if clock is set to local time
Summary: Wrong time set upon boot if clock is set to local time
Alias: None
Product: Red Hat Linux
Classification: Retired
Component: initscripts   
(Show other bugs)
Version: 9
Hardware: i386 Linux
Target Milestone: ---
Assignee: Bill Nottingham
QA Contact: Brock Organ
Depends On:
TreeView+ depends on / blocked
Reported: 2003-08-18 17:53 UTC by Atanas Georgiev
Modified: 2014-03-17 02:38 UTC (History)
1 user (show)

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Last Closed: 2003-08-18 18:00:22 UTC
Type: ---
Regression: ---
Mount Type: ---
Documentation: ---
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---

Attachments (Terms of Use)

Description Atanas Georgiev 2003-08-18 17:53:56 UTC
From Bugzilla Helper:
User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.3) Gecko/20030313

Description of problem:

1. /usr is a separate partition
2. the hardware clock is set to store local time
3. local time is different from UTC

When booting, the rc.local script will read the clock configuration from
/etc/sysconfig/clock and will try to set the clock using 'hwclock --hctosys
--localtime' (which is correct).

In doing so, it will try to read the timezone file /etc/localtime.  The problem
is that /etc/localtime is a link pointing to whithin /usr/share.  If /usr (or
/usr/share) is a separate partition, it will not yet be mounted at this time in
the boot process and /etc/localtime will point to an unexisting location.

The result is that hwclock's access to /etc/localtime will fail with ENOENT and
it will default to UTC (for lack of timezone info).  Thus, when setting the
system date, it will use the correct local time read from the hardware clock,
however it will think (wrongly!) that this is UTC time.  Later on, when the
system boots, it will have access to the zoneinfo file and it will (wrongly!)
offset the time by the difference between the local time and UTC.

Version-Release number of selected component (if applicable):

How reproducible:

Steps to Reproduce:
1. Find a system that mounts /usr as a separate partition
2. Set it up (using redhat-config-time) so that it stores local time in the
hardware clock and it uses a zone other than UTC.
3. Set the correct time.
4. Disable ntp.
5. Reboot

Actual Results:  Time (as reported by /bin/date) offset by difference between
local timezone and UTC.  /sbin/hwclock reports the correct time.

Expected Results:  Correct time.

Additional info:

One caveat: If the system is setup with NTP, the time is sometimes fixed later
in the boot process by ntpdate.  This is witnessed by an entry in the system log
file, e.g:

ntpdate[798]: step time server offset 14399.507052 sec

At other times, the ntp server refuses to start because the time difference is
too large.

NOTE: The file /etc/localtime actually belongs to the glibc package,
however, I am reporting this under initscripts since this is more of a 
rc.sysinit problem.

Comment 1 Bill Nottingham 2003-08-18 18:00:22 UTC
This is a since-fixed bug in redhat-config-date, in that it makes /etc/localtime
a symlink (it's not supposed to be).

Note You need to log in before you can comment on or make changes to this bug.