[Virtual-pkg-base-maintainers] Bug#705031: base: netdev boot sequence problem and possible fix
Dennis Leeuw
d.leeuw at umcutrecht.nl
Tue Apr 9 07:18:20 UTC 2013
Package: base
Severity: important
When using iSCSI devices with multipathd, the open-iscsi boot script is started before multipathd, hence the system tries to mount _netdev devices before multipath is up-and-running. Thus my iSCSI devices are not mounted at boot time and need thus be mounted manualy, which is not a handy thing to do for /home
I created a new script called /etc/init.d/mountnetdev, which can be run with start|stop to mount/umount all _netdev devices or one can use the stop with a subsystem to stop only part of the mounts.
One important note: the script is in a very early stage, and still requires bash since dash does not support ${var:x:y}. In the open-iscsi script I replaced umountiscsi.sh with: mountnetdev stop iscsi
In /etc/rc2.d I created a symlink S23z-mountnetdev so the script is started at boot after all _netdev required daemons are started.
Hope this helps to make Debian an even better distro.
Greetings,
Dennis Leeuw
Script:
#! /bin/bash
### BEGIN INIT INFO
# Provides: mountnetdev
# Required-Start:
# Required-Stop:
# Should-Start: $network
# Default-Start: S
# Default-Stop:
# Short-Description: Wait for network file systems to be mounted
# Description: Mount and umount _netdev marked filesystems
### END INIT INFO
. /lib/init/vars.sh
. /lib/lsb/init-functions
do_stop_subsys() {
local mountpnt=""
local device=""
local syspath=""
case $1 in
iscsi)
# It can be a multipath device
# a LVM device
# a plain ISCSI disk
# FIXME make sure /etc/fstab is there
for mountpnt in `grep _netdev /etc/fstab | cut -d' ' -f1 | cut -d" " -f1`; do
# Strip trailing /
device=${mountpnt%/}
# Strip path
device=${device##*/}
# Strip part
device=${device%-*}
# Check to see if it is a multipath device, very basic check
if [ "${device:0:5}" = "mpath" ]; then
# It's a multipath device: get the active path's disk
device=`multipath -l $device | grep -A1 status=active | tail -1 | cut -d' ' -f4`
fi
# FIXME make sure /sys/ is mounted
# Find the disk in /sys/
syspath=`find /sys/ -name "$device"`
syspath=${syspath%/session*}
# See if it has iscsi_host set
if [ -e ${syspath}/iscsi_host ]; then
log_daemon_msg "Unmounting iscsi filesystem ${mountpnt}"
UMOUNT_RESULT=1
if umount ${mountpnt} >/dev/null 2>&1; then
UMOUNT_RESULT=0
fi
log_end_msg $UMOUNT_RESULT
fi
done
;;
esac
}
case "$1" in
start)
# Let's mount
log_daemon_msg "Mounting _netdev filesystems"
MOUNT_RESULT=1
if mount -a -O _netdev >/dev/null 2>&1; then
MOUNT_RESULT=0
fi
log_end_msg $MOUNT_RESULT
;;
restart|reload|force-reload)
echo "Error: argument '$1' not supported" >&2
exit 3
;;
stop)
if [ "$2" = "" ]; then
# Let's umount
log_daemon_msg "Unmounting _netdev filesystems "
UMOUNT_RESULT=1
if umount -a -O _netdev >/dev/null 2>&1; then
UMOUNT_RESULT=0
fi
log_end_msg $UMOUNT_RESULT
else
do_stop_subsys $2
fi
;;
*)
echo "Usage: $0 start|stop" >&2
exit 3
;;
esac
: exit 0
-- System Information:
Debian Release: 6.0.7
APT prefers stable-updates
APT policy: (500, 'stable-updates'), (500, 'stable')
Architecture: amd64 (x86_64)
Kernel: Linux 2.6.32-5-amd64 (SMP w/4 CPU cores)
Locale: LANG=en_GB.UTF-8, LC_CTYPE=en_GB.UTF-8 (charmap=UTF-8)
Shell: /bin/sh linked to /bin/dash
------------------------------------------------------------------------------
De informatie opgenomen in dit bericht kan vertrouwelijk zijn en is
uitsluitend bestemd voor de geadresseerde. Indien u dit bericht onterecht
ontvangt, wordt u verzocht de inhoud niet te gebruiken en de afzender direct
te informeren door het bericht te retourneren. Het Universitair Medisch
Centrum Utrecht is een publiekrechtelijke rechtspersoon in de zin van de W.H.W.
(Wet Hoger Onderwijs en Wetenschappelijk Onderzoek) en staat geregistreerd bij
de Kamer van Koophandel voor Midden-Nederland onder nr. 30244197.
Denk s.v.p aan het milieu voor u deze e-mail afdrukt.
------------------------------------------------------------------------------
This message may contain confidential information and is intended exclusively
for the addressee. If you receive this message unintentionally, please do not
use the contents but notify the sender immediately by return e-mail. University
Medical Center Utrecht is a legal person by public law and is registered at
the Chamber of Commerce for Midden-Nederland under no. 30244197.
Please consider the environment before printing this e-mail.
More information about the Virtual-pkg-base-maintainers
mailing list