I honestly cannot understand how you can open the LUKS partition in rescue mode, but the init script fails for you, as I said the init script is very simple.
Let's summarize what we know:
a) Wrong keymap = No
b) Wrong Passphrase = No
c) Lack of kernel built-in support for tmpfs, sysfs = No
d) Lack of kernel built-in support for device-mapper, dm-crypt = No *
e) Lack of kernel built-in support for ciphers = No
f) Lack of Busybox mdev support = No
*
Code: Select all
> zcat /proc/config.gz | grep CONFIG_BLK_DEV_DM
# outputs
CONFIG_BLK_DEV_DM=y # must be built-in, no module
>zcat /proc/config.gz | grep CONFIG_DM_CRYPT
# outputs
CONFIG_DM_CRYPT=y
If all the above is ok, then what on earth could be causing init to fail.. ?
You do have "cut" support built in busybox, right ?
I'd really like to know why it fails there, so, can you replace the init from you initramfs image with this one and recompile your kernel(no need to change your grub.conf, just make sure root= argument has the proper value) ?
Code: Select all
#!/bin/sh
export PATH=/sbin:/bin
dmesg -n 1
/bin/mount -t proc proc /proc
/bin/mount -t sysfs sysfs /sys
CMDLINE=`cat /proc/cmdline`
# Populate /dev from /sys
/bin/mount -t tmpfs tmpfs /dev
/sbin/mdev -s
for param in $CMDLINE; do
case "$param" in
loadkmap=*) loadkeymap="`echo $param | cut -d= -f2`";;
loadfont=*) font="`echo $param | cut -d= -f2`";;
rescue) echo "Rescue Mode -- Dropping you into a minimal shell..";
exec /bin/sh;;
gpg=*) # the user has the keys on a gpg encrypted file
use_gpg="`echo $param | cut -d= -f2`";;
root=*) # get root and fs type
root_dev="`echo $param | cut -d= -f2 | cut -d: -f1`";
fs_type="`echo $param | cut -d: -f2`";
;;
esac
done
echo "Root variables.."
echo "root_dev = " $root_dev
echo "fs_type = " $fs_type
echo "Executing cryptsetup..."
cryptsetup luksOpen $root_dev root
echo "Dropping you into a minimal shell.."
exec /bin/sh
First check that the root variables have the proper values, in your case it should output this:
Code: Select all
root_dev = /dev/sda2
fs_type = ext3
If the above values are ok, then executing cryptsetup to open your LUKS partition should work, if it doesn't, then check that you have /dev/sda2 and /dev/mapper/control, if you have built busybox with "ls" support you can use that, if not, either rebuild your busybox with ls support or try executing those files just to see if they are there or not.
Some answers to your questions,
proc, sys, and tmpfs were already mounted when I dropped to sh in rescue mode. /sbin/mdev -s executed but produced no output or anything, just dropped me back to a prompt (not sure what it's supposed to do).
Yes, they're already mounted, and /dev is populated because the same commands get executed before it drops you into the minimal shell.
mdev is mini udev for busybox, it's used to populate /dev from /sys
I did not create the /dev/mapper/control or /dev/mapper/root nodes at the end of the howto as you stated it was optional and they should be created at startup anyway...perhaps this is part of the problem? I would tend to think it isn't, since like I said I can manually use cryptsetup to open /dev/sda2 and map it to /dev/mapper/root...
What I meant there is for your root partition not the initramfs.
You don't need to create them for your initramfs image, that's mdev job.
a note here, I am using AES and not blowfish
Blowfish was only used to encrypt swap for installation, the guide uses the serpent cipher as a default for encrypting partitions.
Let me know how it went,
Bye
PS: I'm going to compile the exact kernel version you have and rebuild the initramfs from scratch later to check once again that everything works here.