From 94f6d10badacc7f9b019ae7ca687d78cd09b8b17 Mon Sep 17 00:00:00 2001 From: Arne Fitzenreiter Date: Tue, 23 Nov 2010 14:04:49 +0100 Subject: [PATCH] Add emergency shell if filesystem check fail. Fix checkfstab for UUID entries. --- src/initscripts/init.d/checkfs | 10 ++++------ src/initscripts/init.d/checkfstab | 11 ++++++++++- 2 files changed, 14 insertions(+), 7 deletions(-) diff --git a/src/initscripts/init.d/checkfs b/src/initscripts/init.d/checkfs index f31390de95..1127099e06 100644 --- a/src/initscripts/init.d/checkfs +++ b/src/initscripts/init.d/checkfs @@ -98,19 +98,17 @@ case "${1}" in if [ "${error_value}" -gt 3 -a "${error_value}" -lt 16 ]; then echo_failure + sleep 2 boot_mesg -n "FAILURE:\n\nFile system errors" ${FAILURE} boot_mesg -n " were encountered that could not be" boot_mesg -n " fixed automatically. This system" boot_mesg -n " cannot continue to boot and will" boot_mesg -n " therefore be halted until those" boot_mesg -n " errors are fixed manually by a" - boot_mesg -n " System Administrator.\n\nAfter you" - boot_mesg -n " press Enter, this system will be" - boot_mesg -n " halted and powered off." - boot_mesg -n "\n\nPress Enter to continue or wait a minute..." ${INFO} + boot_mesg -n " System Administrator.\n\n" boot_mesg "" ${NORMAL} - read -t 60 ENTER - ${rc_base}/init.d/halt stop + sulogin + reboot -f fi if [ "${error_value}" -ge 16 ]; then diff --git a/src/initscripts/init.d/checkfstab b/src/initscripts/init.d/checkfstab index 2fe80bf31d..691050ef03 100644 --- a/src/initscripts/init.d/checkfstab +++ b/src/initscripts/init.d/checkfstab @@ -25,7 +25,7 @@ case "${1}" in read CMDLINE < /proc/cmdline ROOTPOS=`expr index "$CMDLINE" root=` NEWROOT=`echo ${CMDLINE:$ROOTPOS} | cut -d"=" -f2 | cut -d" " -f1`; - OLDBOOT=`cat /etc/fstab | grep -m1 "/boot" | cut -d" " -f1 | cut -f1`; + OLDBOOT=`cat /etc/fstab | grep -m1 " / " | cut -d" " -f1 | cut -f1`; OLDDRV=${OLDBOOT::`expr length $OLDBOOT`-1} NEWDRV=${NEWROOT::`expr length $NEWROOT`-1} if [ "$OLDDRV" == "$NEWDRV" ]; then @@ -38,6 +38,15 @@ case "${1}" in boot_mesg "Bootdrive: $NEWDRV" boot_mesg "fstab-entry: $OLDDRV" boot_mesg + if [ "${OLDDRV:0:4}" == "UUID" ]; then + #Short sleep because the kernel has not finished hardware detections + #and made many messages here and the password question is not readable + sleep 3 + boot_mesg "${FAILURE}Error OLD Bootdrive is already a UUID. Can't fix." + boot_mesg "${NORMAL}" + sulogin + reboot -f + fi boot_mesg "Attempt to repair it ..." mount -o remount,rw / sed -i -e "s|$OLDDRV|$NEWDRV|g" /etc/fstab -- 2.39.2