On 31 Oct 02 at 17:03, Theodore Ts'o wrote:
> On Thu, Oct 31, 2002 at 01:19:23PM +0200, Petr Vandrovec wrote:
> >
> > Nobody answered it at that time, and it happened at least 5 times
> > again to me - until I modified initscripts to do unconditional
> > reboot if "fsck /" did ANY modifications to filesystem.
> >
>
> In fact, e2fsck should return an exit code which indicates that the
> systme should be rebooted if an fsck the root filesystem makes any
> changes to the filesystem. See the man page to fsck(8) for a
> definition of fsck's exit codes, but if (exit_status & 2) is non-zero,
> the init scripts **should** reboot.
There is something wrong then...
> Unfortunately, not all distributions get this right. However, your
> analysis is right. If fsck needs to make any modifications to the
> root filesystem, which is mounted read-only, it is possible for the
> corrupted filesystem elements to still be cached in memory, and then
> written back out to disk when the filesystem is remounted read/write.
Debian does:
force=""
fix="-a"
spinner="-C"
fsck $spinner $force $fix /
if [ $? -gt 1 ]
then
echo "fsck failed..."
...
/sbin/sulogin
reboot -f
fi
which would catch return value '2' or any combination of 2 with anything
else. But fsck returns 1 - File system errors corrected. I just added
check for $? -eq 1, doing immediate reboot in such case in
/etc/init.d/checkroot.sh.
But I must admit that I did not checked whether 'system should be rebooted'
bit was not generated by e2fsck, or whether it was dropped by fsck wrapper,
or whether there is some addon patch in Debian fsck package.
System is debian unstable, currently using (e2)fsck 1.30-WIP, 30-Sep-2002.
Best regards,
Petr Vandrovec
[email protected]