Public bug reported:

Binary package hint: cryptsetup

This bug is *not* a duplicate of bug #85460

cryptsetup fails for encrypted rootfs on a device that is slow to come
up (i.e. an external USB HD).  The "udevsettle" solution proposed in bug
#85460 does not help.

I have patched /usr/share/initramfs-tools/scripts/local-top/cryptroot by
integrating into it the same kind of "waiting loop" that already exists
for a non-encrypted rootfs, in /usr/share/initramfs-tools/scripts/local
.

This patch to /usr/share/initramfs-tools/scripts/local-top/cryptroot
solves the issue and perfectly does the trick. Please consider
integrating this fix.


--- /old/cryptroot      2007-10-11 22:39:56.000000000 +0200
+++ cryptroot   2007-11-20 12:21:25.000000000 +0100
@@ -25,6 +25,9 @@
 #
 # Helper functions
 #
+
+. /scripts/functions
+
 parse_options()
 {
        local cryptopts
@@ -158,11 +161,45 @@
                /sbin/udevsettle --timeout=30
        fi
 
-       if [ ! -e $cryptsource ]; then
-               echo "cryptsetup: Source device $cryptsource not found"
-               return 1
+       # If the encrypted source 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 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" ] || ! /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
 
+       # 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 "ALERT!  $cryptsource does not exist.  Dropping to a 
shell!"
+       done
+
        # Prepare commands
        if /sbin/cryptsetup isLuks $cryptsource > /dev/null 2>&1; then
                cryptcreate="/sbin/cryptsetup luksOpen $cryptsource 
$crypttarget"

** Affects: cryptsetup (Ubuntu)
     Importance: Undecided
         Status: New

-- 
Gutsy: cryptsetup fails for encrypted rootfs on slow devices (USB)
https://bugs.launchpad.net/bugs/164044
You received this bug notification because you are a member of Ubuntu
Bugs, which is the bug contact for Ubuntu.

-- 
ubuntu-bugs mailing list
[email protected]
https://lists.ubuntu.com/mailman/listinfo/ubuntu-bugs

Reply via email to