fixrtc kernel option always sets system time
Bug #947988 reported by
Svein Seldal
This bug affects 1 person
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
initramfs-tools (Ubuntu) |
Fix Released
|
High
|
Oliver Grawert | ||
Precise |
Fix Released
|
High
|
Oliver Grawert |
Bug Description
On Natty armel, the kernel option 'fixrtc' exists to set the system time from the last mount time from the rootfs. This allows systems which does not have a valid RTC time at startup to be able to boot of the root file system.
When the 'fixrtc' option is used, the system time is set to the last mount time, regardless if the system time is already set to something valid. There should be a comparison between the current system time and the last mount time. The fixrtc should only come into play if the system time is less than the last mount time of the fs.
tags: | added: patch |
To post a comment you must log in.
could you try this patch (regenerate your initrd after applying it to /usr/share/ initramfs- tools/scripts/ local-premount/ fixrtc) :
--- /usr/share/ initramfs- tools/scripts/ local-premount/ fixrtc 2010-04-26 16:59:13.000000000 +0200
+++ fixrtc 2012-03-06 14:47:49.580000000 +0100
@@ -50,12 +50,19 @@
done
if [ -n "$BROKEN_CLOCK" -a -n "$ROOTDEV" ];then
- ROOTDISK=$(readlink -f "$ROOTDEV") &&
+ ROOTDISK=$(readlink -f "$ROOTDEV")
- TIMESTR=$(dumpe2fs -h "$ROOTDISK" 2>/dev/null|grep "Last mount time") &&
- TIME=${TIMESTR#*:} &&
+ TIMESTR=$(dumpe2fs -h "$ROOTDISK" 2>/dev/null|grep "Last mount time")
+ TIME=${TIMESTR#*:}
- date --set="${TIME} 1 minute" >/dev/null 2>&1
+ hwclock -s
+
+ MOUNTTIME=$(date --utc --date "${TIME}" +%s)
+ CURDATE=$(date --utc --date "$(date)" +%s)
+
+ if [ "$MOUNTTIME" -gt "$CURDATE" ]; then
+ date --set="${TIME} 1 minute" >/dev/null 2>&1
+ fi
fi
# This script is best-effort. If we couldn't fudge the clock as desired,