[Bug 947988] Re: fixrtc kernel option always sets system time
Oliver Grawert
ogra at ubuntu.com
Tue Mar 6 13:50:26 UTC 2012
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,
** Changed in: initramfs-tools (Ubuntu)
Importance: Undecided => High
** Changed in: initramfs-tools (Ubuntu)
Status: New => Triaged
** Changed in: initramfs-tools (Ubuntu)
Assignee: (unassigned) => Oliver Grawert (ogra)
** Also affects: initramfs-tools (Ubuntu Precise)
Importance: High
Assignee: Oliver Grawert (ogra)
Status: Triaged
** Changed in: initramfs-tools (Ubuntu Precise)
Milestone: None => ubuntu-12.04-beta-2
--
You received this bug notification because you are a member of Ubuntu
Foundations Bugs, which is subscribed to initramfs-tools in Ubuntu.
https://bugs.launchpad.net/bugs/947988
Title:
fixrtc kernel option always sets system time
Status in “initramfs-tools” package in Ubuntu:
Triaged
Status in “initramfs-tools” source package in Precise:
Triaged
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.
To manage notifications about this bug go to:
https://bugs.launchpad.net/ubuntu/+source/initramfs-tools/+bug/947988/+subscriptions
More information about the foundations-bugs
mailing list