[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Bug#291362: installation-reports: LVM install failed due to missing dmsetup



Wesley W. Terpstra wrote:
> On Thu, Jan 20, 2005 at 02:59:00PM -0500, Joey Hess wrote:
> > initrd-tools 0.1.76 changed to abort on install to LVM if dmsetup was
> > not installed. I think this was a mistake. I'm ccing tbm, who made the
> > change.
> 
> I made the change.

Right, tbm only committed it.

> > This was apparently added as part of a patch to support encrypted root
> > filesystems, which is not supported by d-i at all; silently adding a
> > requirement that dmsetup be installed for lvm systems when previously it
> > was not needed is not a good thing to have done.
> 
> Why is the d-i seeing the new initrd-tools at all?
> I thought base was frozen?

a) People can install unstable using d-i and we want this to keep working.
b) We had to let the new initrd-tools into testing because it fixed
   other RC bugs.

> > It seems to me that the above code could easily be rewritten to skip
> > calling dmsetup if it was not installed, and run the lvm function. This
> > might be a little less robust on systems that do use encrypted root
> > filesystems, but at least it wouldn't require us to make last-minute changes
> > to d-i and debian-cd to add dmsetup everywhere.
> 
> At any rate, I agree with your solution, if there is no dmsetup it makes
> sense to fall back to using lvm. Since cryptsetup depends on dmsetup, there
> is nothing wrong with this solution.

Great, so something like this? (Untested)

--- mkinitrd.orig	2005-01-20 16:15:03.000000000 -0500
+++ mkinitrd	2005-01-20 16:16:43.000000000 -0500
@@ -390,20 +390,19 @@
 dm() {
 	local dmname
 	
-	if ! command -v dmsetup > /dev/null 2>&1; then
-		echo Root is on a DM device, but dmsetup not installed >&2
-		exit 1
-	fi
+	if command -v dmsetup > /dev/null 2>&1; then
+		dmdev=$(printf "(%d, %d)" $major $minor)
 	
-	dmdev=$(printf "(%d, %d)" $major $minor)
-	
-	if ! dmsetup ls | grep -q "$dmdev\$"; then
-		echo Unknown DM device $major:$minor >&2
-		exit 1
+		if ! dmsetup ls | grep -q "$dmdev\$"; then
+			echo Unknown DM device $major:$minor >&2
+			exit 1
+		fi
+		
+		dmname=$(dmsetup ls | grep "$dmdev\$" | sed 's/^\([^[:space:]]*\).*$/\1/')
 	fi
 	
-	dmname=$(dmsetup ls | grep "$dmdev\$" | sed 's/^\([^[:space:]]*\).*$/\1/')
-	if dmsetup table $dmname | cut -d" " -f3 | grep -q ^crypt$ ; then
+	if [ -n "$dmname" ] && \
+	   dmsetup table $dmname | cut -d" " -f3 | grep -q ^crypt$ ; then
 		dmcrypt
 	elif command -v lvmiopversion > /dev/null 2>&1; then
 		lvm

-- 
see shy jo

Attachment: signature.asc
Description: Digital signature


Reply to: