Bug 537595 - Incorrect time after reboot
Summary: Incorrect time after reboot
Alias: None
Product: Fedora
Classification: Fedora
Component: initscripts
Version: 12
Hardware: All
OS: Linux
Target Milestone: ---
Assignee: Bill Nottingham
QA Contact: Fedora Extras Quality Assurance
Depends On:
TreeView+ depends on / blocked
Reported: 2009-11-14 20:38 UTC by Boyan Anastasov
Modified: 2014-03-17 03:21 UTC (History)
4 users (show)

Fixed In Version: 9.02.1-1
Doc Type: Bug Fix
Doc Text:
Clone Of:
Last Closed: 2009-12-22 05:00:41 UTC

Attachments (Terms of Use)
patch for the udev rules (717 bytes, patch)
2009-11-17 16:23 UTC, Bill Nottingham
no flags Details | Diff

Description Boyan Anastasov 2009-11-14 20:38:25 UTC
Description of problem:
After boot the time is shifted 2 hours ahead on my system which is exactly my timezone EET (GMT+2). If I reboot again the diff is 2 more hours ahead and so on...

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

Additional info:
Kernel is vanilla (not Fedora kernel) if it does matter.
I've put some debug in /etc/rc.d/rc.sysinit and /etc/rc.d/init.d/halt and saw that the time is changed somewhere before them, which means somewhere in udev.
I've tested with renaming of hwclock, ntpdate, ntpd (they are not used - chkconfig is off) and the time is advancing again after reboot.
I've looked into other bugs for initscripts and the changelog and it appears that there is a change in the invocation of the hwclock in udev rules between F11 and F12 from:
hwclock --hctosys
hwclock --systz

this is the diff between 88-clock.rules for F11 (8.95) and F12 (9.02):

--- /lib/udev/rules.d/88-clock.rules-F11    2009-05-01 23:35:11.000000000 +0300
+++ /lib/udev/rules.d/88-clock.rules-F12    2009-10-27 22:11:39.000000000 +0200
@@ -1,2 +1,4 @@
-ACTION=="add", SUBSYSTEM=="rtc", RUN+="/sbin/hwclock --hctosys --rtc=/dev/%k"
-ACTION=="add", ENV{MAJOR}=="10", ENV{MINOR}=="135", RUN+="/sbin/hwclock --hctosys --rtc=/dev/%k"
+ACTION=="add", SUBSYSTEM=="rtc", SYSFS{hctosys}=="1", RUN+="/sbin/hwclock --systz --rtc=/dev/%k"
+ACTION=="add", ENV{MAJOR}=="10", SYSFS{hctosys}=="1", ENV{MINOR}=="135", RUN+="/sbin/hwclock --systz --rtc=/dev/%k"
+ACTION=="add", SUBSYSTEM=="rtc", SYSFS{hctosys}=="0", RUN+="/sbin/hwclock --hctosys --rtc=/dev/%k"
+ACTION=="add", ENV{MAJOR}=="10", SYSFS{hctosys}=="0", ENV{MINOR}=="135", RUN+="/sbin/hwclock --hctosys --rtc=/dev/%k"

I don't understand when the rules are used, but issuing the command
hwclock --systz on my system does this:

# hwclock -r; date; hwclock --systz; hwclock -r; date
Sat 14 Nov 2009 10:16:42 PM EET  -0.157733 seconds
Sat Nov 14 22:16:42 EET 2009
Sat 14 Nov 2009 10:16:43 PM EET  -0.992920 seconds
Sat Nov 14 20:16:43 EET 2009

System time is changed 2 hours back. Maybe it is failing to be executed on my system/kernel?

The other option (after I've set the time with ntpdate):
# hwclock -r;date; hwclock --hctosys;hwclock -r;date
Sat 14 Nov 2009 10:18:09 PM EET  -0.488568 seconds
Sat Nov 14 22:18:09 EET 2009
Sat 14 Nov 2009 10:18:11 PM EET  -0.998102 seconds
Sat Nov 14 22:18:11 EET 2009

no change after --hctosys, which I think is the correct behavior.

Some more info:

# cat /etc/adjtime
0.000000 1258215126 0.000000

# cat /sys/class/rtc/rtc0/uevent
cat: /sys/class/rtc/rtc0/uevent: No such file or directory

# cat /sys/class/misc/rtc/uevent

Comment 1 Bill Nottingham 2009-11-16 18:43:41 UTC
Did you build with CONFIG_RTC_HCTOSYS=y?

Comment 2 Boyan Anastasov 2009-11-16 22:46:09 UTC
No, I don't have this option in my config.
Anyway, I thought I'll report this as it might hit other people with custom kernels. It would be good if old behavior before F12 works too...

Comment 3 Bill Nottingham 2009-11-17 16:19:46 UTC
Does your rtc device have a 'hctosys' file in sysfs?

Comment 4 Bill Nottingham 2009-11-17 16:23:55 UTC
Created attachment 369912 [details]
patch for the udev rules

Never mind - the attached should work for old-style RTC devices. Does it work for you?

Comment 5 Boyan Anastasov 2009-11-17 20:55:58 UTC
I don't have file named 'hctosys' in sysfs.
The attached patch works for me. Thanks!

Comment 6 Bill Nottingham 2009-11-17 21:02:51 UTC
Thanks - the fix is pushed to git, and will go out as an update at some point.


Comment 7 Fedora Update System 2009-12-05 15:23:08 UTC
initscripts-9.02.1-1 has been submitted as an update for Fedora 12.

Comment 8 Fedora Update System 2009-12-07 07:28:47 UTC
initscripts-9.02.1-1 has been pushed to the Fedora 12 testing repository.  If problems still persist, please make note of it in this bug report.
 If you want to test the update, you can install it with 
 su -c 'yum --enablerepo=updates-testing update initscripts'.  You can provide feedback for this update here: http://admin.fedoraproject.org/updates/F12/FEDORA-2009-12797

Comment 9 Fedora Update System 2009-12-22 05:00:36 UTC
initscripts-9.02.1-1 has been pushed to the Fedora 12 stable repository.  If problems still persist, please make note of it in this bug report.

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