Package: cryptsetup
Version: 2:1.0.6~pre1+svn45-1
Severity: important
Tags: patch

The system can't boot from USB device if it is encrypted volume. The
reason is that initramfs cryptroot-script don't wait for USB and tries
immediately to open the nonexistent device.

The attached patch tries to resolve this problem in the same way like
main initramfs' script: it just gives a little more time for
usb-storage driver.

This bug is important for anybody who want to boot up from USB device.

-- 
 .''`.    Piotr Roszatycki
: :' :    mailto:[EMAIL PROTECTED]
`. `'     mailto:[EMAIL PROTECTED]
  `-
diff -ru cryptsetup-1.0.6~pre1+svn45.orig/debian/initramfs/cryptroot-script cryptsetup-1.0.6~pre1+svn45/debian/initramfs/cryptroot-script
--- cryptsetup-1.0.6~pre1+svn45.orig/debian/initramfs/cryptroot-script	2008-02-14 13:26:55.000000000 +0100
+++ cryptsetup-1.0.6~pre1+svn45/debian/initramfs/cryptroot-script	2008-02-14 13:25:23.000000000 +0100
@@ -163,6 +158,37 @@
 		/sbin/udevsettle --timeout=30
 	fi
 
+	# If the crypto device hasn't shown up yet, give it a little while
+	# to deal with removable devices
+	if [ ! -e "$cryptsource" ] || ! /lib/udev/vol_id "$cryptsource" >/dev/null 2>&1; then
+		log_begin_msg "Waiting for 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" ] || ! /lib/udev/vol_id "$cryptsource" >/dev/null 2>&1; 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
 	if [ ! -e $cryptsource ]; then
 		echo "cryptsetup: Source device $cryptsource not found"
 		return 1

Reply via email to