Package: initscripts
Version: 2.86.ds1-61
Severity: normal
Tags: patch

Hi,

I've a system where fsck fails at boot because swap
is on lvm and fsck runs out of RAM.  Consequently,
after an fs fsck limit is reached the system won't boot.

Please have checkfs.sh run swapon again before fsck to pick up
lvm (and md?) swap.

A 100% untested patch (against sid as of this date) is attached.

To apply:
  cd sysvinit-2.87
  patch < fsck.patch

Thank you.

-- System Information:
Debian Release: 5.0.3
  APT prefers stable
  APT policy: (500, 'stable')
Architecture: i386 (i686)

Kernel: Linux 2.6.26-2-686 (SMP w/2 CPU cores)
Locale: LANG=en_US.UTF-8, LC_CTYPE=en_US.UTF-8 (charmap=UTF-8)
Shell: /bin/sh linked to /bin/bash

Versions of packages initscripts depends on:
ii  debianutils                  2.30        Miscellaneous utilities specific t
ii  e2fsprogs                    1.41.3-1    ext2/ext3/ext4 file system utiliti
ii  libc6                        2.7-18      GNU C Library: Shared libraries
ii  lsb-base                     3.2-20      Linux Standard Base 3.2 init scrip
ii  mount                        2.13.1.1-1  Tools for mounting and manipulatin
ii  sysvinit-utils               2.86.ds1-61 System-V-like utilities

Versions of packages initscripts recommends:
ii  psmisc                        22.6-1     Utilities that use the proc filesy

initscripts suggests no packages.

-- no debconf information
diff --exclude '*~' -ruN debian/src/initscripts/etc/init.d/checkfs.sh debian.patched/src/initscripts/etc/init.d/checkfs.sh
--- debian/src/initscripts/etc/init.d/checkfs.sh	2009-10-22 13:00:56.000000000 -0500
+++ debian.patched/src/initscripts/etc/init.d/checkfs.sh	2009-10-22 14:08:06.000000000 -0500
@@ -20,6 +20,7 @@
 . /lib/lsb/init-functions
 . /lib/init/splash-functions-base
 . /lib/init/usplash-fsck-functions.sh
+. /lib/init/swap-functions.sh
 
 do_start () {
 	# See if we're on AC Power.  If not, we're not gonna run our
@@ -51,6 +52,11 @@
 	#
 	if [ "$fscheck" = yes ] && [ ! "$BAT" ] && [ "$FSCKTYPES" != "none" ]
 	then
+
+		# Execute swapon command again, in case there are lvm
+		# or md swap partitions.  fsck can suck RAM.
+		swapon-again 'lvm and md'
+
 		if [ -f /forcefsck ] || grep -s -w -i "forcefsck" /proc/cmdline
 		then
 			force="-f"
diff --exclude '*~' -ruN debian/src/initscripts/etc/init.d/mountall.sh debian.patched/src/initscripts/etc/init.d/mountall.sh
--- debian/src/initscripts/etc/init.d/mountall.sh	2009-10-22 13:00:56.000000000 -0500
+++ debian.patched/src/initscripts/etc/init.d/mountall.sh	2009-10-22 14:04:29.000000000 -0500
@@ -14,6 +14,7 @@
 
 . /lib/lsb/init-functions
 . /lib/init/mount-functions.sh
+. /lib/init/swap-functions.sh
 
 # for ntfs-3g to get correct file name encoding
 if [ -r /etc/default/locale ]; then
@@ -62,27 +63,9 @@
 	fi
 	kill -USR1 1
 
-	#
 	# Execute swapon command again, in case we want to swap to
 	# a file on a now mounted filesystem.
-	#
-	# Ignore 255 status due to swap already being enabled
-	#
-	if [ "$NOSWAP" = yes ]
-	then
-		[ "$VERBOSE" = no ] || log_warning_msg "Not activating swap as requested via bootoption noswap."
-	else
-		if [ "$VERBOSE" = no ]
-		then
-			log_action_begin_msg "Activating swapfile swap"
-			swapon -a -e 2>/dev/null || :  # Stifle "Device or resource busy"
-			log_action_end_msg 0
-		else
-			log_daemon_msg "Will now activate swapfile swap"
-			swapon -a -e -v
-			log_action_end_msg $?
-		fi
-	fi
+	swapon-again 'swapfile'
 }
 
 case "$1" in
diff --exclude '*~' -ruN debian/src/initscripts/lib/init/swap-functions.sh debian.patched/src/initscripts/lib/init/swap-functions.sh
--- debian/src/initscripts/lib/init/swap-functions.sh	1969-12-31 18:00:00.000000000 -0600
+++ debian.patched/src/initscripts/lib/init/swap-functions.sh	2009-10-22 14:01:46.000000000 -0500
@@ -0,0 +1,28 @@
+#
+# Functions that assist in turning on swap.
+#
+
+# $1 is a string used to log the type of swap expected to be activated
+swapon-again() {
+	#
+	# Execute swapon command again to pick up any swap partitions
+	# that have shown up since the last swapon.
+	#
+	# Ignore 255 status due to swap already being enabled
+	#
+	if [ "$NOSWAP" = yes ]
+	then
+		[ "$VERBOSE" = no ] || log_warning_msg "Not activating swap as requested via bootoption noswap."
+	else
+		if [ "$VERBOSE" = no ]
+		then
+			log_action_begin_msg "Activating $1 swap"
+			swapon -a -e 2>/dev/null || :  # Stifle "Device or resource busy"
+			log_action_end_msg 0
+		else
+			log_daemon_msg "Will now activate $1 swap"
+			swapon -a -e -v
+			log_action_end_msg $?
+		fi
+	fi
+}

Reply via email to