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.

Cheers,

-- 
Agustin
--- cryptroot.orig	2009-10-19 13:55:35.000000000 +0200
+++ cryptroot	2009-11-16 15:53:51.000000000 +0100
@@ -316,7 +316,7 @@
 				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
@@ -344,18 +344,29 @@
 #
 
 # Do we have any kernel boot arguments?
-found=''
+cmdline_cryptopts=''
+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=*)
+	        cmdline_root="${opt#root=}"
+	        ;;
 	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?

Reply via email to