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
Keywords:
Status: CLOSED RAWHIDE
Alias: None
Product: Red Hat Linux
Classification: Retired
Component: initscripts
Version: 9
Hardware: i386
OS: Linux
medium
medium
Target Milestone: ---
Assignee: Bill Nottingham
QA Contact: Brock Organ
URL:
Whiteboard:
Depends On:
Blocks:
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:
Clone Of:
Environment:
Last Closed: 2003-08-18 18:00:22 UTC
Embargoed:


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:

Conditions:
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):
initscripts-7.14-1

How reproducible:
Always

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 192.168.1.1 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.