Bug 430423

Summary: fails to set clock on bootup since rtc-cmos driver isn't loaded yet
Product: [Fedora] Fedora Reporter: Charles R. Anderson <cra>
Component: kernelAssignee: Kernel Maintainer List <kernel-maint>
Status: CLOSED RAWHIDE QA Contact: Fedora Extras Quality Assurance <extras-qa>
Severity: low Docs Contact:
Priority: low    
Version: rawhideCC: notting
Target Milestone: ---   
Target Release: ---   
Hardware: All   
OS: Linux   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2008-01-29 16:35:53 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Attachments:
Description Flags
patch to debug initscripts hwclock setting none

Description Charles R. Anderson 2008-01-27 22:49:11 UTC
Description of problem:
hwclock fails to set the system time from the RTC since the kernel driver for
/dev/rtc isn't loaded yet.

Version-Release number of selected component (if applicable):
initscripts-8.62-1.x86_64

How reproducible:
always

Steps to Reproduce:
1. UTC=false in /etc/sysconfig/clock (not strictly necessary)
2. chkconfg ntpd off (not strictly necessary either)
3. Boot the system and watch the messages.
4. Note that clock is incorrect, especially if you don't have UTC=true set.

Actual results:

No usable clock interface found.
Cannot access the Hardware Clock via any known method.

Clock is incorrect by the UTC offset, or sometimes completely wrong.

Expected results:

Correct system time set from RTC.

Additional info:

Here is the bootup output from debugging with the included patch which also runs
hwclock again after start_udev, where it succeeds:

SELinux:  Disabled at runtime.
audit(1201454801.799:2): selinux=0 auid=4294967295
INIT: version 2.86 booting
                Welcome to Fedora
                Press 'I' to enter interactive startup.
+ update_boot_stage RCclock
+ '[' yes = yes -a -x /usr/bin/rhgb-client ']'
+ /usr/bin/rhgb-client --update=RCclock
+ return 0
+ ARC=0
+ SRM=0
+ UTC=0
+ '[' -f /etc/sysconfig/clock ']'
+ . /etc/sysconfig/clock
++ ZONE=America/New_York
++ UTC=false
++ ARC=false
+ '[' '' = GMT ']'
+ '[' '' = ARC ']'
+ CLOCKDEF=
+ CLOCKFLAGS=' --hctosys'
+ case "$UTC" in
+ CLOCKFLAGS=' --hctosys --localtime'
+ CLOCKDEF=' (localtime)'
+ case "$ARC" in
+ case "$SRM" in
+ ls -l /dev/rtc
crw------- 1 root root 10, 135 2008-01-27 12:26 /dev/rtc
+ grep rtc
+ lsmod
+ '[' -x /sbin/hwclock ']'
+ /sbin/hwclock --debug --hctosys --localtime
hwclock from util-linux-ng 2.13.1-rc2
hwclock: Open of /dev/rtc failed, errno=2: No such file or directory.
No usable clock interface found.
Cannot access the Hardware Clock via any known method.
++ date
+ action 'Setting clock  (localtime): Sun Jan 27 12:26:43 EST 2008' /bin/true
+ /sbin/start_udev
Starting udev: udevd-event[1396]: node_symlink: device node '/dev/rtc' already
exists, link to '/dev/rtc0' will not overwrite it
                                                           [  OK  ]
+ '[' -x /sbin/hwclock ']'
+ /sbin/hwclock --debug --hctosys --localtime
hwclock from util-linux-ng 2.13.1-rc2
Using /dev interface to clock.
Assuming hardware clock is kept in local time.
Waiting for clock tick...
/dev/rtc0 does not have interrupt functions. Waiting in loop for time from
/dev/rtc0 to change
...got clock tick
Time read from Hardware Clock: 2008/01/27 17:26:48
Hw clock time : 2008/01/27 17:26:48 = 1201472808 seconds since 1969
Calling settimeofday:
        tv.tv_sec = 1201472808, tv.tv_usec = 0
        tz.tz_minuteswest = 300
++ date
+ action 'Setting clock  (localtime): Sun Jan 27 17:26:48 EST 2008' /bin/true

...

+ /bin/dmesg -n 3
++ cat /proc/cmdline
+ cmdline='ro root=/dev/l.sys/root single'
+ '[' -f /proc/sys/kernel/modprobe ']'
+ strstr 'ro root=/dev/l.sys/root single' nomodules
+ '[' 'ro root=/dev/l.sys/root single' = 'ro root=/dev/l.sys/root single' ']'
+ return 1
+ '[' -f /proc/modules ']'
+ sysctl -w kernel.modprobe=/sbin/modprobe
+ touch /dev/.in_sysinit
+ '[' -x /bin/taskset ']'
+ strstr 'ro root=/dev/l.sys/root single' default_affinity=
+ '[' 'ro root=/dev/l.sys/root single' = 'ro root=/dev/l.sys/root single' ']'
+ return 1
++ pidof nash
+ nashpid=505
+ '[' -n 505 ']'
+ kill 505
+ unset nashpid
+ /sbin/start_udev
Starting udev: udevd-event[1396]: node_symlink: device node '/dev/rtc' already
exists, link to '/dev/rtc0' will not overwrite it
                                                           [  OK  ]
+ '[' -x /sbin/hwclock ']'
+ /sbin/hwclock --debug --hctosys --localtime
hwclock from util-linux-ng 2.13.1-rc2
Using /dev interface to clock.
Assuming hardware clock is kept in local time.
Waiting for clock tick...
/dev/rtc0 does not have interrupt functions. Waiting in loop for time from
/dev/rtc0 to change
...got clock tick
Time read from Hardware Clock: 2008/01/27 17:26:48
Hw clock time : 2008/01/27 17:26:48 = 1201472808 seconds since 1969
Calling settimeofday:
        tv.tv_sec = 1201472808, tv.tv_usec = 0
        tz.tz_minuteswest = 300
++ date
+ action 'Setting clock  (localtime): Sun Jan 27 17:26:48 EST 2008' /bin/true

Comment 1 Charles R. Anderson 2008-01-27 22:49:11 UTC
Created attachment 293087 [details]
patch to debug initscripts hwclock setting

Comment 2 Bill Nottingham 2008-01-29 03:01:32 UTC
This would be simpler to fix by having the clock built-in; otherwise we need to
shuffle around quite a bit, and I'd rather have the clock set as early as possible.

Comment 3 Chuck Ebbert 2008-01-29 16:35:53 UTC
rtc-cmos is now built-in.