Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 119380 - sys-fs/mdadm: mdadm does not stop array on shutdown - kexec reboot fails with kernel panic
Summary: sys-fs/mdadm: mdadm does not stop array on shutdown - kexec reboot fails with...
Status: RESOLVED FIXED
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: Current packages (show other bugs)
Hardware: All Linux
: High normal with 1 vote (vote)
Assignee: Gentoo's Team for Core System packages
URL:
Whiteboard:
Keywords:
: 304929 (view as bug list)
Depends on:
Blocks: 128848 295397 414259
  Show dependency tree
 
Reported: 2006-01-17 23:46 UTC by mario
Modified: 2012-11-11 07:54 UTC (History)
23 users (show)

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


Attachments
/boot/config-2.6.34-gentoo-r1-Gentoo-uranus-1-20 (config-2.6.34-gentoo-r1-Gentoo-uranus-1-20,76.20 KB, text/plain)
2010-07-04 18:00 UTC, DEMAINE Benoît-Pierre, aka DoubleHP
Details

Note You need to log in before you can comment on or make changes to this bug.
Description mario 2006-01-17 23:46:35 UTC
When reboot my system I get the following message at the end:

mdadm: fail to stop array /dev/md0: Device or resource busy
md0 is my root partition

In general that is no big problem when shutting down the system, but when I reboot with kexec, I get a kernel panic because the kernel can not detect the root filesystem.

mdadm-2.2-r1
Comment 1 mario 2006-01-18 00:40:22 UTC
Additional Info:
mdadm-2.1 does not give that error message on shutdown.

But I still get a kernel panic with additional ouput (something about irq)

I am not sure anymore if that is really a mdadm issue..

Can anybody confirm this?
Comment 2 SpanKY gentoo-dev 2006-01-18 04:43:13 UTC
do you use an initrd to boot ?
Comment 3 mario 2006-01-19 02:09:45 UTC
No initrd.

And somehow I remember I successfully tested the kexec feature after I installed a  2.6.13 kernel the first time

I'll check my emerge logs and see, if I can get it to work again with some older packages.
Comment 4 SpanKY gentoo-dev 2006-01-19 02:29:37 UTC
well you didnt post `emerge info` so i dont know what kind of system you're using
Comment 5 mario 2006-01-19 03:43:14 UTC
Sorry, my bad. Emerge info output is below.

I tracked the problem down to the following:

I have to explicitly write the following line in /etc/conf.d/kexec
ROOTPART="/dev/md0"

Then kexec reboot works great with mdadm-2.1.

Using mdadm-2.2-r1 the kernel prints several irq warnings, irq disabled and hd dma errors.




Portage 2.0.53 (default-linux/x86/2005.0, gcc-3.4.5, glibc-2.3.5-r2, 2.6.15-nitro3 i686)
=================================================================
System uname: 2.6.15-nitro3 i686 AMD Athlon(tm) XP 1600+
Gentoo Base System version 1.12.0_pre14
dev-lang/python:     2.3.5-r2, 2.4.2
sys-apps/sandbox:    1.2.12
sys-devel/autoconf:  2.13, 2.59-r6
sys-devel/automake:  1.4_p6, 1.5, 1.6.3, 1.7.9-r1, 1.8.5-r3, 1.9.6-r1
sys-devel/binutils:  2.16.1
sys-devel/libtool:   1.5.22
virtual/os-headers:  2.6.11-r2
ACCEPT_KEYWORDS="x86"
AUTOCLEAN="yes"
CBUILD="i686-pc-linux-gnu"
CFLAGS="-O2 -march=athlon-xp -pipe -fomit-frame-pointer -ffast-math"
CHOST="i686-pc-linux-gnu"
CONFIG_PROTECT="/etc /usr/kde/2/share/config /usr/kde/3.4/env /usr/kde/3.4/share/config /usr/kde/3.4/shutdown /usr/kde/3.5/env /usr/kde/3.5/share/config /usr/kde/3.5/shutdown /usr/kde/3/share/config /usr/share/X11/xkb /usr/share/config /var/qmail/control"
CONFIG_PROTECT_MASK="/etc/gconf /etc/terminfo /etc/env.d"
CXXFLAGS="-O2 -march=athlon-xp -pipe -fomit-frame-pointer -ffast-math -fvisibility-inlines-hidden"
DISTDIR="/usr/portage/distfiles"
FEATURES="autoconfig distlocks sandbox sfperms strict"
GENTOO_MIRRORS="http://ftp-stud.fht-esslingen.de/pub/Mirrors/gentoo/ ftp://gentoo.inode.at/source/ http://ftp.linux.ee/pub/gentoo/distfiles/ ftp://ftp.tu-clausthal.de/pub/linux/gentoo/"
LANG="de_DE.UTF-8"
LC_ALL="de_DE.UTF-8"
LINGUAS="de"
PKGDIR="/usr/portage/packages"
PORTAGE_TMPDIR="/var/tmp"
PORTDIR="/usr/portage"
PORTDIR_OVERLAY="/usr/local/portage"
SYNC="rsync://192.168.0.1/gentoo-portage"
USE="x86 3dnow aalib alsa apm audiofile avi bitmap-fonts bonobo bzip2 cdr crypt curl dvd eds emboss encode esd exif expat fam ffmpeg firefox flac foomaticdb fortran gd gif glut gmp gtk gtk2 gtkhtml guile idn imagemagick imlib jpeg junit lcms libg++ libwww mad mikmod mmx mng mp3 mpeg mysql ncurses nls nptl nptlonly nvidia ogg oggvorbis opengl pcre pdflib php png quicktime readline samba sdl slang spell sse tcltk tcpd tiff truetype truetype-fonts type1-fonts udev unicode utf8 vorbis win32codecs xine xml xml2 xv xvid zlib linguas_de userland_GNU kernel_linux elibc_glibc"
Unset:  ASFLAGS, CTARGET, LDFLAGS, MAKEOPTS
Comment 6 SpanKY gentoo-dev 2006-01-19 03:49:55 UTC
> I have to explicitly write the following line in /etc/conf.d/kexec
> ROOTPART="/dev/md0"

that part is pebkac then ...

> Using mdadm-2.2-r1 the kernel prints several irq warnings, irq disabled and hd
> dma errors.

but the part where mdadm-2.2 fails to stop the array is no fun

what do you use your raid for ? (in other words, what do you have in /etc/fstab)
Comment 7 mario 2006-01-19 03:56:26 UTC
hehe, pebkac, yes. My computer at home worked without that line (no raid). I didn't think about activating that here at first :-)


/etc/fstab:
/dev/md0     /       reiser4    noatime       0 2
/dev/hda1    /boot   ext2       noauto,noatime       1 1


There exists another array /dev/md1, but I do not use it at the moment.
It was supposed to be the boot parition, but grub never booted from it.
Comment 8 SpanKY gentoo-dev 2006-01-19 16:47:37 UTC
tbh, i'm not sure what's supposed to happen with raid devices when you have them on the root partition ...

might want to subscribe to the linux-raid mailing list and ask if this is a bug or a feature :)
http://vger.kernel.org/vger-lists.html#linux-raid
Comment 9 marvin rouge 2006-01-22 01:58:57 UTC
Same problem here, with sys-fs/mdadm-2.2-r1
mdadm: fail to stop array /dev/md0: Device or resource busy
md0 is also my root partition.

/etc/fstab:
/dev/sda1               /boot           ext2            noauto,noatime  1 2
/dev/md0                /               ext3            noatime         0 1
/dev/md3                /home           reiserfs        noatime         0 1
/dev/md2                /home/music     reiserfs        noatime         0 1
/dev/md4                /home/photos    ext3            noatime         0 1

Please note that I have no such message with the others partitions.

emerge info
Portage 2.1_pre3-r1 (default-linux/amd64/2005.0, gcc-3.4.5, glibc-2.3.6-r2, 2.6.15-gentoo x86_64)
=================================================================
System uname: 2.6.15-gentoo x86_64 AMD Athlon(tm) 64 Processor 3500+
Gentoo Base System version 1.12.0_pre15
ccache version 2.4 [enabled]
dev-lang/python:     2.3.5, 2.4.2
sys-apps/sandbox:    1.2.17
sys-devel/autoconf:  2.13, 2.59-r7
sys-devel/automake:  1.4_p6, 1.5, 1.6.3, 1.7.9-r1, 1.8.5-r3, 1.9.6-r1
sys-devel/binutils:  2.16.1-r1
sys-devel/libtool:   1.5.22
virtual/os-headers:  2.6.11-r3
ACCEPT_KEYWORDS="amd64 ~amd64"
AUTOCLEAN="yes"
CBUILD="x86_64-pc-linux-gnu"
CFLAGS="-march=k8 -O2 -pipe"
CHOST="x86_64-pc-linux-gnu"
CONFIG_PROTECT="/etc /usr/kde/2/share/config /usr/kde/3.5/env /usr/kde/3.5/share/config /usr/kde/3.5/shutdown /usr/kde/3/share/config /usr/share/X11/xkb /usr/share/config /var/qmail/control"
CONFIG_PROTECT_MASK="/etc/gconf /etc/terminfo /etc/texmf/web2c /etc/env.d"
CXXFLAGS="-march=k8 -O2 -pipe"
DISTDIR="/usr/portage/distfiles"
FEATURES="autoconfig buildsyspkg candy ccache distlocks sandbox sfperms strict"
GENTOO_MIRRORS="ftp://ftp.proxad.net/mirrors/ftp.gentoo.org/ http://mirror.switch.ch/ftp/mirror/gentoo/ ftp://mirror.switch.ch/ftp/mirror/gentoo/"
LANG="fr_FR.utf8"
LC_ALL="fr_FR.utf8"
LINGUAS="fr en_GB"
MAKEOPTS="-j2"
PKGDIR="/usr/portage/packages"
PORTAGE_TMPDIR="/var/tmp"
PORTDIR="/usr/portage"
PORTDIR_OVERLAY="/usr/local/portage"
SYNC="rsync://rsync.gentoo.org/gentoo-portage"
USE="amd64 X a52 aac alsa apache2 audiofile berkdb bitmap-fonts cdr crypt divx4linux dvd dvdr dvdread emboss encode fam firefox flac foomaticdb fortran gif gtk gtk2 hal ieee1394 imagemagick imlib jabber java jpeg kdeenablefinal logrotate lzw lzw-tiff mad matroska mozcalendar mozsvg mp3 mpeg mplayer msn ncurses nls nowin nptl nptlonly nvidia ofx ogg openexr opengl oss pam pdflib perl php png python quicktime readline real ruby sdl spell ssl subtitles svg tcpd tetex theora tiff truetype truetype-fonts type1-fonts unicode usb userlocales vorbis wmf xine xml xml2 xpm xv xvid zlib elibc_glibc kernel_linux linguas_fr linguas_en_GB userland_GNU"
Unset:  ASFLAGS, CTARGET, LDFLAGS

cheers.
Comment 10 Robert Kruus 2006-01-27 07:03:37 UTC
I had a similar problem, but with LVM.  I discovered that was ssh-agent wasn't killed so /usr could not be unmounted and the volume group shutdown.  An edit to the local.stop helped in this case.
Comment 11 Frido Ferdinand 2006-03-23 19:02:27 UTC
I'm also using md raid on my rootfs, I have asked the question on the linux-raid list and it was answered by Neil Brown, which is the main linux software raid developer. we might want to use eend 0 in raid-stop.sh:

> Hi,                                                                                                                             
>                                                                                                                                 
> This question is mainly about the following error during shutdown on my                                                         
> gentoo system:                                                                                                                  
>                                                                                                                                 
> mdadm: fail to stop array /dev/md1: Device or resource busy                                                                     
>                                                                                                                                 
> (full raid1, root is on /dev/md1)                                                                                               
>                                                                                                                                 
> After searching bugzilla I found:                                                                                               
>                                                                                                                                 
> http://bugs.gentoo.org/show_bug.cgi?id=119380                                                                                   
>                                                                                                                                 
> However there's no agreement on if / how mdadm should stop the rootfs                                                           
> during a shutdown sequence. Can anyone enlight me on a good way to                                                              
> proceed in this ?                                                                                                               
                                                                                                                                  
There is no need to stop the root md, or in fact any md, at shutdown.                                                             
The shutdown process in the kernel will switch any active md arrays to                                                            
read-only, which is effectively the same as shutting them down.                                                                   
                                                                                                                                  
It doesn't hurt to do                                                                                                             
  mdadm -Ss                                                                                                                       
but it isn't really needed and you can ignore any errors.                                                                         
                                                                                                                                  
NeilBrown                                                                                                                         
                                                                                                                                  
Comment 12 SpanKY gentoo-dev 2006-04-07 18:14:02 UTC
hmm, if you remove this line from your /etc/init.d/halt.sh, does everything work ?

        [[ ${x} == "/usr" ]] && continue
Comment 13 Nebojsa Trpkovic 2006-04-18 07:44:05 UTC
same error here

/dev/md0 is / partition

mdadm is 2.4.1

emerge info
Portage 2.0.54 (default-linux/amd64/2006.0, gcc-3.4.4, glibc-2.3.5-r2, 2.6.16-gentoo-r2 x86_64)
=================================================================
System uname: 2.6.16-gentoo-r2 x86_64 AMD Athlon(tm) 64 X2 Dual Core Processor 3800+
Gentoo Base System version 1.6.14
dev-lang/python:     2.4.2
sys-apps/sandbox:    1.2.12
sys-devel/autoconf:  2.13, 2.59-r6
sys-devel/automake:  1.4_p6, 1.5, 1.6.3, 1.7.9-r1, 1.8.5-r3, 1.9.6-r1
sys-devel/binutils:  2.16.1
sys-devel/libtool:   1.5.22
virtual/os-headers:  2.6.11-r2
ACCEPT_KEYWORDS="amd64"
AUTOCLEAN="yes"
CBUILD="x86_64-pc-linux-gnu"
CFLAGS="-march=athlon64 -O2 -pipe -ftracer -frename-registers -fweb -maccumulate-outgoing-args"
CHOST="x86_64-pc-linux-gnu"
CONFIG_PROTECT="/etc /usr/kde/2/share/config /usr/kde/3/share/config /usr/share/config /var/qmail/control"
CONFIG_PROTECT_MASK="/etc/eselect/compiler /etc/gconf /etc/terminfo /etc/env.d"
CXXFLAGS="-march=athlon64 -O2 -pipe -ftracer -frename-registers -fweb -maccumulate-outgoing-args"
DISTDIR="/mnt/storage/distfiles"
FEATURES="autoconfig distlocks sandbox sfperms strict"
GENTOO_MIRRORS="http://ftp-stud.fht-esslingen.de/pub/Mirrors/gentoo/ http://gd.tuwien.ac.at/opsys/linux/gentoo/"
LDFLAGS="-Wl,-O1 -Wl,--sort-common"
MAKEOPTS="-j3"
PKGDIR="/usr/portage/packages"
PORTAGE_TMPDIR="/var/tmp"
PORTDIR="/usr/portage"
PORTDIR_OVERLAY="/usr/local/portage"
USE="amd64 acpi apache2 avi berkdb bitmap-fonts bzip2 cli crypt ctype dba dri dvd eds emboss expat extensions fastbuild force-cgi-redirect fortran freetype ftp gif gpm gstreamer gtk2 httpd imlib isdnlog jpeg libwww lm_sensors logrotate lzw lzw-tiff memlimit mod mysql ncurses nptl nptlonly pam pcre pdflib perl png posix pppd python quicktime readline rrdtool sdl session simplexml snmp soap sockets spell spl ssl tcpd threads tiff tokenizer truetype truetype-fonts type1-fonts udev usb xml xml2 xsl zlib userland_GNU kernel_linux elibc_glibc"
Unset:  ASFLAGS, CTARGET, INSTALL_MASK, LANG, LC_ALL, LINGUAS


maybe this error reporting should be removed from shutdown script

Comment 14 Frido Ferdinand 2006-05-23 11:13:04 UTC
latest mdadm still has this, can this be fixed as to per neil browns comments ?
Comment 15 SpanKY gentoo-dev 2006-06-11 07:56:00 UTC
that doesnt make any sense, Neil didnt suggest any fix, he just said it shouldnt matter

try baselayout-1.12.1
Comment 16 Matthew Schultz 2007-02-16 06:08:32 UTC
I'm getting the same error on shutdown.  It starts up fine but couldn't it not error out when it shutsdown/reboots?

mdadm: fail to stop array /dev/md3: Device or resource busy

fstab:

/dev/md0                /boot                   ext2            noauto,noatime  1 2
/dev/md3                /                       reiserfs        notail,noatime  0 1
/dev/md2                /var                    reiserfs        notail,noatime  0 1
/dev/sda2               /var/tmp/portage        reiserfs        notail,noatime  0 1
/dev/sda1               /home                   xfs             noatime         0 1
/dev/md1                none                    swap            sw              0 0
/dev/cdroms/cdrom0      /mnt/cdrom              iso9660         noauto,ro       0 0
/dev/fd0                /mnt/floppy             auto            noauto          0 0


mdadm.conf:

DEVICE /dev/sd[bc]1 /dev/sd[bc]2 /dev/sd[bc]3 /dev/sd[bc]5
ARRAY /dev/md0 level=raid1 num-devices=2 UUID=c7d32f49:13fd153c:17204222:e14842a5
ARRAY /dev/md3 level=raid1 num-devices=2 UUID=cc0e31df:bfdbb164:4d2614a2:b19e893d
ARRAY /dev/md2 level=raid1 num-devices=2 UUID=c25fd649:14fb907f:bdb08d17:7a6f03c3
ARRAY /dev/md1 level=raid1 num-devices=2 UUID=089bdefa:3ab1167e:03189c32:d7dea7be


emerge --info
Portage 2.1.2-r9 (default-linux/amd64/2006.1, gcc-4.1.1, glibc-2.5-r0, 2.6.20-gentoo x86_64)
=================================================================
System uname: 2.6.20-gentoo x86_64 AMD Opteron(tm) Processor 144
Gentoo Base System release 1.12.9
Timestamp of tree: Thu, 15 Feb 2007 09:00:01 +0000
dev-java/java-config: 1.3.7, 2.0.31
dev-lang/python:     2.4.3-r4
dev-python/pycrypto: 2.0.1-r5
sys-apps/sandbox:    1.2.17
sys-devel/autoconf:  2.13, 2.61
sys-devel/automake:  1.4_p6, 1.5, 1.6.3, 1.7.9-r1, 1.8.5-r3, 1.9.6-r2, 1.10
sys-devel/binutils:  2.16.1-r3
sys-devel/gcc-config: 1.3.14
sys-devel/libtool:   1.5.22
virtual/os-headers:  2.6.17-r1
ACCEPT_KEYWORDS="amd64"
AUTOCLEAN="yes"
CBUILD="x86_64-pc-linux-gnu"
CFLAGS="-march=athlon64 -O2 -pipe -fomit-frame-pointer"
CHOST="x86_64-pc-linux-gnu"
CONFIG_PROTECT="/etc /usr/kde/3.5/env /usr/kde/3.5/share/config /usr/kde/3.5/shutdown /usr/share/X11/xkb /usr/share/config /var/bind"
CONFIG_PROTECT_MASK="/etc/env.d /etc/env.d/java/ /etc/gconf /etc/java-config/vms/ /etc/revdep-rebuild /etc/terminfo"
CXXFLAGS="-march=athlon64 -O2 -pipe -fomit-frame-pointer"
DISTDIR="/usr/portage/distfiles"
FEATURES="autoconfig distlocks metadata-transfer parallel-fetch sandbox sfperms strict"
GENTOO_MIRRORS="http://gentoo.mirrors.easynews.com/linux/gentoo/ http://mirror.phy.olemiss.edu/mirror/gentoo http://mirror.espri.arizona.edu/gentoo/"
MAKEOPTS="-j3"
PKGDIR="/usr/portage/packages"
PORTAGE_RSYNC_OPTS="--recursive --links --safe-links --perms --times --compress --force --whole-file --delete --delete-after --stats --timeout=180 --exclude=/distfiles --exclude=/local --exclude=/packages"
PORTAGE_TMPDIR="/var/tmp"
PORTDIR="/usr/portage"
PORTDIR_OVERLAY="/usr/local/portage"
SYNC="rsync://rsync.gentoo.org/gentoo-portage"
USE="X a52 aac alsa amd64 apache2 audiofile avi bcmath berkdb bitmap-fonts bzip2 calendar cjk clamav cli cracklib crypt ctype cups curl curlwrappers dio directfb dlloader dri dts dvb dvd dvdread emu-linux-x86 encode exif fbcon ffmpeg flac fortran ftp gd gdbm gif gmp gpm gtk gtk2 hardenedphp hash iconv id3 ieee1394 imagemagick imlib innodb ipv6 isdnlog ithreads java javascript jpeg jpeg2k kde lcms ldap libg++ lzo mad matroska mcal mhash midi mime mjpeg mng mp3 mp4 mpeg mplayer msession mysql mysqli ncurses network nls nptl nptlonly nsplugin nvidia ogg openal opengl osc oss pam pcntl pcre pdf pdo pear perl png posix ppds pppd python qt qt3 qt4 quicktime readline reflection samba sasl sdl seamonkey session simplexml snmp soap sockets spl sqlite ssl svg tcpd theora threads tidy tiff tokenizer transcode truetype truetype-fonts type1-fonts unicode urandom usb v4l v4l2 vcd vorbis wddx wxwindows xforms xine xml xml2 xorg xpm xv xvid zlib" ALSA_CARDS="ali5451 als4000 atiixp atiixp-modem bt87x ca0106 cmipci emu10k1x ens1370 ens1371 es1938 es1968 fm801 hda-intel intel8x0 intel8x0m maestro3 trident usb-audio via82xx via82xx-modem ymfpci" ALSA_PCM_PLUGINS="adpcm alaw asym copy dmix dshare dsnoop empty extplug file hooks iec958 ioplug ladspa lfloat linear meter mulaw multi null plug rate route share shm softvol" ELIBC="glibc" INPUT_DEVICES="keyboard mouse" KERNEL="linux" LCD_DEVICES="bayrad cfontz cfontz633 glk hd44780 lb216 lcdm001 mtxorb ncurses text" USERLAND="GNU" VIDEO_CARDS="nv nvidia vesa fbdev v4l"
Unset:  CTARGET, EMERGE_DEFAULT_OPTS, INSTALL_MASK, LANG, LC_ALL, LDFLAGS, LINGUAS, PORTAGE_RSYNC_EXTRA_OPTS
Comment 17 Robin Johnson archtester Gentoo Infrastructure gentoo-dev Security 2007-10-03 09:10:44 UTC
please retest.
Comment 18 Matthew Schultz 2008-01-14 17:26:07 UTC
Using 1.12.10-r5 now and mdadm still does not shut down the array properly and my computer fails to reboot.
Comment 19 Roman Petrov 2008-03-05 12:46:48 UTC
Using 1.12.11.1 now and mdadm still does not shut down the array properly
Comment 20 Roman Petrov 2008-03-05 12:50:37 UTC
Using 1.12.11.1 now and mdadm still does not shut down the array properly
Comment 21 Robin Johnson archtester Gentoo Infrastructure gentoo-dev Security 2008-12-07 07:35:42 UTC
If this still exists, please post the entire kernel panic that you describe, using a recent kernel >=2.6.27 (ideally 2.6.28 git series).
Comment 22 Clemente Aguiar 2008-12-10 16:09:35 UTC
I'm getting the same error on shutdown.

mdadm: fail to stop array /dev/md2: Device or resource busy

But the computer reboots ok anyway.

I am using:
kernel  2.6.26-gentoo-r4
baselayout  1.12.11.1

fstab:

/dev/md0	/boot		ext2		defaults,noatime	1 2
/dev/md1	none            swap		sw                      0 0
/dev/md2	/		reiserfs	noatime,notail		0 1
/dev/fd0	/mnt/floppy	auto		noauto			0 0
none		/proc		proc		defaults		0 0
none		/dev/shm	tmpfs		nodev,nosuid,noexec	0 0

/dev/hda	/media/cdrecorder       auto    user,exec,noauto,managed 0 0


/etc/mdadm.conf:

DEVICE /dev/sd[ab]1 /dev/sd[ab]2 /dev/sd[ab]3
ARRAY /dev/md0 level=raid1 num-devices=2 UUID=53d30e80:2ac5ce3e:44801391:329387a9 devices=/dev/sda1,/dev/sdb1
ARRAY /dev/md1 level=raid1 num-devices=2 UUID=42ab6ddc:ddbeb200:e508f312:6516344c devices=/dev/sda2,/dev/sdb2
ARRAY /dev/md2 level=raid1 num-devices=2 UUID=268ccce5:0fed56aa:7768723c:bf49d51d devices=/dev/sda3,/dev/sdb3



emerge --info:

Portage 2.1.4.5 (default/linux/amd64/2008.0, gcc-4.1.2, glibc-2.6.1-r0, 2.6.26-gentoo-r4 x86_64)
=================================================================
System uname: 2.6.26-gentoo-r4 x86_64 Intel(R) Xeon(TM) CPU 3.60GHz
Timestamp of tree: Tue, 09 Dec 2008 23:15:02 +0000
app-shells/bash:     3.2_p33
dev-java/java-config: 1.3.7, 2.1.6
dev-lang/python:     2.4.4-r14, 2.5.2-r7
dev-python/pycrypto: 2.0.1-r6
sys-apps/baselayout: 1.12.11.1
sys-apps/sandbox:    1.2.18.1-r2
sys-devel/autoconf:  2.61-r2
sys-devel/automake:  1.7.9-r1, 1.9.6-r2, 1.10.1-r1
sys-devel/binutils:  2.18-r3
sys-devel/gcc-config: 1.4.0-r4
sys-devel/libtool:   1.5.26
virtual/os-headers:  2.6.23-r3
ACCEPT_KEYWORDS="amd64"
CBUILD="x86_64-pc-linux-gnu"
CFLAGS="-O2 -march=nocona -pipe"
CHOST="x86_64-pc-linux-gnu"
CONFIG_PROTECT="/etc /usr/kde/3.4/env /usr/kde/3.4/share/config /usr/kde/3.4/shutdown /usr/kde/3.5/env /usr/kde/3.5/share/config /usr/kde/3.5/shutdown /usr/share/config"
CONFIG_PROTECT_MASK="/etc/ca-certificates.conf /etc/env.d /etc/env.d/java/ /etc/fonts/fonts.conf /etc/gconf /etc/php/apache2-php5/ext-active/ /etc/php/cgi-php5/ext-active/ /etc/php/cli-php5/ext-active/ /etc/revdep-rebuild /etc/terminfo /etc/udev/rules.d"
CXXFLAGS="-O2 -march=nocona -pipe"
DISTDIR="/usr/portage/distfiles"
FEATURES="buildpkg distlocks metadata-transfer parallel-fetch sandbox sfperms strict unmerge-orphans userfetch"
GENTOO_MIRRORS="http://distfiles.gentoo.org http://distro.ibiblio.org/pub/linux/distributions/gentoo"
LANG="en_US"
LC_ALL="en_US"
LDFLAGS="-Wl,-O1"
LINGUAS="en pt_PT"
MAKEOPTS="-j2"
PKGDIR="/usr/portage/packages"
PORTAGE_RSYNC_OPTS="--recursive --links --safe-links --perms --times --compress --force --whole-file --delete --stats --timeout=180 --exclude=/distfiles --exclude=/local --exclude=/packages"
PORTAGE_TMPDIR="/var/tmp"
PORTDIR="/usr/portage"
SYNC="rsync://rsync.europe.gentoo.org/gentoo-portage"
USE="X acl amd64 apache2 berkdb browserplugin bzip2 caps cli cracklib crypt dri fam gdbm gpm gtk hal iconv ipv6 isdnlog java jpeg kde logrotate midi mmx mudflap multilib ncurses nls nptl nptlonly nsplugin openmp pam pcre pdf perl png pppd python qt qt3 readline reflection samba session spl sse sse2 ssl sysfs tcpd unicode xorg zlib" ALSA_CARDS="ali5451 als4000 atiixp atiixp-modem bt87x ca0106 cmipci emu10k1x ens1370 ens1371 es1938 es1968 fm801 hda-intel intel8x0 intel8x0m maestro3 trident usb-audio via82xx via82xx-modem ymfpci" ALSA_PCM_PLUGINS="adpcm alaw asym copy dmix dshare dsnoop empty extplug file hooks iec958 ioplug ladspa lfloat linear meter mmap_emul mulaw multi null plug rate route share shm softvol" APACHE2_MODULES="actions alias auth_basic auth_digest authn_anon authn_dbd authn_dbm authn_default authn_file authz_dbm authz_default authz_groupfile authz_host authz_owner authz_user autoindex cache dav dav_fs dav_lock dbd deflate dir disk_cache env expires ext_filter file_cache filter headers ident imagemap include info log_config logio mem_cache mime mime_magic negotiation proxy proxy_ajp proxy_balancer proxy_connect proxy_http rewrite setenvif so speling status unique_id userdir usertrack vhost_alias" ELIBC="glibc" INPUT_DEVICES="keyboard mouse" KERNEL="linux" LCD_DEVICES="bayrad cfontz cfontz633 glk hd44780 lb216 lcdm001 mtxorb ncurses text" LINGUAS="en pt_PT" USERLAND="GNU" VIDEO_CARDS="radeon vga"
Unset:  CPPFLAGS, CTARGET, EMERGE_DEFAULT_OPTS, FFLAGS, INSTALL_MASK, PORTAGE_COMPRESS, PORTAGE_COMPRESS_FLAGS, PORTAGE_RSYNC_EXTRA_OPTS, PORTDIR_OVERLAY
Comment 23 Eggert 2009-01-05 20:00:50 UTC
A similar issue is discussed here:
http://forum.soft32.com/linux/gentoo-mdadm-failed-stop-dev-md1-ftopict328799.html
and the conclusion is:

...
Yep, get used to it! ;->

The problem is that there are still at least two programs running at
shutdown time...the shutdown command and init. Since their current
working directory is somewhere on the root filesystem, root cannot be
unmounted...the best that can happen is that root gets remounted
read-only. And since your root filesystem cannot be unmounted, /dev/md1
will continue to be busy.

It is a completely harmless message though. I get something similar
about shuting down LVM...

-Richard

I still cannot get used to it...
Chris
Comment 24 Matthew Schultz 2009-01-07 02:56:28 UTC
The explanation doesn't seem to make any sense because when rebooting or shutting down on a system that does not use raid, the root partition is remounted read-only without any errors.


(In reply to comment #23)
> A similar issue is discussed here:
> http://forum.soft32.com/linux/gentoo-mdadm-failed-stop-dev-md1-ftopict328799.html
> and the conclusion is:
> 
> ...
> Yep, get used to it! ;->
> 
> The problem is that there are still at least two programs running at
> shutdown time...the shutdown command and init. Since their current
> working directory is somewhere on the root filesystem, root cannot be
> unmounted...the best that can happen is that root gets remounted
> read-only. And since your root filesystem cannot be unmounted, /dev/md1
> will continue to be busy.
> 
> It is a completely harmless message though. I get something similar
> about shuting down LVM...
> 
> -Richard
> 
> I still cannot get used to it...
> Chris
> 

Comment 25 Martin Mokrejš 2009-10-16 14:42:02 UTC
Hi, I have a system with baselayout2 on ~amd64 with two raid arrays. I suspect this happens because my rootfs is on /dev/md1 while /nfslarge on /dev/md0. The shutdown script probably tries to turn off first /dev/md0 and only then /dev/md1. I see journal/fsck errors on startups in /var/log/rc.log:

rc shutdown logging started at Wed Oct 14 13:05:23 2009

* Stopping local...
Unmounting /nfslarge on /dev/md0
umount: /nfslarge: device is busy.
        (In some cases useful info about processes that use
         the device is found by lsof(8) or fuser(1))
Turning off /dev/md0
mdadm: failed to stop array /dev/md0: Device or resource busy
Perhaps a running process, mounted filesystem or active volume group?

[cut]

* Unmounting filesystems
*   Unmounting /var/lib/nfs/rpc_pipefs...
 [ ok ]
*   Unmounting /nfslarge...
 [ ok ]
*   mdraid uses addon code which is deprecated
*   and may not be available in the future.
* Shutting down RAID devices (mdadm)...
mdadm: stopped /dev/md0
mdadm: failed to stop array /dev/md1: Device or resource busy
Perhaps a running process, mounted filesystem or active volume group?
 [ !! ]
* ERROR: mdraid failed to stop
* Stopping udevd...
 [ ok ]
* Setting hardware clock using the system clock [Local Time]...
 [ ok ]

rc shutdown logging stopped at Wed Oct 14 13:05:33 2009

# cat /etc/fstab
/dev/md1                /               ext3            noatime         0 1
/dev/sdb2               none            swap            sw              0 0
/dev/cdrom              /mnt/cdrom      auto            noauto,ro       0 0
shm                     /dev/shm        tmpfs           nodev,nosuid,noexec     0 0
/dev/md0                /nfslarge       ext3            noatime         0 2

# cat /etc/mdadm.conf
ARRAY /dev/md0 devices=/dev/sdc1,/dev/sdd1,/dev/sde1,/dev/sdf1
ARRAY /dev/md1 devices=/dev/sda1,/dev/sdb1
# dmesg | grep "Command line"
Command line: root=/dev/md1 console=ttyS0,9600n8 console=tty0 probe_mask=0x3f idebus=66 udev
#

Happens with openrc-0.4.3-r3 and 0.5.1--r1 as well.
Comment 26 Markus Goppelt 2009-12-05 17:55:19 UTC
I think the error message(s) can be ignored. The filesystems are remounted read-only before the power is turn off.

I haven't had a kernel panic after the error message after upgrading to mdadm-3.1.1 (~amd64).

Maybe the shutdown script (halt/init 0/whatever) should be altered to NOT shutdown the RAID devices. This does not seem to be necessary.
Comment 27 Luca Lesinigo 2010-01-16 00:59:30 UTC
Shutting down raid services works this way:
init (/etc/inittab) calling "/sbin/rc shutdown"
..which calls (line 834) /etc/init.d/halt.sh
..which calls (line 118) stop_addon() in /sbin/functions.sh
..which calls import_addon() in the same file
..which finally calls /lib64/rcscripts/addons/raid-stop.sh
..and this scripts executes "mdadm -Ss"

mdadm(8) says -S will stop all devices not currently in use, this triggers the error message "fail to stop array /dev/mdX" if mdX is still mounted, that is if it's the root device. AFAIK there isn't any way to prevent mdadm from trying to stop it neither on the command line nor in mdadm.conf.

Options are:
1) keep it as it is
...I too think that all error messages should trigger admin attention, so we shouldn't print that error if it is to be ignored
2) redirect output to /dev/null
...this would hide true errors like trying to stop some other raid devices that's still actually in use, thus hiding possible bugs somewhere else
3) parse /proc/mdstat or /sys/block/* (if there is /sys/block/$foo/md it's an md device) in raid-stop.sh and stop devices one at a time with mdadm, skipping the root mounted one
...this could seem overkill to just remove an error line from the console during shutdown, but I think it could be the way to go for the reasons explained before
Comment 28 Luca Lesinigo 2010-01-16 01:10:49 UTC
(In reply to comment #26)
> Maybe the shutdown script (halt/init 0/whatever) should be altered to NOT
> shutdown the RAID devices. This does not seem to be necessary.
You could theoretically make software raid devices out of other block devices that need to be stopped after raid-stop.sh (order is configurable in /etc/conf.d/rc). While it is highly unlinkely, it is still possible.

I don't really know if it's an applicable example, but there is people using md on top of iSCSI o AOE devices or stuff like that, maybe some of those protocols need/prefer to have resources 'freed' before a shutdown?
Comment 29 SpanKY gentoo-dev 2010-03-06 22:53:20 UTC
*** Bug 304929 has been marked as a duplicate of this bug. ***
Comment 30 Markus Goppelt 2010-03-12 21:32:58 UTC
I got rid of the problem: I migrated to baselayout-2 and removed "dmcrypt" and "mdraid" from my boot runlevel.
Comment 31 Matthew Schultz 2010-03-15 19:20:42 UTC
(In reply to comment #30)
> I got rid of the problem: I migrated to baselayout-2 and removed "dmcrypt" and
> "mdraid" from my boot runlevel.
> 

Not sure how you did that since removing those from boot runlevel will cause your array not to start on boot.
Comment 32 Markus Goppelt 2010-03-15 20:53:22 UTC
Excerpt from dmesg: (md3 is my root partition)

rtc_cmos 00:02: setting system clock to 2010-03-15 20:30:42 UTC (1268685042)
md: Waiting for all devices to be available before autodetect
md: If you don't use raid, use raid=noautodetect
md: Autodetecting RAID arrays.
md: Scanned 12 and added 12 devices.
md: autorun ...
md: considering sda7 ...
md:  adding sda7 ...
md: sda6 has different UUID to sda7
md: sda5 has different UUID to sda7
md: sda3 has different UUID to sda7
md: sda2 has different UUID to sda7
md: sda1 has different UUID to sda7
md:  adding sdc7 ...
md: sdc6 has different UUID to sda7
md: sdc5 has different UUID to sda7
md: sdc3 has different UUID to sda7
md: sdc2 has different UUID to sda7
md: sdc1 has different UUID to sda7
md: created md7
md: bind<sdc7>
md: bind<sda7>
md: running: <sda7><sdc7>
raid1: raid set md7 active with 2 out of 2 mirrors
md7: detected capacity change from 0 to 137444327424
md: considering sda6 ...
md:  adding sda6 ...
md: sda5 has different UUID to sda6
md: sda3 has different UUID to sda6
md: sda2 has different UUID to sda6
md: sda1 has different UUID to sda6
md:  adding sdc6 ...
md: sdc5 has different UUID to sda6
md: sdc3 has different UUID to sda6
md: sdc2 has different UUID to sda6
md: sdc1 has different UUID to sda6
md: created md6
md: bind<sdc6>
md: bind<sda6>
md: running: <sda6><sdc6>
raid1: raid set md6 active with 2 out of 2 mirrors
md6: detected capacity change from 0 to 137444327424
md: considering sda5 ...
md:  adding sda5 ...
md: sda3 has different UUID to sda5
md: sda2 has different UUID to sda5
md: sda1 has different UUID to sda5
md:  adding sdc5 ...
md: sdc3 has different UUID to sda5
md: sdc2 has different UUID to sda5
md: sdc1 has different UUID to sda5
md: created md5
md: bind<sdc5>
md: bind<sda5>
md: running: <sda5><sdc5>
raid1: raid set md5 active with 2 out of 2 mirrors
md5: detected capacity change from 0 to 68730290176
md: considering sda3 ...
md:  adding sda3 ...
md: sda2 has different UUID to sda3
md: sda1 has different UUID to sda3
md:  adding sdc3 ...
md: sdc2 has different UUID to sda3
md: sdc1 has different UUID to sda3
md: created md3
md: bind<sdc3>
md: bind<sda3>
md: running: <sda3><sdc3>
raid1: raid set md3 active with 2 out of 2 mirrors
md3: detected capacity change from 0 to 34365112320
md: considering sda2 ...
md:  adding sda2 ...
md: sda1 has different UUID to sda2
md:  adding sdc2 ...
md: sdc1 has different UUID to sda2
md: created md2
md: bind<sdc2>
md: bind<sda2>
md: running: <sda2><sdc2>
raid0: looking at sda2
raid0:   comparing sda2(16787712)
 with sda2(16787712)
raid0:   END
raid0:   ==> UNIQUE
raid0: 1 zones
raid0: looking at sdc2
raid0:   comparing sdc2(16787712)
 with sda2(16787712)
raid0:   EQUAL
raid0: FINAL 1 zones
raid0: done.
raid0 : md_size is 33575424 sectors.
******* md2 configuration *********
zone0=[sda2/sdc2/]
        zone offset=0kb device offset=0kb size=16787712kb
**********************************

md2: detected capacity change from 0 to 17190617088
md: considering sda1 ...
md:  adding sda1 ...
md:  adding sdc1 ...
md: created md1
md: bind<sdc1>
md: bind<sda1>
md: running: <sda1><sdc1>
raid1: raid set md1 active with 2 out of 2 mirrors
md1: detected capacity change from 0 to 41025536
md: ... autorun DONE.
md: Loading md3: /dev/sda3
 md3: unknown partition table
md: couldn't update array info. -22
md: could not bd_claim sda3.
md: md_import_device returned -16
md: could not open unknown-block(8,19).
md: md_import_device returned -6
md: starting md3 failed
EXT3-fs: md3: couldn't mount because of unsupported optional features (240).
EXT2-fs: md3: couldn't mount because of unsupported optional features (240).
EXT4-fs (md3): mounted filesystem with ordered data mode
VFS: Mounted root (ext4 filesystem) readonly on device 9:3.
Freeing unused kernel memory: 380k freed
udev: starting version 145

I have no idea what mdraid and dmcrypt are good for!
Comment 33 Cedric Laczny 2010-03-30 12:21:44 UTC
Hi,

I experienced the problem with mdadm and the root-partition also before and ignored it due to several posts that said it would be safe to ignore it.
However, after an update from sys-fs/mdadm-2.6.8 to sys-fs/mdadm-3.0 I also get the following messages on shutdown/reboot:
 * Unmounting filesystems
 *   Unmounting /misc ...
 [ ok ]
 *   Unmounting /home ...
 [ ok ]
 *   mdraid uses addon code which is deprecated
 *   and may not be available in the future.
 * Shutting down RAID devices (mdadm) ...
mdadm: stopped /dev/md1
mdadm: failed to stop array /dev/md3: Device or resource busy
Perhaps a running process, mounted filesystem or active volume group?
mdadm: failed to stop array /dev/md5: Device or resource busy
Perhaps a running process, mounted filesystem or active volume group?
mdadm: failed to stop array /dev/md6: Device or resource busy
Perhaps a running process, mounted filesystem or active volume group?
 [ !! ]
 * ERROR: mdraid failed to stop
 * Stopping udevd ...
 [ ok ]

rc shutdown logging stopped at Tue Mar 30 14:13:16 2010

This means, after the update, also the other raid-arrays/partitions stay "busy". This also occurs when simply fresh-booting and directly shutting down again.

Additionally, I get the following error on boot:
 * Autoloaded 49 module(s)
 *   mdraid uses addon code which is deprecated
 *   and may not be available in the future.
 * Starting up RAID devices ...

 [ !! ]
Comment 34 Matthew Schultz 2010-03-30 14:13:13 UTC
(In reply to comment #32)
> 
> I have no idea what mdraid and dmcrypt are good for!
> 

Quoted from bug 301617:

With mdadm one is advised to no longer rely on kernel level autodetection of
raid arrays, but to use mdadm --assemble instead. To accomplish this task,
sys-fs/mdadm installs /etc/init.d/mdraid.
Comment 35 Markus Goppelt 2010-03-30 19:26:46 UTC
(In reply to comment #34)
> 
> Quoted from bug 301617:
> 
> With mdadm one is advised to no longer rely on kernel level autodetection of
> raid arrays, but to use mdadm --assemble instead. To accomplish this task,
> sys-fs/mdadm installs /etc/init.d/mdraid.
> 

Also for the root partition?
Comment 36 DEMAINE Benoît-Pierre, aka DoubleHP 2010-07-04 18:00:51 UTC
Created attachment 237475 [details]
/boot/config-2.6.34-gentoo-r1-Gentoo-uranus-1-20

Works for me.
sys-fs/mdadm-3.0
sys-apps/kexec-tools-2.0.0-r1
sys-kernel/gentoo-sources-2.6.34-r1

with root being on RAID5 volume (start directly without initrd with root=/dev/md5 odmraid )

Then i run command
kexec /boot/vmlinuz-2.6.34-gentoo-r1-Gentoo-uranus-1-20
under running system, and, i get back to kernel start without the BIOS.

NB: i don't use LVM.
NB: on restart, there is no journal recovery

no freese, no sync problem.
Comment 37 DEMAINE Benoît-Pierre, aka DoubleHP 2010-07-04 18:03:01 UTC
and i dont have any /etc/init.d/mdraid (hell i hate this file; it broke my box so many times in the past; how any one can still use this stupid broken config mechanism ? ).
Comment 38 theduck02 2010-09-07 13:05:50 UTC
I too have this problem but have discovered an answer while working on an error I encounted while my system booted.

Take a look at http://bugs.gentoo.org/295397 comment #8.

I would be interested in other peoples views on the solution I have adopted.

Many thanks,

theDuck
Comment 39 SpanKY gentoo-dev 2012-11-11 07:54:02 UTC
the kexec panic issue was not mdadm related and has been fixed

that only leaves the mdadm warning at shutdown when the root device is a raid.  since this bug is ancient and full of noise, i'll handle that in bug 414259.