Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 366949 - sys-fs/mdadm - Service dependencies on shutdown - mdraid shutdown before applications
Summary: sys-fs/mdadm - Service dependencies on shutdown - mdraid shutdown before appl...
Status: RESOLVED WORKSFORME
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: [OLD] baselayout (show other bugs)
Hardware: All Linux
: Normal normal (vote)
Assignee: Gentoo's Team for Core System packages
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2011-05-12 02:05 UTC by Lyall Pearce
Modified: 2015-04-04 21:57 UTC (History)
1 user (show)

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


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Lyall Pearce 2011-05-12 02:05:53 UTC
Note:Parallel startup enabled

~amd64 version taken from pentoo overlay - it appears, I am unsure how to convince it to use the gentoo one instead, even though the ebuild files are almost identical.

mdraid configured in boot runlevel.
/lib/rc/init.d/deptree shows no mention of mdraid, after an rc-update -u.

If, however, I edit /etc/init.d/lvm to depend on mdraid, then do an rc-update -u, it will show up.

/etc/init.d/dmraid specifies to be started
                before checkfs fsck
                after modules

Which it does. However, on shutdown, dmraid is attempted to be stopped even before applications like mysql.

It appears that the dependency tree does not take into account service that are enabled in a runelevel that specify 'after or before' but do not specify a 'use or need'.



Reproducible: Always

Steps to Reproduce:
1. configure system to use mdraid
2. boot - dmraid started at appropriate time
3. shutdown, mdraid shutdown attempted before disk unmounts or application closures.


Expected Results:  
mdraid would be shutdown after shutting down all applications are shutdown, filesystems unmounted and LVM closed.


# emerge --info
Portage 2.1.9.42 (default/linux/x86/10.0/desktop, gcc-4.4.5, libc-0-r0, 2.6.37-gentoo-r4 i686)
=================================================================
System uname: Linux-2.6.37-gentoo-r4-i686-Intel-R-_Core-TM-2_Quad_CPU_Q9400_@_2.66GHz-with-gentoo-2.0.2
Timestamp of tree: Wed, 11 May 2011 10:15:01 +0000
app-shells/bash:     4.1_p9
dev-java/java-config: 2.1.11-r3
dev-lang/python:     2.6.6-r2, 2.7.1-r1, 3.1.3-r1
dev-util/cmake:      2.8.4-r1
sys-apps/baselayout: 2.0.2
sys-apps/openrc:     0.8.2-r1::pentoo
sys-apps/sandbox:    2.5
sys-devel/autoconf:  2.13::<unknown repository>, 2.65-r1
sys-devel/automake:  1.9.6-r3, 1.10.3, 1.11.1
sys-devel/binutils:  2.20.1-r1
sys-devel/gcc:       4.4.5
sys-devel/gcc-config: 1.4.1-r1
sys-devel/libtool:   2.2.10
sys-devel/make:      3.81-r2
sys-kernel/linux-headers: 2.6.36.1
sys-libs/glibc:      2.11.3
virtual/os-headers:  0
ACCEPT_KEYWORDS="x86"
ACCEPT_LICENSE="* -@EULA"
CBUILD="i686-pc-linux-gnu"
CFLAGS="-O2 -ggdb -mtune=core2 -march=core2 -pipe"
CHOST="i686-pc-linux-gnu"
CONFIG_PROTECT="/etc /lib/udev/rules.d /usr/share/config /usr/share/gnupg/qualified.txt /usr/share/maven-bin-2.2/conf /var/lib/hsqldb"
CONFIG_PROTECT_MASK="/etc/ca-certificates.conf /etc/env.d /etc/env.d/java/ /etc/eselect/postgresql /etc/fonts/fonts.conf /etc/gconf /etc/gentoo-release /etc/php/apache2-php5.3/ext-active/ /etc/php/cgi-php5.3/ext-active/ /etc/php\
/cli-php5.3/ext-active/ /etc/revdep-rebuild /etc/sandbox.d /etc/terminfo"
CXXFLAGS="-O2 -ggdb -mtune=core2 -march=core2 -pipe"
DISTDIR="/portage/Repository/distfiles"
FEATURES="assume-digests binpkg-logs collision-protect distlocks fixlafiles fixpackages news parallel-fetch protect-owned sandbox sfperms splitdebug strict unknown-features-warn unmerge-logs unmerge-orphans userfetch userpriv us\
ersandbox"
FFLAGS=""
GENTOO_MIRRORS="ftp://mirror.internode.on.net/pub/gentoo ftp://mirror.pacific.net.au/linux/Gentoo http://mymirror.asiaosc.org/gentoo/ http://www.zentek-international.com/mirrors/gentoo/ http://open-systems.ufl.edu/mirrors/gentoo\
 http://www.ibiblio.org/pub/Linux/distributions/gentoo"
LANG="en_AU"
LDFLAGS="-Wl,-O1 -Wl,--as-needed"
MAKEOPTS="-j8"
PKGDIR="/portage/Repository/packages"
PORTAGE_CONFIGROOT="/"
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="/tmp"
PORTDIR="/portage/Repository"
PORTDIR_OVERLAY="/portage/Repository/local/layman/jokey /portage/Repository/local/layman/sunrise /portage/Repository/local/layman/oss-overlay /portage/Repository/local/layman/java-overlay /portage/Repository/local/layman/pentoo \
/portage/Repository/local/layman/stargazers /portage/Repository/local"
SYNC="rsync://mirror.internode.on.net/gentoo-portage"
USE="X a52 aac acl acpi alsa amr apache2 avahi berkdb bindist bluetooth branding bzip2 cairo cdb cddb cdparanoia cdr cleartype cli consolekit corefonts cracklib crypt css cups cxx daap dbus dri dts dvb dvd dvdr emacs emboss enco\
de esd exif fam ffmpeg firefox flac fortran gd gdbm gdu gif gpm gtk iconv ipod ipv6 java javascript joystick jpeg jpeg2k kde laptop latin1 lcms ldap libnotify lm_sensors mad mikmod mmx mmxext mng modules mp3 mp4 mpeg mplayer mud\
flap mysql ncurses nls nptl nptlonly nsplugin nvidia ogg opengl openmp oss pam pango pcre pdf perl pmu png policykit posix ppds pppd python qt3support qt4 readline rss samba sdl semantic-desktop server session smp spell sqlite s\
se sse2 sse3 ssl startup-notification svg sysfs tcpd threads tiff transcode truetype type1 udev unicode usb v4l v4l2 vcd vorbis wifi wma x264 x86 xcb xcomposite xine xinerama xml xorg xulrunner xv xvid xvmc zlib" ALSA_CARDS="ali\
5451 als4000 atiixp atiixp-modem bt87x ca0106 cmipci emu10k1 emu10k1x ens1370 ens1371 es1938 es1968 fm801 hda-intel intel8x0 intel8x0m maestro3 trident usb-audio via82xx via82xx-modem ymfpci" ALSA_PCM_PLUGINS="adpcm alaw asym co\
py 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 aut\
hn_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 imag\
emap 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" CAMERAS="ptp2" COLLECTD\
_PLUGINS="df interface irq load memory rrdtool swap syslog" ELIBC="glibc" GPSD_PROTOCOLS="ashtech aivdm earthmate evermore fv18 garmin garmintxt gpsclock itrax mtk3301 nmea ntrip navcom oceanserver oldstyle oncore rtcm104v2 rtcm\
104v3 sirf superstar2 timing tsip tripmate tnt ubx" INPUT_DEVICES="keyboard mouse evdev" KERNEL="linux" LCD_DEVICES="bayrad cfontz cfontz633 glk hd44780 lb216 lcdm001 mtxorb ncurses text" PHP_TARGETS="php5-3" RUBY_TARGETS="ruby1\
8" USERLAND="GNU" VIDEO_CARDS="nvidia vesa fbdev" XTABLES_ADDONS="quota2 psd pknock lscan length2 ipv4options ipset ipp2p iface geoip fuzzy condition tee tarpit sysrq steal rawnat logmark ipmark dhcpmac delude chaos account"
Unset:  CPPFLAGS, CTARGET, EMERGE_DEFAULT_OPTS, INSTALL_MASK, LC_ALL, LINGUAS, PORTAGE_BUNZIP2_COMMAND, PORTAGE_COMPRESS, PORTAGE_COMPRESS_FLAGS, PORTAGE_RSYNC_EXTRA_OPTS
Comment 1 Robin Johnson archtester Gentoo Infrastructure gentoo-dev Security 2012-02-12 07:13:40 UTC
Please add this to conf.d/mdadm and test:

rc_checkfs_use="mdraid"
rc_fsck_use="mdraid"
rc_lvm_use="mdraid"
Then add mdraid to the boot runlevel, and rc-update -u.
Comment 2 Lyall Pearce 2012-02-12 10:40:59 UTC
Problem seems to have gone away sometime since I lodged this bug.

I did not need to make the changes you suggested.

However. I do have raid configured, with LVM on the raid, then all my filesystems (except /boot) in LVM.

I notice that mdadm attempts to shutdown prior to the root partition being mounted read-only, and as a result, always complains that a filesystem is in use.

I understand this is a slightly different problem to the one initially described and would be happy to raise a new bug in this regard, if necessary, however it is still about mdadm not being shutdown at the correct time.


[I] sys-apps/openrc
     Available versions:  0.8.3-r1 0.9.4 0.9.8.4 **9999 {debug elibc_glibc kernel_FreeBSD kernel_linux ncurses pam selinux static-libs unicode}
     Installed versions:  0.9.8.4(19:37:55 01/02/12)(elibc_glibc kernel_linux ncurses pam unicode -debug -kernel_FreeBSD -selinux -static-libs)
     Homepage:            http://www.gentoo.org/proj/en/base/openrc/
     Description:         OpenRC manages the services, startup and shutdown of a host

[I] sys-fs/mdadm
     Available versions:  3.1.4!t ~3.1.5!t **3.2.1!t ~3.2.3!t {static}
     Installed versions:  3.1.4!t(10:21:02 20/07/11)(-static)
     Homepage:            http://neil.brown.name/blog/mdadm
     Description:         A useful tool for running RAID systems - it can be used as a replacement for the raidtools

[I] sys-fs/lvm2
     Available versions:  ~2.01.13 ~2.02.67 ~2.02.67-r1 2.02.67-r2 ~2.02.70 ~2.02.70-r1 2.02.72 2.02.73 2.02.73-r1 ~2.02.74 ~2.02.83 ~2.02.84 ~2.02.85 2.02.88 {clvm cman +lvm1 nolvmstatic readline selinux +static +static-libs}
     Installed versions:  2.02.88(19:07:21 28/01/12)(lvm1 readline static static-libs -clvm -cman -selinux)
     Homepage:            http://sources.redhat.com/lvm2/
     Description:         User-land utilities for LVM2 (device-mapper) software.

[I] sys-apps/baselayout
     Available versions:  2.0.3 ~2.1 {build}
     Installed versions:  2.0.3(19:51:56 25/07/11)(-build)
     Homepage:            http://www.gentoo.org/
     Description:         Filesystem baselayout and init scripts


# emerge --info
Portage 2.1.10.44 (default/linux/amd64/10.0/desktop, gcc-4.5.3, glibc-2.13-r4, 3.2.1-gentoo-r2 x86_64)
=================================================================
System uname: Linux-3.2.1-gentoo-r2-x86_64-Intel-R-_Core-TM-2_Quad_CPU_Q9400_@_2.66GHz-with-gentoo-2.0.3
Timestamp of tree: Sat, 11 Feb 2012 00:15:01 +0000
app-shells/bash:          4.1_p9
dev-java/java-config:     2.1.11-r3
dev-lang/python:          2.7.2-r3, 3.1.4-r3
dev-util/cmake:           2.8.6-r4
dev-util/pkgconfig:       0.26
sys-apps/baselayout:      2.0.3
sys-apps/openrc:          0.9.8.4
sys-apps/sandbox:         2.5
sys-devel/autoconf:       2.13, 2.68
sys-devel/automake:       1.9.6-r3, 1.11.1
sys-devel/binutils:       2.21.1-r1
sys-devel/gcc:            4.5.3-r1
sys-devel/gcc-config:     1.4.1-r1
sys-devel/libtool:        2.4-r1
sys-devel/make:           3.82-r1
sys-kernel/linux-headers: 3.1 (virtual/os-headers)
sys-libs/glibc:           2.13-r4
Repositories: java-overlay zugaina sabayon x-local gentoo
ACCEPT_KEYWORDS="amd64"
ACCEPT_LICENSE="* -@EULA"
CBUILD="x86_64-pc-linux-gnu"
CFLAGS="-O2 -ggdb -mtune=native -march=native -pipe"
CHOST="x86_64-pc-linux-gnu"
CONFIG_PROTECT="/etc /lib/udev/rules.d /usr/share/config /usr/share/gnupg/qualified.txt /var/lib/hsqldb"
CONFIG_PROTECT_MASK="/etc/ca-certificates.conf /etc/env.d /etc/env.d/java/ /etc/fonts/fonts.conf /etc/gconf /etc/gentoo-release /etc/php/apache2-php5.3/ext-active/ /etc/php/cgi-php5.3/ext-active/ /etc/php/cli-php5.3/ext-active/ /etc/revdep-rebuild /etc/sandbox.d /etc/terminfo"
CXXFLAGS="-O2 -ggdb -mtune=native -march=native -pipe"
DISTDIR="/portage/gentoo/distfiles"
FEATURES="assume-digests binpkg-logs collision-protect distlocks ebuild-locks fixlafiles news parallel-fetch protect-owned sandbox sfperms splitdebug strict unknown-features-warn unmerge-logs unmerge-orphans userfetch userpriv usersandbox"
FFLAGS=""
GENTOO_MIRRORS="ftp://mirror.internode.on.net/pub/gentoo ftp://mirror.pacific.net.au/linux/Gentoo http://mymirror.asiaosc.org/gentoo/ http://www.zentek-international.com/mirrors/gentoo/ http://open-systems.ufl.edu/mirrors/gentoo http://www.ibiblio.org/pub/Linux/distributions/gentoo"
LANG="en_AU.UTF-8"
LDFLAGS="-Wl,-O1 -Wl,--as-needed"
LINGUAS="en"
MAKEOPTS="-j8"
PKGDIR="/portage/gentoo/packages"
PORTAGE_CONFIGROOT="/"
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="/tmp"
PORTDIR="/portage/gentoo"
PORTDIR_OVERLAY="/portage/local/layman/java-overlay /portage/local/layman/zugaina /portage/local/layman/sabayon /portage/local /portage/gentoo"
SYNC="rsync://mirror.internode.on.net/gentoo-portage"
USE="X a52 aac acl acpi alsa amd64 amr apache2 avahi berkdb bluetooth branding bzip2 cairo cdb cdda cddb cdio cdr cleartype cli consolekit corefonts cracklib crypt css cups cxx daap dbus dri dts dvd dvdr emboss encode exif fam ffmpeg firefox flac fortran gd gdbm gdu gif gpm iconv ipod ipv6 java javascript joystick jpeg jpeg2k kde laptop latin1 lcms lm_sensors mad mikmod mmx mmxext mng modules mp3 mp4 mpeg mplayer mudflap multilib mysql ncurses nls nptl nptlonly nsplugin nvidia ogg opengl openmp oss pam pango pcre pdf perl pmu png policykit posix ppds pppd python qt3support qt4 readline rss samba sdl semantic-desktop server session smp spell sqlite sse sse2 sse3 ssl svg sysfs tcpd threads tiff transcode truetype type1 udev unicode usb v4l v4l2 vcd vorbis wifi wma x264 xcb xcomposite xine xinerama xml xorg xulrunner xv xvid xvmc 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" CALLIGRA_FEATURES="kexi words flow plan stage tables krita karbon braindump" CAMERAS="ptp2" COLLECTD_PLUGINS="df interface irq load memory rrdtool swap syslog" ELIBC="glibc" GPSD_PROTOCOLS="ashtech aivdm earthmate evermore fv18 garmin garmintxt gpsclock itrax mtk3301 nmea ntrip navcom oceanserver oldstyle oncore rtcm104v2 rtcm104v3 sirf superstar2 timing tsip tripmate tnt ubx" INPUT_DEVICES="keyboard mouse evdev" KERNEL="linux" LCD_DEVICES="bayrad cfontz cfontz633 glk hd44780 lb216 lcdm001 mtxorb ncurses text" LINGUAS="en" PHP_TARGETS="php5-3" RUBY_TARGETS="ruby18" USERLAND="GNU" VIDEO_CARDS="nvidia vesa fbdev" XTABLES_ADDONS="quota2 psd pknock lscan length2 ipv4options ipset ipp2p iface geoip fuzzy condition tee tarpit sysrq steal rawnat logmark ipmark dhcpmac delude chaos account"
Unset:  CPPFLAGS, CTARGET, EMERGE_DEFAULT_OPTS, INSTALL_MASK, LC_ALL, PORTAGE_BUNZIP2_COMMAND, PORTAGE_COMPRESS, PORTAGE_COMPRESS_FLAGS, PORTAGE_RSYNC_EXTRA_OPTS
Comment 3 Lyall Pearce 2012-02-12 10:42:36 UTC
Ah, I know what I did wrong, I turned off parallel startup.

Please ignore my previous post about the problem going away.
The closure of mdadm prior to root going read-only still applies, however.
Comment 4 Robin Johnson archtester Gentoo Infrastructure gentoo-dev Security 2012-02-12 20:16:46 UTC
Please test the config options I put in comment 1. You're looking for some variation of those to modify the shutdown order suitably.

The shutdown order should probably be:
localmount
lvm
mdraid
mount-ro

Possibly with an extra phase of taking the RAIDs to read-only device state if they can't be shut down.
Comment 5 Lyall Pearce 2012-02-13 09:26:59 UTC
I changed back to RC_PARALLEL="YES" in /etc/rc.conf and tried rebooting.

The shutdown was a catastrophic failure with shutdowns all in the wrong order.
Startup was barely better, a startup item that was 'after xdm' started before localmount.

Suffice to say, I have reverted to serial startup. It works and other than trying to shut down mdadm prior to remounting root read-only when root is an LVM filesystem on a raid1.
Comment 6 Lyall Pearce 2012-02-13 09:28:02 UTC
This is probably more an openrc bug than a mdadm bug.
Comment 7 Tiger 2012-12-25 23:03:12 UTC
I have a similar behaviour...

Trying your configuration in conf.d/mdadm right now.

I followed this documentation not really up to date http://www.gentoo.org/doc/en/gentoo-x86+raid+lvm2-quickinstall.xml to set up my system. (latest kernel needs 'CONFIG_DM_RAID=y' that is pulled by selecting RAID 4/5/6 + RAID0)

Here is my /etc/fstab :

/dev/md1                /boot                   ext2            noauto,noatime  1 2
/dev/md3                /                       ext3            noatime         0 1
/dev/sda2               none                    swap            sw,pri=1        0 0
/dev/sdb2               none                    swap            sw,pri=1        0 0
/dev/vg/home            /home                   ext3            noatime         1 2
/dev/vg/tmp             /tmp                    ext2            noatime         1 2
/dev/vg/vartmp          /var/tmp                ext2            noatime         1 2
/dev/vg/portage         /usr/portage            ext2            noatime         1 2
/dev/vg/distfiles       /usr/portage/distfiles  ext2            noatime         1 2

I'm using two hard drive with same capacity (1To) and model. I made this system only for testing so it isn't critical at all.

The thing is, at init mdraid show me [!!] while it should be [OK] and this because *I think* lvm didn't start.

For the shutdown like said Lyall, mdraid stops before lvm = volumes present on raid partition are mounted while they shouldn't be.

But another problem could happen if LVM volumes would be others directory like /var

This looks like more complex than we could think.
Comment 8 SpanKY gentoo-dev 2015-04-04 21:57:30 UTC
please set rc_need in your conf.d/mdadm to reflect the services in your setup.  it is not possible for us to write a hardcoded list or reasonably detect the correct order.