Comment 7 for bug 139057

Revision history for this message
Florent (florent.x) wrote :

I have the same issue with Jaunty.
Here is the script to try same password for next device.

You can patch the file in place, or copy the file to "/etc/initramfs-tools/scripts/local-top/" before to patch it: it will override the file in "/usr/share".
Then run "sudo update-initramfs -u".

--- /usr/share/initramfs-tools/scripts/local-top/cryptroot 2009-03-08 06:48:33.000000000 +0100
+++ /etc/initramfs-tools/scripts/local-top/cryptroot 2009-03-23 08:43:11.780028000 +0100
@@ -270,9 +270,18 @@
                        cryptkey="Unlocking the disk $cryptsource ($crypttarget)\nEnter passphrase: "
                fi

+ if [ -n "$PASS" ]; then
+ # Try to unlock with previous password
+ message "Unlocking the disk $cryptsource ($crypttarget) using the same password"
+ else
+ # Ask for password
+ PASS=$(crypttarget="$crypttarget" cryptsource="$cryptsource" \
+ $cryptkeyscript "$cryptkey")
+ fi

- if ! crypttarget="$crypttarget" cryptsource="$cryptsource" \
- $cryptkeyscript "$cryptkey" | $cryptcreate --key-file=- ; then
+ if ! echo -n "$PASS" | $cryptcreate --key-file=- ; then
+ # Clear the wrong password
+ unset PASS
                        message "cryptsetup: cryptsetup failed, bad password or options?"
                        continue
                fi