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

Bug#496713: initrd: cryptroot fails if the encrypted root is on usb-device



Package: kernel
Version: lenny

The initrd - boot-skript

/scripts/local-top/cryptroot

fails, if the luks-encrypted root-filesystem is on an usb-device like an
usb-key or an external harddisk.

This happens, because the kernel-modules for usb are completely loaded
(so the bootscripts will continue) but the drivers need some additional
time to register such removable devices, which often are not up, when
the cryptroot-script is searching for them.

So you get the error message "cryptsetup: Source device /dev/sdaX not
found" and the mountroot() will not find the devicemapper to mount the
root-filesystem ...

The following code (based on the solution for the same problems with
not encrypted usb-devices in the function mountroot() in /scripts/local)
added to /scripts/local-top/cryptroot in front of the lines
"
        if [ ! -e $cryptsource ]; then
		echo "cryptsetup: Source device $cryptsource not found"
		return 1
	fi
"

solves the problem:


	# If the cryptsource not up yet, give it a little while
	# to deal with removable devices
	if [ ! -e $cryptsource ] ; then
		echo "Waiting for root file system ..."

		# Default delay is 180s
		if [ -z "${ROOTDELAY}" ]; then
			slumber=180
		else
			slumber=${ROOTDELAY}
		fi

		slumber=$(( ${slumber} * 10 ))
		while [ ! -e $cryptsource ]; do
			/bin/sleep 0.1
			slumber=$(( ${slumber} - 1 ))
			[ ${slumber} -gt 0 ] || break
		done

	fi



Reply to: