On Mon, Nov 16, 2009 at 04:26:31PM +0100, Agustin Martin wrote: > On Fri, Sep 25, 2009 at 04:31:27PM +0200, Agustin Martin wrote: > > On Thu, Sep 24, 2009 at 09:29:58PM +0200, Jonas Meurer wrote: > > > first, thanks for the bugreport. the reason for change of bahaviour is a > > > line in /usr/share/initramfs/scripts/local-top/cryptroot that sets $ROOT > > > to $NEWROOT in /conf/params.conf in the initramfs: > > > > > > 302: if [ "$cryptrootdev" = "yes" ]; then > > > 303: # required for lilo to find the root > > > device > > > 304: echo "ROOT=$NEWROOT" >> /conf/param.conf > > > 305: fi > > > > > > commenting out these lines and regenerating the initramfs > > > (update-initramfs -u) afterwards should fix it. could you verify that? > > > > Working well with that change. Thanks for debugging. > > > > > unfortunately these lines are required in order to support setups with > > > cryptroot on lvm and lilo as bootloader. thus i don't know what to do > > > about that bug yet. will have to do further investigation and testing > > > with lilo as bootloader first. > > > > I have been playing with attached patch. However, I have just noticed that > > it does not play nicely with more than one cryptopts= entry in cmdline. > > Since I am not familiar with the code, I cannot discard other drawbacks. > > Played a bit more with this. See attached patch. It is only tested in my > box, and not extensively (that is, fully untested under lilo+lvm), but it > may be useful.
I noticed a typo with the patch that will add extra comma (checks for cmdline_cryptopts, not for $cmdline_cryptopts) but, besides of that I have been used mentioned patch for a while and seems to have worked well in my grub-booted box. I recently bought a netbook and thought it was time to play with lilo and see how it behaves when lilo is used as boot loader. And it fails, not finding root partition. The problem is as follows: lilo passes root argument to command line in major/minor codes form (e.g., root=fd01), which current script cannot parse and associate to a real device. Furthermore, these major/minor numbers may sometimes change (See #398957) breaking things more. More details about this problem in http://bugs.debian.org/398957 I have been thinking about how to modify my previous changes to work around this problem for simple lilo-booted systems using crypto. This change implements a check in root argument. If it seems to contain an absolute path (starts by '/'), is passed to the script for further processing. Otherwise is ignored. People wanting lilo to really use full path mechanism for root should pass it by means of the append option, that is, in /etc/lilo.conf, instead of root=/dev/mapper/vg-root use append="root=/dev/mapper/vg-root" so full absolute path is preserved. Patch with my current changes is attached. Seems to work in a basic lilo-booted box and in my usual grub-booted box. Not tested in syslinux. Cheers, -- Agustin
diff --git a/debian/initramfs/cryptroot-script b/debian/initramfs/cryptroot-script index f83e52e..9de28a4 100644 --- a/debian/initramfs/cryptroot-script +++ b/debian/initramfs/cryptroot-script @@ -326,7 +326,7 @@ setup_mapping() return 1 fi - NEWROOT="/dev/mapper/$cryptlvm" + NEWROOT=${cmdline_root=/dev/mapper/$cryptlvm} if [ "$cryptrootdev" = "yes" ]; then # required for lilo to find the root device echo "ROOT=$NEWROOT" >> /conf/param.conf @@ -354,18 +354,35 @@ setup_mapping() # # Do we have any kernel boot arguments? -found='' +cmdline_cryptopts='' +unset cmdline_root for opt in $(cat /proc/cmdline); do case $opt in cryptopts=*) - found=yes - setup_mapping "${opt#cryptopts=}" + opt="${opt#cryptopts=}" + if [ -n "$opt" ]; then + if [ -n "$cmdline_cryptopts" ]; then + cmdline_cryptopts="$cmdline_cryptopts,$opt" + else + cmdline_cryptopts="$opt" + fi + fi ;; + root=*) + opt="${opt#root=}" + case $opt in + /*) # Absolute path given. Not lilo major/minor number. + cmdline_root=$opt + ;; + *) # lilo major/minor number (See #398957). Ignore + esac + ;; esac done -if [ -n "$found" ]; then - exit 0 +if [ -n "$cmdline_cryptopts" ]; then + setup_mapping "$cmdline_cryptopts" + exit 0 fi # Do we have any settings from the /conf/conf.d/cryptroot file?