Hello,

While I realize the method for solving the problem hasn't been fully
identified, I just wanted to provide an updated patch for cryptsource
delay that is being used in Ubuntu...

-Kees

-- 
Kees Cook                                            @debian.org
--- cryptsetup-1.0.6+20090405.svn49~/debian/initramfs/cryptroot-script	2009-05-10 16:51:44.000000000 -0700
+++ cryptsetup-1.0.6+20090405.svn49/debian/initramfs/cryptroot-script	2009-05-10 17:00:30.000000000 -0700
@@ -1,5 +1,8 @@
 #!/bin/sh
 
+# source for log_*_msg() functions, see LP: #272301
+. /scripts/functions
+
 #
 # Standard initramfs preamble
 #
@@ -193,12 +196,51 @@
 		activate_evms $cryptsource
 	fi
 
-	udev_settle
+	# If the encrypted source device hasn't shown up yet, give it a
+	# little while to deal with removable devices
 
-	if [ ! -e $cryptsource ]; then
-		message "cryptsetup: source device $cryptsource not found"
-		return 1
+	# the following lines below have been taken from
+	# /usr/share/initramfs-tools/scripts/local, as suggested per
+	# https://launchpad.net/bugs/164044
+	if [ ! -e "$cryptsource" ]
+	then
+		log_begin_msg "Waiting for encrypted source device..."
+
+		# Default delay is 180s
+		if [ -z "${ROOTDELAY}" ]; then
+			slumber=180
+		else
+			slumber=${ROOTDELAY}
+		fi
+		if [ -x /sbin/usplash_write ]; then
+			/sbin/usplash_write "TIMEOUT ${slumber}" || true
+		fi
+
+		slumber=$(( ${slumber} * 10 ))
+		while [ ! -e "$cryptsource" ]
+		do
+			/bin/sleep 0.1
+			slumber=$(( ${slumber} - 1 ))
+			[ ${slumber} -gt 0 ] || break
+		done
+
+		if [ ${slumber} -gt 0 ]; then
+			log_end_msg 0
+		else
+			log_end_msg 1 || true
+		fi
+		if [ -x /sbin/usplash_write ]; then
+			/sbin/usplash_write "TIMEOUT 15" || true
+		fi
 	fi
+	udev_settle
+
+	# We've given up, but we'll let the user fix matters if they can
+	while [ ! -e "${cryptsource}" ]; do
+		echo "	Check cryptopts=source= bootarg cat /proc/cmdline"
+		echo "	or missing modules, devices: cat /proc/modules ls /dev"
+		panic -r "ALERT!  ${cryptsource} does not exist.  Dropping to a shell!"
+	done
 
 	# Prepare commands
 	if /sbin/cryptsetup isLuks $cryptsource > /dev/null 2>&1; then

Reply via email to