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

Bug#498784: mdcfg hangs when there is no partition for spare device



tags 498784 + patch
thanks

On Sat, Sep 13, 2008 at 11:44:26AM +0300, Martin Michlmayr wrote:
> Package: mdcfg
> Version: 1.27
> Severity: serious
> 
> I chose 1 partition (sda2) for RAID in partman and entered the RAID
> config tool.  I then chose RAID1 with 1 active partition and 1 spare
> partition.  I got a prompt asking which partition to use for the
> active one and chose sda2.  Then mdcfg hangs.  Looking at the code, it
> does (lines 329-331):
> 

Attached is a (trivial, and of course tested) patch that fixes this.

> db_subst mdcfg/raidsparedevs PARTITIONS "$PARTITIONS"
> db_input critical mdcfg/raidsparedevs
> db_go
> 
> $PARTITIONS is empty in my case and apparently debconf doesn't like an
> empty variable for Choices and hangs.
> 

It looks like previously debconf allowed that, and just didn't show
the menu. I tested with the etch installer (with some added debug
statements), and that was how it behaved.

> There is a check whethere there are enough partitions available but
> this is not run if the RAID level is 1:
> 
> REQUIRED=$(($DEV_COUNT + $SPARE_COUNT))
> if [ $LEVEL -ne 1 ]; then
>     if [ $REQUIRED -gt $NUM_PART ]; then
>         db_subst mdcfg/notenoughparts NUM_PART "$NUM_PART"
> 
> Any idea why this check is not run for RAID level 1?

This is because mdcfg allows "degraded" RAID 1 arrays (arrays that
don't have all of the devices that you say the array should have). It
will add missing spares at line 373 (even though missing spares don't
make much sense).

> -- 
> Martin Michlmayr
> http://www.cyrius.com/
> 
> 
> 

Thanks,
Ryan52

-- 
_________________________
Ryan Niebur
RyanRyan52@gmail.com
diff --git a/packages/mdcfg/debian/changelog b/packages/mdcfg/debian/changelog
index cace827..3df4808 100644
--- a/packages/mdcfg/debian/changelog
+++ b/packages/mdcfg/debian/changelog
@@ -1,3 +1,10 @@
+mdcfg (1.28) UNRELEASED; urgency=low
+
+  * Don't give debconf an empty list of partitions, that makes it hang.
+    (Closes: #498784)
+
+ -- Ryan Niebur <ryanryan52@gmail.com>  Sat, 13 Sep 2008 22:33:48 -0700
+
 mdcfg (1.27+nmu1) unstable; urgency=low
 
   [ Updated translations ]
diff --git a/packages/mdcfg/mdcfg.sh b/packages/mdcfg/mdcfg.sh
index 0e0fee9..da7527a 100755
--- a/packages/mdcfg/mdcfg.sh
+++ b/packages/mdcfg/mdcfg.sh
@@ -319,7 +319,7 @@ md_create_array(){
 
 	db_set mdcfg/raidsparedevs ""
 	SELECTED=0
-	if [ $SPARE_COUNT -gt 0 ]; then
+	if [ $SPARE_COUNT -gt 0 ] && [ -n "$PARTITIONS" ]; then
 		FIRST=1
 		# Loop until the correct number of devices has been selected.
 		# That means any number less than or equal to the spare count.

Attachment: signature.asc
Description: Digital signature


Reply to: