Package: initscripts Version: 2.86.ds1-4 Severity: serious Hi, the problem is that a few processes thereby to still be could be terminated, during 'umountfs' and 'umountroot' tries their service to do. That ends then with an error and the file system incorrectly is mostly driven down.
In the attachment there are two patches which repair this problem, by sending a SIGTERM to all processes which access to the filesystems and loop it so long if the services were correctly terminated. The difference between 'umountfs' and 'umountroot' is that for 'umountroot' you need to declare the directories in '/etc/default/umountroot' to sending a SIGTERM. The services which i had tested was 'xconsole' started from 'wdm' and will not terminate by other scripts, the ntpd which needs more time to terminate. There could be other services like a DBMS with big and/or lot of tables which need time to terminate. Better to wait as come in dangerous with an inconsistent FS, DBMS, DB, ... The patch for version "2.86.ds1-11" wasn't tested. -Markus Nass -- Key fingerprint = DC3C 257C 2B71 8FA4 F609 F7F7 7C14 F806 5665 77FD ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Was nicht fliegen kann, kann auch nicht abstürzen. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
diff -ruN old/etc/default/umountroot new/etc/default/umountroot --- old/etc/default/umountroot 1970-01-01 01:00:00.000000000 +0100 +++ new/etc/default/umountroot 2006-01-26 22:23:32.000000000 +0100 @@ -0,0 +1,8 @@ +# List of directories which will use by fuser(1) '/etc/init.d/unmountroot'. +# +# This is usefull if you have directories which processes work in it +# and the rootfs can't mount readonly. +# +# The directories must seperate with an ' ' and the list self in '"'. + +#DIRS="/home /usr /var" diff -ruN old/etc/init.d/umountfs new/etc/init.d/umountfs --- old/etc/init.d/umountfs 2005-09-10 15:30:45.000000000 +0200 +++ new/etc/init.d/umountfs 2006-01-26 21:08:44.000000000 +0100 @@ -11,6 +11,8 @@ # # Version: @(#)umountfs 2.85-16 03-Jun-2004 [EMAIL PROTECTED] # +# Modified by Markus Nass <[EMAIL PROTECTED]> (see line 25-33) +# PATH=/sbin:/bin:/usr/sbin:/usr/bin umask 022 @@ -20,6 +22,16 @@ # Umount all filesystems except root and the virtual ones log_begin_msg "Unmounting local filesystems..." + mount | awk '/^\/dev/ { print $3 }' | egrep -v "^\/$" | \ + while read line; do + N=1 + while [[ `fuser -m $line 2>&1` != "" ]]; do + fuser -m -SIGTERM -k $line > /dev/null 2>&1 + sleep $N + let N++ + done + done + # List all mounts, deepest mount point first LANG=C sort -r -k 2 /etc/mtab | ( diff -ruN old/etc/init.d/umountroot new/etc/init.d/umountroot --- old/etc/init.d/umountroot 2005-09-10 12:30:30.000000000 +0200 +++ new/etc/init.d/umountroot 2006-01-26 22:20:14.000000000 +0100 @@ -8,18 +8,33 @@ # Short-Description: Mount the root filesystem read-only. ### END INIT INFO # -# v 0.1, localtime: 2005/07/06 19:00 CEST +# v 0.2, localtime: 2006/01/26 21:09 CEST # # Written by Markus Nass <[EMAIL PROTECTED]> # +# Modified for Debian GNU/Linux +# PATH=/sbin:/bin [ -z "$VERBOSE" ] && VERBOSE=yes [ -f /etc/default/rcS ] && . /etc/default/rcS . /lib/lsb/init-functions +. /etc/default/umountroot do_stop () { + if [[ "$DIRS" != "" ]]; then + echo "$DIRS" | \ + while read line; do + N=1 + while [[ `fuser $line 2>&1` != "" ]]; do + fuser -SIGTERM -k $line > /dev/null 2>&1 + sleep $N + let N++ + done + done + fi + [ "$VERBOSE" != no ] && log_begin_msg "Mounting root filesystem read-only..." mount -n -o remount,ro / [ "$VERBOSE" != no ] && log_end_msg $?
diff -ruN old/etc/default/umountroot new/etc/default/umountroot --- old/etc/default/umountroot 1970-01-01 01:00:00.000000000 +0100 +++ new/etc/default/umountroot 2006-01-26 22:23:32.000000000 +0100 @@ -0,0 +1,8 @@ +# List of directories which will use by fuser(1) '/etc/init.d/unmountroot'. +# +# This is usefull if you have directories which processes work in it +# and the rootfs can't mount readonly. +# +# The directories must seperate with an ' ' and the list self in '"'. + +#DIRS="/home /usr /var" diff -ruN old/etc/init.d/umountfs new/etc/init.d/umountfs --- old/etc/init.d/umountfs 2006-01-22 20:50:11.000000000 +0100 +++ new/etc/init.d/umountfs 2006-01-26 22:18:16.000000000 +0100 @@ -8,6 +8,7 @@ # Short-Description: Turn off swap and unmount all local file systems. # Description: ### END INIT INFO +# Modified by Markus Nass <[EMAIL PROTECTED]> (see line 21-29) PATH=/usr/sbin:/usr/bin:/sbin:/bin . /lib/init/vars.sh @@ -17,6 +18,16 @@ umask 022 do_stop () { + cat /proc/mounts | awk '/^\/dev/ { print $2 }' | egrep -v "^\/$" | \ + while read line; do + N=1 + while [[ `fuser -m $line 2>&1` != "" ]]; do + fuser -m -SIGTERM -k $line > /dev/null 2>&1 + sleep $N + let N++ + done + done + # Make sure tmpfs file systems are umounted before turning off # swap, to avoid running out of memory if the tmpfs filesystems # use a lot of space. diff -ruN old/etc/init.d/umountroot new/etc/init.d/umountroot --- old/etc/init.d/umountroot 2006-01-12 12:13:50.000000000 +0100 +++ new/etc/init.d/umountroot 2006-01-26 22:23:15.000000000 +0100 @@ -7,13 +7,28 @@ # Default-Stop: # Short-Description: Mount the root filesystem read-only. ### END INIT INFO +# Modified by Markus Nass <[EMAIL PROTECTED]> (see line 20-30) PATH=/sbin:/bin . /lib/init/vars.sh . /lib/lsb/init-functions +. /etc/default/umountroot + do_stop () { + if [[ "$DIRS" != "" ]]; then + echo "$DIRS" | \ + while read line; do + N=1 + while [[ `fuser $line 2>&1` != "" ]]; do + fuser -SIGTERM -k $line > /dev/null 2>&1 + sleep $N + let N++ + done + done + fi + [ "$VERBOSE" = no ] || log_action_begin_msg "Mounting root filesystem read-only" MOUNT_FORCE_OPT= [ "$(uname -s)" = "GNU/kFreeBSD" ] && MOUNT_FORCE_OPT=-f
signature.asc
Description: Digital signature