mdrun is generating a bad eval statement

Bug #25093 reported by Giles Hall
14
Affects Status Importance Assigned to Milestone
mdadm (Ubuntu)
Fix Released
Medium
Unassigned
Nominated for Dapper by A. Karl Kornel

Bug Description

root@ambry:~# mdrun
/sbin/mdrun: eval: line 104: syntax error near unexpected token `then'
/sbin/mdrun: eval: line 104: `if [ ! -b sda ]; then mknod sda b 8 0; fi ; if [ !
-b sda1 ]; then mknod sda1 b 8 1; fi ; if [ ! -b sda2 ]; then mknod sda2 b 8 2;
fi ; if [ ! -b sda3 ]; then mknod sda3 b 8 3; fi ; if [ ! -b sdb ]; then mknod
sdb b 8 16; fi ; if [ ! -b sdb1 ]; then mknod sdb1 b 8 17; fi ; if [ ! -b sdb2
]; then mknod sdb2 b 8 18; fi ; if [ ! -b sdb3 ]; then mknod sdb3 b 8 19; fi ;
if [ ! -b md0 ]; then mknod md0 b 9 0; fi ; if [ ! -b md1 ]; then mknod md1 b 9
1; fi ; if [ ! -b dm ]; then mknod dm b 253 0; fi ; if [ ! -b dm ]; then mknod
dm b 253 1; fi ; if [ ! -b dm ]; then mknod dm b 253 2; fi ; if [ ! -b dm ];
then mknod dm b 253 3; fi ; if [ ! -b dm ]; then mknod dm b 253 4; fi ; if [ !
-b dm ]; then mknod dm b 253 5; fi ; if [ ! -b dm ]; then mknod dm b 253 6; fi ;
if [ ! -b dm ]; then mknod dm b 253 7; fi ; 8 32 1562583296 sdc 8 33 1562578258
sdc1 8 48 1562583296 sdd 8 49 1562578258 sdd1 8 64 1562583296 sde 8 65
1562578258 sde1 8 80 1562583296 sdf 8 81 1562578258 sdf1 8 96 1562583296 sdg if
[ ! -b sdg1 ]; then mknod sdg1 b 8 97; fi ; if [ ! -b sdg2 ]; then mknod sdg2 b
8 98; fi ; if [ ! -b sdg5 ]; then mknod sdg5 b 8 101; fi ; 8 112 1562583296 sdh'

root@ambry:~# cat /proc/partitions
major minor #blocks name

   8 0 71819496 sda
   8 1 248976 sda1
   8 2 68356575 sda2
   8 3 3213000 sda3
   8 16 71819496 sdb
   8 17 248976 sdb1
   8 18 68356575 sdb2
   8 19 3213000 sdb3
   9 0 248896 md0
   9 1 68356480 md1
 253 0 68354048 dm-0
 253 1 68356575 dm-1
 253 2 68356575 dm-2
 253 3 68354048 dm-3
 253 4 3213000 dm-4
 253 5 3213000 dm-5
 253 6 248976 dm-6
 253 7 248976 dm-7
   8 32 1562583296 sdc
   8 33 1562578258 sdc1
   8 48 1562583296 sdd
   8 49 1562578258 sdd1
   8 64 1562583296 sde
   8 65 1562578258 sde1
   8 80 1562583296 sdf
   8 81 1562578258 sdf1
   8 96 1562583296 sdg
   8 97 97659103 sdg1
   8 98 1 sdg2
   8 101 9767488 sdg5
   8 112 1562583296 sdh

on my machine, everything above /dev/sd[ab] is from a fibre channel.
/dev/sd[ab] make up the system mirrors. when the fibre channel disks are
plugged in, mdrun on the initrd fails and the system won't boot correctly. if
the fibre channel disks are removed, and added after boot, the system boots
fine. /sbin/mdrun fails in the same way that the initrd version of mdrun fails.

Jesper Krogh (jesper)
Changed in mdadm:
status: Unconfirmed → Confirmed
Revision history for this message
Jesper Krogh (jesper) wrote :

This patch solves it.. I really cant figure out how to attach a file to the bug, so it comes inline. It handles large blockdevices wrong due to the regex expects 2 (or more) blancks between minor and blockcount and with big devices there are only one.

--- mdrun 2006-01-15 11:04:51.000000000 +0100
+++ /sbin/mdrun 2005-06-08 04:17:15.000000000 +0200
@@ -95,7 +95,7 @@

 DEVDIRESC=$(echo $DEVDIR | sed -e 's!/!\\/!g')
 if [ "$AUTOCREATE" ] ; then
- CREATECMD=$(sed -e "s/.*major.*//; s/.*\ \([:0-9:]\+\)\ \+\ \([:0-9:]\+\)\ \+[:0-9:]\+\ \+\([:a-z0-9\/:]\+\).*/if [ ! -b \3 ]; then mknod \3 b \1 \2; fi ; / ; s/\//_/g" < /proc/partitions)
+ CREATECMD=$(sed -e "s/.*major.*//; s/.*\ \([:0-9:]\+\)\ \+\ \([:0-9:]\+\)\ \+\ [:0-9:]\+\ \+\([:a-z0-9\/:]\+\).*/if [ ! -b \3 ]; then mknod \3 b \1 \2; fi ; / ; s/\//_/g" < /proc/partitions)
    export CREATECMD
    export DEVDIR
    # and we need array nodes, of course

Revision history for this message
Scott James Remnant (Canonical) (canonical-scott) wrote :

This patch appears to have been applied.

Changed in mdadm:
status: Confirmed → Fix Released
Revision history for this message
A. Karl Kornel (akkornel) wrote : Applying fix to Dapper?

It appears, from bug 57972, that this bug also affects Dapper. I was preparing to set up a server where several 500GB disks are made into a 2TB RAID array, so I'm guessing that this is going to affect me. I'm using Dapper for the longer-term support. Is it possible to get this fix applied to Dapper?

To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Duplicates of this bug

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.