Mailinglist Archive: opensuse (1108 mails)

< Previous Next >
Re: [opensuse] Using e2fsck in, eg, Leap 15.0
On 2018-08-22 16:28, Andrei Borzenkov wrote:
22.08.2018 15:37, Per Jessen пишет:
Andrei Borzenkov wrote:

22.08.2018 14:17, Carlos E. R. пишет:

But Basil (and you?) says that fsck can't check root on init 1, and
you say you can on init S, so they are not the same.


You cannot use fsck on mounted filesystem. Period.

When it's mounted read-only? I'm sure I did that just yesterday.



It won't prevent you from shooting yourself in the foot, that's right.

You cannot change mounted filesystem, read-only or not, which means to
actually fix it (assuming fsck reports errors) you need to unmount it
anyway. So you just wasted your time. If you want to fsck, you do it
before mounting, not after.

And in any case, it has nothing to do with runlevel, so any bickering
about 1 vs. S is entirely off mark.


No. The old init system did run fsck of "/" as part of initialization, and did
repair it, automatically. I can find out the script that did that ... Here:

Eleanor6:~ # cat /etc/SuSE-release
openSUSE 11.4 (x86_64)
VERSION = 11.4
CODENAME = Celadon
Eleanor6:~ #


/etc/init.d/boot.rootfsck



The test was forced if "/forcefsck" existed. To test for that file it had to
mount the filesystem first.
See how the code remounts it r/o below, then runs the fsck:


if test ! -f /fastboot -a "$DO_FASTBOOT" != "yes" -a $MAY_FSCK -eq 1 ;
then
# If we use a serial console, don't use the fsck progress bar
if test "${REDIRECT##*/}" = "tty1" ; then
FSCK_OPTS="$FSCK_OPTS -C"
else
FSCK_OPTS="$FSCK_OPTS -V"
fi
# on an umsdos root fs this mount will fail,
# so direct error messages to /dev/null.
# this seems to be ugly, but should not really be a problem.
mount -n -o remount,ro / 2> /dev/null
if test $? = 0; then
if test -n "$ROOTFS_FSCK" ; then
FSCK_RETURN=$ROOTFS_FSCK
else
echo "Checking root file system..."
fsck $FSCK_OPTS $ROOTFS_BLKDEV
# A return code of 1 indicates that file system errors
# were corrected, but that the boot may proceed.
# A return code of 2 or larger indicates failure.
FSCK_RETURN=$?
fi



On some circumstances, it asked the operator to do it manually:


elif test $FSCK_RETURN -gt 3; then
# if appropriate, switch bootsplash to verbose
# mode to make text messages visible.
test -f /proc/splash && echo "verbose" > /proc/splash
# Stop blogd since we reboot after sulogin
test -x /sbin/blogd && killproc -QUIT /sbin/blogd
if test -x /etc/init.d/kbd ; then
/etc/init.d/kbd start
fi
echo
echo "fsck failed. Please repair manually and reboot. The
root"
echo "file system is currently mounted read-only. To
remount it"
echo "read-write do:"
echo
echo " bash# mount -n -o remount,rw /"
echo
echo "Attention: Only CONTROL-D will reboot the system in
this"
echo "maintanance mode. shutdown or reboot will not work."
echo
PS1="(repair filesystem) # "
export PS1
/sbin/sulogin /dev/console

# if the user has mounted something rw, this should be
umounted
echo "Unmounting file systems (ignore error messages)"
umount -avn

# on umsdos fs this would lead to an error message.
# so direct errors to /dev/null
mount -no remount,ro / 2> /dev/null
mount -no remount,ro / 2> /dev/null

sync
reboot -f
fi
sync




--
Cheers / Saludos,

Carlos E. R.
(from 42.3 x86_64 "Malachite" at Telcontar)

< Previous Next >
Follow Ups