Subject: sysvinit: FIX for (some) fsck/loopback problems
Date: Tue, 12 Mar 2002 18:55:43 +0000
Package: sysvinit
Version: 2.84-2
Severity: normal
On system start up, the following run on my system (amongst others):
S10checkroot.sh
S30checkfs.sh
S35mountall.sh
S45mountnfs.sh
After these have run, all my filesystems should be up.
There is a problem with loopback filesystems that are wanted automounted
during boot. S30checkfs.sh can't check them unless they live on the
root filesystem!
FIX: add "opts=noloop" to S30checkfs.sh
Now we have a further problem with S35mountall.sh. It really shouldn't
mount loopback filesystems - they might be living on the network
(really, they _might_ - they're just normal files, after all). Sadly,
there's no easy way to tell "mount -a" to skip lookback files (maybe an
"opts=" for "mount -t" is needed). So, I had to really mess with the
script. I'm not happy with the result (tacked onto the end of this
report) but it works reliably _for me_.
FIX: Use my mountall.sh script instead.
Okay, we're no longer checking or mounting loopback file systems at all
at boot time. Hmmm...!
FIX: Two more scripts, checkloop.sh and mountloop.sh
(Which, oddly enough, check loopback file systems and mount them.) I
have these as S46checkloop.sh and S47mountloop.sh in /etc/rcS.d so they
run after the network filesystems are up. See below.
-- Peter
-- System Information
Debian Release: 3.0
Architecture: i386
Kernel: Linux advent 2.4.19-pre2-rmap12g #2 Sat Mar 9 19:24:23 GMT 2002 i686
Locale: LANG=C, LC_CTYPE=C
Versions of packages sysvinit depends on:
hi dpkg 1.9.19 Package maintenance system for Deb
ii e2fsprogs 1.26-3 The EXT2 file system utilities and
hi libc6 2.2.5-3 GNU C Library: Shared libraries an
hi mount 2.11n-4 Tools for mounting and manipulatin
hi util-linux 2.11n-4 Miscellaneous system utilities.
____CUT1_mountall.sh_____
#
# mountall.sh Mount all filesystems.
#
# Version: @(#)mountall.sh 2.83-2 01-Nov-2001 [email protected]
#
. /etc/default/rcS
#
# Mount local file systems in /etc/fstab. For some reason, people
# might want to mount "proc" several times, and mount -v complains
# about this. So we mount "proc" filesystems without -v.
#
# Loopback mounts will need fsck-ing later so we don't want them
# mounted now. There's no easy way to do this, unfortunately.
#
[ "$VERBOSE" != no ] && echo "Mounting local filesystems..."
#mount -avt nonfs,nosmbfs,noncpfs,noproc
while read dev mp type opts d f; do
case "$dev" in
\#*|"") continue ;;
esac
case "$mp" in
/) continue ;;
esac
case "$opts" in
*noauto*|*loop*) continue ;;
esac
case "$type" in
swap|proc|nfs|smbfs|ncpfs|proc) continue ;;
esac
mount -v $mp
done < /etc/fstab
mount -at proc
#
# We might have mounted something over /dev, see if /dev/initctl is there.
#
if [ ! -p /dev/initctl ]
then
rm -f /dev/initctl
mknod -m 600 /dev/initctl p
fi
kill -USR1 1
#
# Execute swapon command again, in case we want to swap to
# a file on a now mounted filesystem.
#
doswap=yes
case "`uname -r`" in
2.[0123].*)
if grep -qs resync /proc/mdstat
then
doswap=no
fi
;;
esac
if [ $doswap = yes ]
then
swapon -a 2> /dev/null
fi
: exit 0
____CUT1_mountall.sh_____ENDS
..
..
..
..
..
____CUT2_checkloop.sh_____
#
# checkloop.sh Check loopback filesystems.
#
# Version: @(#)checkfs 2.83 05-Oct-2001 [email protected]
#
. /etc/default/rcS
#
# Check the loopback file systems.
#
if [ "$FSCKFIX" = yes ]
then
fix="-y"
else
fix="-a"
fi
spinner="-C"
case "$TERM" in
dumb|network|unknown|"") spinner="" ;;
esac
[ `uname -m` = s390 ] && spinner="" # This should go away
echo "Checking all file systems..."
fsck $spinner -R -A $fix $force -t opts=loop
if [ $? -gt 1 ]
then
echo
echo "fsck failed. Please repair manually."
echo
echo "CONTROL-D will exit from this shell and continue system startup."
echo
# Start a single user shell on the console
/sbin/sulogin $CONSOLE
fi
: exit 0
____CUT2_checkloop.sh_____ENDS
..
..
..
..
..
____CUT2_mountloop.sh_____
#
# mountloop.sh Mount loop filesystems.
#
# Version: @(#)mountloop.sh
#
. /etc/default/rcS
#
[ "$VERBOSE" != no ] && echo "Mounting loopback filesystems..."
while read dev mp type opts d f; do
case "$dev" in
\#*|"") continue ;;
esac
case "$opts" in
*noauto*) continue ;;
*loop*) ;;
*) continue ;;
esac
if ! grep "$dev $mp $type" /proc/mounts > /dev/null; then
mount -v $mp
fi
done < /etc/fstab
: exit 0
____CUT2_mountloop.sh_____ENDS
Debbugs is free software and licensed under the terms of the GNU General
Public License version 2. The current version can be obtained
from https://bugs.debian.org/debbugs-source/.