Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 9322 - init.d checkfs and halt.sh scripts RAID problem
Summary: init.d checkfs and halt.sh scripts RAID problem
Status: RESOLVED FIXED
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: [OLD] Core system (show other bugs)
Hardware: All Linux
: High normal
Assignee: Martin Schlemmer (RETIRED)
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2002-10-18 17:35 UTC by Quinn Harris
Modified: 2003-02-07 13:09 UTC (History)
2 users (show)

See Also:
Package list:
Runtime testing required: ---


Attachments
halt.sh patch (halt.sh.patch,790 bytes, patch)
2002-10-18 17:37 UTC, Quinn Harris
Details | Diff
checkfs patch (checkfs.patch,964 bytes, patch)
2002-10-18 17:37 UTC, Quinn Harris
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Quinn Harris 2002-10-18 17:35:27 UTC
If the compatibility options for devfs are disabled, multidisk devices will only
be availible as /dev/md/[num] instead of /dev/md[num].  This will break the
checkfs and halt.sh scripts

The following is a patch to these files agains rc-scripts-1.4.1 that should make
them work in this circumstance and hopefully will not break them for anyone else.

The patch also ensures that a commented parts of raidtab will be ignored.

If a raid device is started that doesn't apear in the raidtab file, the halt
script will not work properly with this patch.

--- checkfs     2002-09-29 11:31:01.000000000 -0600
+++ /etc/init.d/checkfs 2002-10-18 16:28:59.000000000 -0600
@@ -32,13 +32,13 @@
        if [ -x /sbin/raidstart -a -f /etc/raidtab -a -f /proc/mdstat ]
        then
                ebegin "Starting software RAID"
-               ACTIVE_RAID="`grep -E "md[0-9]+[[:space:]]?: active raid"
/proc/mdstat | awk -F ':' '{print $1}'`"
-               if [ ! -z "${ACTIVE_RAID}" ]
+               ACTIVE_RAID="`grep -E "md[0-9]+[[:space:]]?: active raid"
/proc/mdstat | awk -F 'md|:' '{print $2}'`"
+               if [ -n "${ACTIVE_RAID}" ]
                then
-                       for x in $(grep -E "raiddev /dev/md[0-9]+" /etc/raidtab | \
-                                  awk '{print $2}' | grep -v "`echo
${ACTIVE_RAID} | sed s'/[[:space:]]//g'`")
+                       for x in $(grep -E "^[[:space:]]*raiddev
/dev/md/?[0-9]+" /etc/raidtab | \
+                                  awk '{print $2}' | grep -v -E
"#|/dev/md/?(`echo ${ACTIVE_RAID} | sed s'/[[:space:]]/|/g'`)")
                        do
-                               /sbin/raidstart /dev/${x}
+                               /sbin/raidstart ${x}
                        done
                else
                        /sbin/raidstart --all



--- halt.sh     2002-10-13 13:20:23.000000000 -0600
+++ /etc/init.d/halt.sh 2002-10-18 16:33:00.000000000 -0600
@@ -88,10 +88,15 @@
 if [ -x /sbin/raidstop -a -f /etc/raidtab -a -f /proc/mdstat ]
 then
        ebegin "Stopping software RAID"
-       for x in $(grep -E "md[0-9]+[[:space:]]?: active raid" /proc/mdstat |
awk -F ':' '{print $1}')
-       do
-               raidstop /dev/${x} >/dev/null
-       done
+       ACTIVE_RAID="`grep -E "md[0-9]+[[:space:]]?: active raid" /proc/mdstat |
awk -F 'md|:' '{print $2}'`"
+       if [ -n "${ACTIVE_RAID}" ]
+       then
+               for x in $(grep -E "^[[:space:]]*raiddev /dev/md/?[0-9]+"
/etc/raidtab | \
+                          awk '{print $2}' | grep -E "/dev/md/?(`echo
${ACTIVE_RAID} | sed s'/[[:space:]]/|/g'`)")
+               do
+                       raidstop ${x} >/dev/null
+               done
+       fi
        eend $? "Failed to stop software RAID"
 fi
Comment 1 Quinn Harris 2002-10-18 17:37:26 UTC
Created attachment 4809 [details, diff]
halt.sh patch
Comment 2 Quinn Harris 2002-10-18 17:37:47 UTC
Created attachment 4810 [details, diff]
checkfs patch
Comment 3 SpanKY gentoo-dev 2002-10-18 18:12:02 UTC
i run a kernel w/out devfs and my md devices exist as /dev/md0 ...
Comment 4 Martin Schlemmer (RETIRED) gentoo-dev 2002-10-19 23:43:31 UTC
I am starting to opt for *NOT* having raid stuff in there.  It is driving me
mad, and as I do not use the damn thing, too many headache :/
Comment 5 SpanKY gentoo-dev 2002-10-20 09:46:28 UTC
would a separate script make your life easier ? 
Comment 6 Martin Schlemmer (RETIRED) gentoo-dev 2002-10-20 10:21:57 UTC
Dunno.  I can think that it will cause problems, as the stop stuff for raid
should be done at the very end ?  So if not in halt.sh ....

Can we just get the thing fixed, tested, and THEN ill commit ?
Comment 7 Martin Schlemmer (RETIRED) gentoo-dev 2002-12-25 21:03:49 UTC
And, can anybody comment on this patch ?
Comment 8 Quinn Harris 2003-02-07 13:09:17 UTC
The code for starting RAID devices has been totally changed in baselayout-1.8.6.2.
This bug is no longer relavant but I have filed bug 15282 that addresses new problems.