[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

[PATCH initramfs-tools 02/10] hooks/fsck: Remove dependency on hwclock by disabling e2fsck time check



I was not very happy with putting the time zone configuration in the
initramfs, and after discussing this with other developers at LPC I
learned that we don't need to:

- e2fsck is the only fsck that compares the system and superblock times
- Other distributions have avoided this problem by disabling the
  comparison by default
- e2fsck supports a configuration file that can be used to disable it

So create the necessary e2fsck.conf file in the initramfs instead of
installing hwclock and its configuration.

Signed-off-by: Ben Hutchings <ben@decadent.org.uk>
---
 debian/control |  2 +-
 hooks/fsck     | 20 ++++++++------------
 2 files changed, 9 insertions(+), 13 deletions(-)

diff --git a/debian/control b/debian/control
index c31cb77..3bb7847 100644
--- a/debian/control
+++ b/debian/control
@@ -12,7 +12,7 @@ Package: initramfs-tools
 Architecture: all
 Multi-Arch: foreign
 Recommends: busybox (>= 1:1.01-3) | busybox-initramfs | busybox-static
-Depends: klibc-utils (>= 2.0-1~), cpio, kmod | module-init-tools, udev, ${misc:Depends}, util-linux (>= 2.20.1-5.11~), klibc-utils (>= 2.0.4-1.2~) | busybox (>= 1:1.01-3) | busybox-initramfs | busybox-static
+Depends: klibc-utils (>= 2.0-1~), cpio, kmod | module-init-tools, udev, ${misc:Depends}, klibc-utils (>= 2.0.4-1.2~) | busybox (>= 1:1.01-3) | busybox-initramfs | busybox-static
 Suggests: bash-completion
 Provides: linux-initramfs-tool
 Conflicts: linux-initramfs-tool, usplash (<< 0.5.50)
diff --git a/hooks/fsck b/hooks/fsck
index cc860b5..dfa0710 100755
--- a/hooks/fsck
+++ b/hooks/fsck
@@ -95,18 +95,14 @@ copy_exec /sbin/fsck
 copy_exec /sbin/logsave
 copy_exec /sbin/sulogin
 
-# fsck may spuriously fail or warn if the system time is not yet correct
-if [ -x /lib/udev/hwclock-set ]; then
-	copy_exec /lib/udev/hwclock-set
-	copy_exec /sbin/hwclock
-	for f in /etc/adjtime /etc/default/hwclock /etc/default/rcS \
-	         /etc/localtime /etc/udev/rules.d/*-hwclock.rules \
-		 /lib/udev/rules.d/*-hwclock.rules; do
-		if [ -f "$f" ]; then
-			copy_exec "$f"
-		fi
-	done
-fi
+# e2fsck may fail or warn if the system time is not yet correct, which
+# will happen if the RTC driver is modular or the RTC is set to local
+# time.  Disable this behaviour.  (No other fsck does this, apparently.)
+mkdir -p "${DESTDIR}/etc"
+cat >"${DESTDIR}/etc/e2fsck.conf" <<EOF
+[options]
+broken_system_clock=1
+EOF
 
 for type in $(get_fstypes | sort | uniq); do
 	if [ "$type" = 'auto' ] ; then


-- 
Ben Hutchings
Anthony's Law of Force: Don't force it, get a larger hammer.

Attachment: signature.asc
Description: This is a digitally signed message part


Reply to: