Joel
I have been trying a few things, can't get this to reboot with the root FS
as rw.
I have attached my original checkroot.fs which you sugested be edited
following your instructions below (Attached email).
I have provided the unedited version.
Regards
James
------------------------- Begin Paste --------------------------------------
#
# checkroot.sh  Check to root file system.
#
# Version:      @(#)checkroot.sh  2.85-21  18-Jun-2004  [EMAIL PROTECTED]
#

SULOGIN=no
VERBOSE=yes
[ -f /etc/default/rcS ] && . /etc/default/rcS

PATH=/lib/init:/bin:/sbin

#
#       Helper: is a directory writable ?
#
dir_writable () {
        if [ -d "$1/" ] && [ -w "$1/" ] && touch -a "$1/" 2>/dev/null
        then
                return 0
        fi
        return 1
}

#
#       Set SULOGIN in /etc/default/rcS to yes if you want a sulogin to
#       be spawned from this script *before anything else* with a timeout,
#       like sysv does.
#
[ "$SULOGIN" = yes ] && sulogin -t 30 $CONSOLE

KERNEL=`uname -s`
RELEASE=`uname -r`
MACHINE=`uname -m`

#
#       Ensure that bdflush (update) is running before any major I/O is
#       performed (the following fsck is a good example of such activity :).
#       Only needed for kernels < 2.4.
#
if [ -x /sbin/update ] && [ "$KERNEL" = Linux ]
then
        case "$RELEASE" in
                0.*|1.*|2.[0123].*)
                        update
                ;;
        esac
fi

#
#       Read /etc/fstab.
#
exec 9>&0 </etc/fstab
fstabroot=/dev/root
rootdev=none
roottype=none
rootopts=defaults
rootmode=rw
rootcheck=no
swap_on_md=no
devfs=
while read dev mnt type opts dump pass junk
do
        case "$dev" in
                ""|\#*)
                        continue;
                        ;;
                /dev/md*)
                        # Swap on md device.
                        [ "$type" = swap ] && swap_on_md=yes
                        ;;
                /dev/*)
                        ;;
                *)
                        # Devfs definition ?
                        if [ "$type" = "devfs" ] && [ "$mnt" = /dev ] &&
                           mountpoint -q /dev
                        then
                                devfs="-t $type $dev $mnt"
                        fi

                        # Might be a swapfile.
                        [ "$type" = swap ] && swap_on_md=yes
                        ;;
        esac
        [ "$mnt" != / ] && continue
        rootdev="$dev"
        fstabroot="$dev"
        rootopts="$opts"
        roottype="$type"
        ( [ "$pass" != 0 ] && [ "$pass" != "" ]   ) && rootcheck=yes
        ( [ "$type" = nfs ] || [ "$type" = nfs4 ] ) && rootcheck=no
        case "$opts" in
                ro|ro,*|*,ro|*,ro,*)
                        rootmode=ro
                        ;;
        esac
done
exec 0>&9 9>&-

#
#       Activate the swap device(s) in /etc/fstab. This needs to be done
#       before fsck, since fsck can be quite memory-hungry.
#
doswap=no
case "${KERNEL}:${RELEASE}" in
        Linux:2.[0123].*)
                if [ $swap_on_md = yes ] && grep -qs resync /proc/mdstat
                then
                        [ "$VERBOSE" != no ] &&
                          echo "Not activating swap - RAID array resyncing"
                else
                        doswap=yes
                fi
                ;;
        *)
                doswap=yes
                ;;
esac
if [ "$doswap" = yes ]
then
        [ "$VERBOSE" != no ] && echo "Activating swap."
        swapon -a 2> /dev/null
fi

#
#       Does the root device in /etc/fstab match with the actual device ?
#       If not we try to use the /dev/root alias device, and if that
#       fails we create a temporary node in /dev/shm.
#
if [ "$rootcheck" = yes ]
then
        ddev=`mountpoint -qx $rootdev`
        rdev=`mountpoint -d /`
        if [ "$ddev" != "$rdev" ] && [ "$ddev" != "4:0" ]
        then
                if [ "`mountpoint -qx /dev/root`" = "4:0" ]
                then
                        rootdev=/dev/root
                elif dir_writable /dev/shm
                then
                        rm -f /dev/shm/root
                        mknod -m 600 /dev/shm/root b ${rdev%:*} ${rdev#*:}
                        rootdev=/dev/shm/root
                else
                        rootfatal=yes
                fi
        fi
fi

#
#       Bother, said Pooh.
#
if [ "$rootfatal" = yes ]
then
        echo
        echo "The device node $rootdev for the root filesystem is missing,"
        echo "incorrect, or there is no entry for the root filesystem"
        echo "listed in /etc/fstab."
        echo
        echo "The system is also unable to create a temporary node in"
        echo "/dev/shm to use as a work-around."
        echo
        echo "This means you have to fix this manually."
        echo
        echo "CONTROL-D will exit from this shell and REBOOT the system."
        echo
        # Start a single user shell on the console
        /sbin/sulogin $CONSOLE
        reboot -f
fi

#
#       See if we want to check the root file system.
#
FSCKCODE=0
if [ -f /fastboot ] || [ $rootcheck = no ]
then
        [ $rootcheck = yes ] && echo "Fast boot, no file system check"
        rootcheck=no
fi

if [ "$rootcheck" = yes ]
then
        #
        # Ensure that root is quiescent and read-only before fsck'ing.
        #
        if ! mount -n -o remount,ro $rootdev /
        then
                echo -n "*** ERROR!  Cannot fsck root fs because it is "
                echo    "not mounted read-only!"
                echo
                rootcheck=no
        fi
fi

#
#       The actual checking is done here.
#
if [ "$rootcheck" = yes ]
then
        if [ -f /forcefsck ]
        then
                force="-f"
        else
                force=""
        fi

        if [ "$FSCKFIX" = yes ]
        then
                fix="-y"
        else
                fix="-a"
        fi

        spinner="-C"
        case "$TERM" in
                dumb|network|unknown|"")
                        spinner="" ;;
        esac
        # This Linux/s390 special case should go away.
        if [ "${KERNEL}:${MACHINE}" = Linux:s390 ]
        then
                spinner=""
        fi

        echo "Checking root file system..."
        fsck $spinner $force $fix -t $roottype $rootdev
        FSCKCODE=$?
fi

#
#       If there was a failure, drop into single-user mode.
#
#       NOTE: "failure" is defined as exiting with a return code of
#       4 or larger.  A return code of 1 indicates that file system
#       errors were corrected but that the boot may proceed. A return
#       code of 2 or 3 indicates that the system should immediately reboot.
#
if [ $FSCKCODE -gt 3 ]
then
        # Surprise! Re-directing from a HERE document (as in
        # "cat << EOF") won't work, because the root is read-only.
        echo
        echo "fsck failed.  Please repair manually and reboot.  Please note"
        echo "that the root file system is currently mounted read-only.  To"
        echo "remount it read-write:"
        echo
        echo "   # mount -n -o remount,rw /"
        echo
        echo "CONTROL-D will exit from this shell and REBOOT the system."
        echo
        # Start a single user shell on the console
        /sbin/sulogin $CONSOLE
        reboot -f
elif [ $FSCKCODE -gt 1 ]
then
        echo
        echo "fsck corrected errors on the root partition, but requested that"
        echo "the system be rebooted (exit code $FSCKCODE)."
        echo
        echo "Automatic reboot in 5 seconds."
        echo
        sleep 5
        reboot -f
fi

#
#       Remount root to final mode (rw or ro).
#
mount -n -o remount,$rootopts,$rootmode $fstabroot /

#
#       We only create/modify /etc/mtab if the location where it is
#       stored is writable.  If /etc/mtab is a symlink into /proc/
#       then it is not writable.
#
init_mtab=no
MTAB_PATH="`readlink -f /etc/mtab || :`"
case "$MTAB_PATH" in
        /proc/*)
                ;;
        /*)
                if dir_writable ${MTAB_PATH%/*}
                then
                        :> $MTAB_PATH
                        rm -f ${MTAB_PATH}~
                        init_mtab=yes
                fi
                ;;
        "")
                echo "checkroot.sh: cannot initialize $MTAB_PATH" >&2
                ;;
esac

if [ "$init_mtab"  = yes ]
then
        [ "$roottype" != none ] && mount -f -o $rootopts $fstabroot /
        [ -n "$devfs" ] && mount -f $devfs
        . /etc/init.d/mountvirtfs
fi

#
#       Remove /etc/nologin, and /dev/shm/root if we created it.
#
NOLOGIN="`readlink -f /etc/nologin || :`"
rm -f "$NOLOGIN"
rm -f /dev/shm/root

: exit 0
---------------------------------------End
Paste -------------------------------------

-----Original Message-----
From: Joel Soete [mailto:[EMAIL PROTECTED]
Sent: 15 July 2004 15:05
To: James Morris; Thibaut VARENE
Cc: debian-hppa@lists.debian.org
Subject: RE: Disaster strikes


Hello James,

Sorry for late answer but I was worry about the new Randolph patch for the
N4k discontigous mm :-$

>
>
> Thanks Thibaut, I guess I will keep an eye out for a fix but until then
I
> will do what you suggest.

umm Thibaut seems to confirm the same pb I mentioned :)
and you could try it's tips but iirc it will not works (device busy :( )

Any way you have right: I forgot a lot of details.

For my part it was a external disk which I can mount on another parisc-linux
box to re-install previous initscript dpkg; then reboot, update patch the
kernel (sorry I don't have enough time to check if 2.4 included the willy's
patch) and re-install new initscript dpkg. (and last reboot to check the
patch efficiency :) )

OTC if it's an internal disk, it would be more helpfull to reboot from your
install cd and from the install menu launch a shell
(if you need you can have a look at
<http://lists.debian.org/debian-hppa/2004/06/msg00017.html>
where I explain in detail howto).
at this place create a /MNT dir on wish you can mount your root fs (mount
/dev/sda2 /MNT)

edit your /MNT/etc/init.d/checkroot.sh (pay attention vi doesn't exist on
your cd ramdisk but well nano :) )
and apply the tips I mentioned here
<http://lists.debian.org/debian-hppa/2004/03/msg00070.html>
(in essence insert '-t $roottype' in all mount cmd).

Here you would be able to reboot on your hd to update your kernel.

pff... less trivial then I remember, once again apologies but it was so
far ;)
That said if something is not yet clear don't hesitate to come back :)

hth,
    Joel

PS: I was surprised that you were able to run a smp kernel on a N model,
hoppefully only one cpu exists or is configured :).


---------------------------------------------------------------------------
Tiscali ADSL LIGHT, 19,95 EUR/mois pendant 6 mois, c'est le moment de faire
le pas!
http://reg.tiscali.be/default.asp?lg=fr




--
To UNSUBSCRIBE, email to [EMAIL PROTECTED]
with a subject of "unsubscribe". Trouble? Contact
[EMAIL PROTECTED]




Reply via email to