Gentoo Archives: gentoo-user

From: Chuanwen Wu <wcw8410@×××××.com>
To: gentoo-user <gentoo-user@l.g.o>
Subject: [gentoo-user] Failed to start /etc/init.d/checkroot
Date: Sun, 26 Apr 2009 11:31:15
Message-Id: 7797aa370904260431t14cd3458kb120ca40fde88cb@mail.gmail.com
1 Hi,
2 My gentoo failed to boot up. When my gentoo is booting up, after the message
3
4 "mounting devpts at /dev/pts OK",
5 then it just stoped, and then I pressed "CTRL + c" to interrupt it, and the
6 message:
7 "Failed to start /etc/init.d/checkroot“ appeared.
8
9 I have checked the file /etc/init.d/checkroot, and I am sure it's the same
10 with another checkroot file which is in another normal gentoo(I used 'diff'
11 to compare).
12 Here is the file '/etc/init.d/checkroot':
13
14 /****************************************************/
15 # cat /etc/init.d/checkroot
16 #!/sbin/runscript
17 # Copyright 1999-2007 Gentoo Foundation
18 # Distributed under the terms of the GNU General Public License v2
19
20 depend() {
21 before *
22 }
23
24 start() {
25 local retval=0
26
27 if [[ ! -f /fastboot && -z ${CDBOOT} ]] \
28 && ! is_net_fs / && ! is_union_fs / ; then
29 if touch -c / >& /dev/null ; then
30 ebegin "Remounting root filesystem read-only"
31 mount -n -o remount,ro /
32 eend $?
33 fi
34
35 if [[ -f /forcefsck ]] || get_bootparam "forcefsck" ; then
36 ebegin "Checking root filesystem (full fsck forced)"
37 fsck -C -a -f /
38 # /forcefsck isn't deleted because checkfs needs it.
39 # it'll be deleted in that script.
40 retval=$?
41 else
42 # Obey the fs_passno setting for / (see fstab(5))
43 # - find the / entry
44 # - make sure we have 6 fields
45 # - see if fs_passno is something other than 0
46 if [[ -n $(awk '($1 ~ /^(\/|UUID|LABEL)/ && $2 == "/" \
47 && NF == 6 && $6 != 0) { print }' /etc/fstab) ]]
48 then
49 ebegin "Checking root filesystem"
50 fsck -C -T -a /
51 retval=$?
52 else
53 ebegin "Skipping root filesystem check (fstab's passno ==
54 0)"
55 retval=0
56 fi
57 fi
58
59 if [[ ${retval} -eq 0 ]] ; then
60 eend 0
61 elif [[ ${retval} -eq 1 ]] ; then
62 ewend 1 "Filesystem repaired"
63 elif [[ ${retval} -eq 2 || ${retval} -eq 3 ]] ; then
64 ewend 1 "Filesystem repaired, but reboot needed!"
65 if [[ ${RC_FORCE_AUTO} != "yes" ]] ; then
66 echo -ne "\a"; sleep 1; echo -ne "\a"; sleep 1
67 echo -ne "\a"; sleep 1; echo -ne "\a"; sleep 1
68 ewarn "Rebooting in 10 seconds ..."
69 sleep 10
70 fi
71 einfo "Rebooting"
72 /sbin/reboot -f
73 else
74 if [[ ${RC_FORCE_AUTO} == "yes" ]] ; then
75 eend 2 "Rerunning fsck in force mode"
76 fsck -y -C -T /
77 else
78 eend 2 "Filesystem couldn't be fixed :("
79 sulogin ${CONSOLE}
80 fi
81 einfo "Unmounting filesystems"
82 /bin/mount -a -o remount,ro &> /dev/null
83 einfo "Rebooting"
84 /sbin/reboot -f
85 fi
86 fi
87
88 # Should we mount root rw ? the touch check is to see if the / is
89 # already mounted rw in which case there's nothing for us to do
90 if mount -vf -o remount / 2> /dev/null | \
91 awk '{ if ($6 ~ /rw/) exit 0; else exit 1; }' && \
92 ! touch -c / >& /dev/null
93 then
94 ebegin "Remounting root filesystem read/write"
95 mount -n -o remount,rw / &> /dev/null
96 if [[ $? -ne 0 ]] ; then
97 eend 2 "Root filesystem could not be mounted read/write :("
98 if [[ ${RC_FORCE_AUTO} != "yes" ]] ; then
99 sulogin ${CONSOLE}
100 fi
101 else
102 eend 0
103 fi
104 fi
105
106 if [[ ${BOOT} == "yes" ]] ; then
107 local x=
108 local y=
109
110 #
111 # Create /etc/mtab
112 #
113
114 # Don't create mtab if /etc is readonly
115 if ! touch /etc/mtab 2> /dev/null ; then
116 ewarn "Skipping /etc/mtab initialization (ro root?)"
117 return 0
118 fi
119
120 # Clear the existing mtab
121 > /etc/mtab
122
123 # Add the entry for / to mtab
124 mount -f /
125
126 # Don't list root more than once
127 awk '$2 != "/" {print}' /proc/mounts >> /etc/mtab
128
129 # Now make sure /etc/mtab have additional info (gid, etc) in there
130 for x in $(awk '{ print $2 }' /proc/mounts | sort -u) ; do
131 for y in $(awk '{ print $2 }' /etc/fstab) ; do
132 if [[ ${x} == ${y} ]] ; then
133 mount -f -o remount $x
134 continue
135 fi
136 done
137 done
138
139 # Remove stale backups
140 rm -f /etc/mtab~ /etc/mtab~~
141 fi
142 }
143
144
145 # vim:ts=4
146 /****************************************************/
147
148 How to fix this problem?
149 Thanks in advanced!
150
151 --
152 wcw

Replies

Subject Author
Re: [gentoo-user] Failed to start /etc/init.d/checkroot Mike Kazantsev <mike_kazantsev@×××××××.net>