[SCM] debian-live/live-initramfs branch, master, updated. 1.125.1-1-7-g39f6aa4

Chris Lamb chris at chris-lamb.co.uk
Wed Mar 26 08:57:08 UTC 2008


The following commit has been merged in the master branch:
commit 39f6aa4ef72265e56e016142db80ca4a8bd11a8a
Author: Chris Lamb <chris at chris-lamb.co.uk>
Date:   Wed Mar 26 08:19:59 2008 +0000

    hooks/live, scripts/live: Add USB modules, workaround udevtrigger (?) bug
    
    This patch goes some way towards fixing USB-backed persistence by
    configuring the live initramfs to contain the "sd_mod" module and adding
    a hacky workaround to a udev-related race condition.
    
    For some reason, the usual udevtrigger/udevsettle pairing does not block
    after we have loaded our USB modules and /dev/sda1 (for example) is ready.
    Because of this, we sleep for a little while and break if a new block
    device appears.
    
    This seems to be a bug either in udev or in my understanding of how the
    tool is meant to work. Some information may be gained from the casper bug:
    
      https://bugs.launchpad.net/ubuntu/+source/casper/+bug/84591
    
    Sleep-based hacks like this are really ugly, but I take some comfort in
    finding them elsewhere in the source.

diff --git a/hooks/live b/hooks/live
index ca2a761..a4aced3 100755
--- a/hooks/live
+++ b/hooks/live
@@ -101,6 +101,9 @@ manual_add_modules ohci1394
 manual_add_modules sbp2
 manual_add_modules sr_mod
 
+# Hardware: usb
+manual_add_modules sd_mod
+
 # Hardware: network
 auto_add_modules net
 
diff --git a/scripts/live b/scripts/live
index 7632fc8..797f5df 100755
--- a/scripts/live
+++ b/scripts/live
@@ -994,6 +994,30 @@ setup_unionfs ()
 	# Looking for "${root_persistence}" device or file
 	if [ -n "${PERSISTENT}" ] && [ -z "${NOPERSISTENT}" ]
 	then
+		# Load USB modules
+		num_block=$(ls -l /sys/block | wc -l)
+		for module in sd_mod uhci-hcd ehci-hcd ohci-hcd usb-storage
+		do
+			modprobe -q -b ${module}
+		done
+
+		udevtrigger
+		udevsettle
+
+		# For some reason, udevsettle does not block in this scenario,
+		# so we sleep for a little while.
+		#
+		# See https://bugs.launchpad.net/ubuntu/+source/casper/+bug/84591
+		for timeout in 5 4 3 2 1
+		do
+			sleep 1
+
+			if [ $(ls -l /sys/block | wc -l) -gt ${num_block} ]
+			then
+				break
+			fi
+		done
+
 		cowprobe=$(find_cow_device "${root_persistence}")
 
 		if [ -b "${cowprobe}" ]

-- 
debian-live/live-initramfs



More information about the debian-live-changes mailing list