public inbox for gentoo-user@lists.gentoo.org
 help / color / mirror / Atom feed
* [gentoo-user] Failed to start /etc/init.d/checkroot
@ 2009-04-26 11:31 Chuanwen Wu
  2009-04-26 14:09 ` Mike Kazantsev
  0 siblings, 1 reply; 3+ messages in thread
From: Chuanwen Wu @ 2009-04-26 11:31 UTC (permalink / raw
  To: gentoo-user

[-- Attachment #1: Type: text/plain, Size: 4855 bytes --]

Hi,
My gentoo failed to boot up. When my gentoo is booting up, after the message

"mounting devpts at /dev/pts     OK",
then it just stoped, and then I pressed "CTRL + c" to interrupt it, and the
message:
"Failed to start /etc/init.d/checkroot“ appeared.

I have checked the file /etc/init.d/checkroot, and I am sure it's the same
with another checkroot file which is in another normal gentoo(I used 'diff'
to compare).
Here is the file '/etc/init.d/checkroot':

/****************************************************/
# cat /etc/init.d/checkroot
#!/sbin/runscript
# Copyright 1999-2007 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2

depend() {
    before *
}

start() {
    local retval=0

    if [[ ! -f /fastboot && -z ${CDBOOT} ]] \
    && ! is_net_fs / && ! is_union_fs / ; then
        if touch -c / >& /dev/null ; then
            ebegin "Remounting root filesystem read-only"
            mount -n -o remount,ro /
            eend $?
        fi

        if [[ -f /forcefsck ]] || get_bootparam "forcefsck" ; then
            ebegin "Checking root filesystem (full fsck forced)"
            fsck -C -a -f /
            # /forcefsck isn't deleted because checkfs needs it.
            # it'll be deleted in that script.
            retval=$?
        else
            # Obey the fs_passno setting for / (see fstab(5))
            # - find the / entry
            # - make sure we have 6 fields
            # - see if fs_passno is something other than 0
            if [[ -n $(awk '($1 ~ /^(\/|UUID|LABEL)/ && $2 == "/" \
                            && NF == 6 && $6 != 0) { print }' /etc/fstab) ]]
            then
                ebegin "Checking root filesystem"
                fsck -C -T -a /
                retval=$?
            else
                ebegin "Skipping root filesystem check (fstab's passno ==
0)"
                retval=0
            fi
        fi

        if [[ ${retval} -eq 0 ]] ; then
            eend 0
        elif [[ ${retval} -eq 1 ]] ; then
            ewend 1 "Filesystem repaired"
        elif [[ ${retval} -eq 2 || ${retval} -eq 3 ]] ; then
            ewend 1 "Filesystem repaired, but reboot needed!"
            if [[ ${RC_FORCE_AUTO} != "yes" ]] ; then
                echo -ne "\a"; sleep 1; echo -ne "\a"; sleep 1
                echo -ne "\a"; sleep 1; echo -ne "\a"; sleep 1
                ewarn "Rebooting in 10 seconds ..."
                sleep 10
            fi
            einfo "Rebooting"
            /sbin/reboot -f
        else
            if [[ ${RC_FORCE_AUTO} == "yes" ]] ; then
                eend 2 "Rerunning fsck in force mode"
                fsck -y -C -T /
            else
                eend 2 "Filesystem couldn't be fixed :("
                sulogin ${CONSOLE}
            fi
            einfo "Unmounting filesystems"
            /bin/mount -a -o remount,ro &> /dev/null
            einfo "Rebooting"
            /sbin/reboot -f
        fi
    fi

    # Should we mount root rw ?  the touch check is to see if the / is
    # already mounted rw in which case there's nothing for us to do
    if mount -vf -o remount / 2> /dev/null | \
       awk '{ if ($6 ~ /rw/) exit 0; else exit 1; }' && \
       ! touch -c / >& /dev/null
    then
        ebegin "Remounting root filesystem read/write"
        mount -n -o remount,rw / &> /dev/null
        if [[ $? -ne 0 ]] ; then
            eend 2 "Root filesystem could not be mounted read/write :("
            if [[ ${RC_FORCE_AUTO} != "yes" ]] ; then
                sulogin ${CONSOLE}
            fi
        else
            eend 0
        fi
    fi

    if [[ ${BOOT} == "yes" ]] ; then
        local x=
        local y=

        #
        # Create /etc/mtab
        #

        # Don't create mtab if /etc is readonly
        if ! touch /etc/mtab 2> /dev/null ; then
            ewarn "Skipping /etc/mtab initialization (ro root?)"
            return 0
        fi

        # Clear the existing mtab
        > /etc/mtab

        # Add the entry for / to mtab
        mount -f /

        # Don't list root more than once
        awk '$2 != "/" {print}' /proc/mounts >> /etc/mtab

        # Now make sure /etc/mtab have additional info (gid, etc) in there
        for x in $(awk '{ print $2 }' /proc/mounts | sort -u) ; do
            for y in $(awk '{ print $2 }' /etc/fstab) ; do
                if [[ ${x} == ${y} ]] ; then
                    mount -f -o remount $x
                    continue
                fi
            done
        done

        # Remove stale backups
        rm -f /etc/mtab~ /etc/mtab~~
    fi
}


# vim:ts=4
/****************************************************/

How to fix this problem?
Thanks in advanced!

-- 
wcw

[-- Attachment #2: Type: text/html, Size: 6498 bytes --]

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [gentoo-user] Failed to start /etc/init.d/checkroot
  2009-04-26 11:31 [gentoo-user] Failed to start /etc/init.d/checkroot Chuanwen Wu
@ 2009-04-26 14:09 ` Mike Kazantsev
  2009-04-27 11:38   ` Chuanwen Wu
  0 siblings, 1 reply; 3+ messages in thread
From: Mike Kazantsev @ 2009-04-26 14:09 UTC (permalink / raw
  To: gentoo-user

[-- Attachment #1: Type: text/plain, Size: 1206 bytes --]

On Sun, 26 Apr 2009 19:31:12 +0800
Chuanwen Wu <wcw8410@gmail.com> wrote:

> Hi,
> My gentoo failed to boot up. When my gentoo is booting up, after the message
> devpts
> "mounting devpts at /dev/pts     OK",
> then it just stoped, and then I pressed "CTRL + c" to interrupt it, and the
> message:
> "Failed to start /etc/init.d/checkroot“ appeared.
...
> How to fix this problem?

It seems a bit strange that checkroot gave no output, just failure -
as if it's execution didn't even started, and, since it's one of the
first initscripts to start, prehaps there's a problem with bash
interpreter or access to init.d path.

Since you've mounted filesystem and it looks okay, you can try changing
last two columns in /etc/fstab for root filesystem to "0 0", so script
won't try to check it - that way you can see if it's something with
fsck - prehaps the system will just boot.
Then, if the rest of the initscripts won't throw some similar errors
(possibly exposing the real problem), you can probably insert a lot of
echoes/einfos to that initscript to see at which point everything hangs
and check what's wrong with the command causing it.

-- 
Mike Kazantsev // fraggod.net

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 198 bytes --]

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [gentoo-user] Failed to start /etc/init.d/checkroot
  2009-04-26 14:09 ` Mike Kazantsev
@ 2009-04-27 11:38   ` Chuanwen Wu
  0 siblings, 0 replies; 3+ messages in thread
From: Chuanwen Wu @ 2009-04-27 11:38 UTC (permalink / raw
  To: gentoo-user; +Cc: mike_kazantsev

[-- Attachment #1: Type: text/plain, Size: 3978 bytes --]

Hi, thanks!

> It seems a bit strange that checkroot gave no output, just failure -
> as if it's execution didn't even started, and, since it's one of the
> first initscripts to start, prehaps there's a problem with bash
> interpreter or access to init.d path.
>
> Since you've mounted filesystem and it looks okay, you can try changing
> last two columns in /etc/fstab for root filesystem to "0 0", so script
> won't try to check it - that way you can see if it's something with
> fsck - prehaps the system will just boot.

I have tried it, but nothing change.


>
> Then, if the rest of the initscripts won't throw some similar errors
> (possibly exposing the real problem), you can probably insert a lot of
> echoes/einfos to that initscript to see at which point everything hangs
> and check what's wrong with the command causing it.

I have inserted some echos,  now the "checkroot" script is:
/*************************************************************/
#!/sbin/runscript
# Copyright 1999-2007 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2

depend() {
    before *
}

start() {
    local retval=0

    echo 1

    if [[ ! -f /fastboot && -z ${CDBOOT} ]] \
    && ! is_net_fs / && ! is_union_fs / ; then
        echo 2
        if touch -c / >& /dev/null ; then
            ebegin "Remounting root filesystem read-only"
            mount -n -o remount,ro /
            eend $?
        fi

        if [[ -f /forcefsck ]] || get_bootparam "forcefsck" ; then
            ebegin "Checking root filesystem (full fsck forced)"
            fsck -C -a -f /
            # /forcefsck isn't deleted because checkfs needs it.
            # it'll be deleted in that script.
            retval=$?
        else
            # Obey the fs_passno setting for / (see fstab(5))
            # - find the / entry
            # - make sure we have 6 fields
            # - see if fs_passno is something other than 0
            if [[ -n $(awk '($1 ~ /^(\/|UUID|LABEL)/ && $2 == "/" \
                            && NF == 6 && $6 != 0) { print }' /etc/fstab) ]]
            then
                ebegin "Checking root filesystem"
                fsck -C -T -a /
                retval=$?
            else
                ebegin "Skipping root filesystem check (fstab's passno ==
0)"
                retval=0
            fi
        fi

        if [[ ${retval} -eq 0 ]] ; then
            eend 0
        elif [[ ${retval} -eq 1 ]] ; then
            ewend 1 "Filesystem repaired"
        elif [[ ${retval} -eq 2 || ${retval} -eq 3 ]] ; then
            ewend 1 "Filesystem repaired, but reboot needed!"
            if [[ ${RC_FORCE_AUTO} != "yes" ]] ; then
                echo -ne "\a"; sleep 1; echo -ne "\a"; sleep 1
                echo -ne "\a"; sleep 1; echo -ne "\a"; sleep 1
                ewarn "Rebooting in 10 seconds ..."
                sleep 10
            fi
            einfo "Rebooting"
            /sbin/reboot -f
        else
            if [[ ${RC_FORCE_AUTO} == "yes" ]] ; then
                eend 2 "Rerunning fsck in force mode"
                fsck -y -C -T /
            else
                eend 2 "Filesystem couldn't be fixed :("
                sulogin ${CONSOLE}
            fi
            einfo "Unmounting filesystems"
            /bin/mount -a -o remount,ro &> /dev/null
            einfo "Rebooting"
            /sbin/reboot -f
        fi
    fi

    echo 3

    # Should we mount root rw ?  the touch check is to see if the / is
    # already mounted rw in which case there's nothing for us to do
[...]
/*************************************************************/

Now the booting message is :
/*************************************************************/
mounting devpts at /dev/pts     OK
1
/*************************************************************/
I am not quite understand the script. But I guess somethink must be wrong in
the "if' statement which contain "echo 2".

Any help will be appreciated!

-- 
wcw

[-- Attachment #2: Type: text/html, Size: 5764 bytes --]

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2009-04-27 11:38 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-04-26 11:31 [gentoo-user] Failed to start /etc/init.d/checkroot Chuanwen Wu
2009-04-26 14:09 ` Mike Kazantsev
2009-04-27 11:38   ` Chuanwen Wu

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox