fsck always fails after a power loss


Forum: HD Install
Topic: fsck always fails after a power loss
started by: schamberlin

Posted by schamberlin on Jan. 12 2006,07:11
Can anyone explain why I always get a "fsck failed, reboot linux" style error on the next boot-up after a power loss?

I'm building a digital picture frame from an old laptop using DSL. I've done an HD install, formatting the disk in a single partition using ext3. My problem is that boot-up after power loss always generates some kind of filesystem error. If the computer is running and you press the power button, it immediately turns off without doing a clean shutdown. On the next bootup, with 100% likelihood I'll see this:
Code Sample

Checking root file system...
fsck 1.34-WIP (21-May-2003)
/dev/hda1 was not cleanly unmounted, check forced.
/dev/hda1:
Deleted inode 630431 has zero dtime.  FIXED.
/dev/hda1: Deleted inode 630431 has zero dtime.  FIXED.
/dev/hda1: ***** REBOOT LINUX *****
/dev/hda1: 17441/759520 files (0.2% non-contiguous), 103565/1516126 block

fsck failed. Please repair manually and reboot.  Please note
that the root filesystem is currently mounted read-only.  To
remount it read-write:

 # mount -n -o remount,rw /

Then it dumps me to a text-mode command prompt. This is no good, because the whole thing is inside a picture frame and has no keyboard. This happens regardless of what was happening (or not happening) at the time the system was powered off.

I thought the whole point of using ext3 was that it's a journaling filesystem, and is supposed to prevent exactly these kinds of errors? Can you think of any clever ways I can prevent or work-around this?

What about a startup script that does dmesg | grep 'REBOOT LINUX' and automatically reboots the PC if it finds it? Since it always seem to boot up fine on the second boot after a power loss, this might fix the problem without any user intervention.

Thanks!

Posted by Ivan-NL on Jan. 12 2006,13:13
Does it have ACPI?

If so you can try to let it give a clean shutdown when the mains is disconnected. Ony thing you need for that is working batteries as that will take a minute or so.

Posted by schamberlin on Jan. 12 2006,16:23
Good idea, but the laptop has no battery and is always plugged in. When I said "power loss", what I meant was the laptop being switched off with the power button without doing a clean shutdown.

I'll look into modifying the power button's behavior if that's possible, but there's still always the likelihood that someone will just unplug the thing. So I really need a solution that recovers from hard shutdowns, instead of (or in addition to) a solution that attempts to avoid a hard shutdown.

This seems like a bug with DSL, ext3, or my configuration. I thought that since ext3 was a journaling filesystem, it could gracefully recover from minor problems like a filesystem not being unmounted cleanly. Right?

Posted by cbagger01 on Jan. 12 2006,18:40
I think that DSL mounts EXT3 partitions as if they were old style EXT2 partitions.  I could be wrong, but somebody will need to check this.

I use reiserfs version 3.x for my data partitions.

DSL has builting support for reiserfs mounting, but you still need to get reiserfstools in order to create a new partition from scratch.

Posted by schamberlin on Jan. 13 2006,00:06
Quote
I think that DSL mounts EXT3 partitions as if they were old style EXT2 partitions.

How can I enable full ext3 support then? Is it as simple (?) as just recompiling the kernel with the right options enabled?

Quote
I use reiserfs version 3.x for my data partitions.

I saw a mention elsewhere that although DSL can mount reiserfs data partitions, it can't boot from them. Is that still true? If it is, then I'll still need an ext2/3 boot partition, and will still have this same fsck failure after a hard shutdown.

Posted by AwPhuch on Jan. 14 2006,01:41
DSL doesnt support EXT3 journalling..however it does support mounting r/w of a reiserfs (3.0, because 4.0 is slightly buggy at this time) partition

A good way to create a "journalling" supported partition is to start DSL, enable apt, get the reiserfs tools, then activate (I guess you would use modprobe reiserfs) then format using (mkfs -t reiserfs /hda/???) then reboot....

Im not 100% sure as I havent done this, but others have given me the "thumbs-up" on using a reiserfs system

Anyone out there of "guru" quality want to whip up a reiserfs.dsl and/or assist in a walkthru/howto?!?

Perhaps I should go ahead and give it a whirl myself...in fact...I shall give it a try tonight on my old laptop

Oh and if booting from a frugal ext2 partition it doesnt matter...as the cdimage stored in the ext2 partition never changes there is no danger of damaging the data there...now your personal data in a perisistant (/home /opt) partition would be in danger...thus the reiserfs method

Brian
AwPhuch

Posted by mikshaw on Jan. 14 2006,02:02
Yeah...I have a need to repartition due to this problem.  I've been running dsl with home and opt on the same partition as dsl, and i have to fsck the partition at least every couple of weeks to prevent it from screwing up.  When i had my persistent directories on a reiserfs partition i didn't have that problem.
So, probably best to have a 50mb ext2 partition just for DSL, and put everything else on reiser.

As far as i've seen DSL does not boot when it is installed to reiserfs, and if it's on ext3 it will be mounted as ext2.  No idea why, but that's the way it is.

Posted by schamberlin on Jan. 14 2006,04:18
Quote
As far as i've seen [DSL booting] if it's on ext3 it will be mounted as ext2.  No idea why, but that's the way it is.


Again, this seems like a bug. Can anybody explain why this is? Or how it could be fixed? Kernel recompile to add ext3 journaling support maybe?

Posted by schamberlin on Jan. 14 2006,06:16
To answer my own question, it seems that it _is_ as simple as a kernel recompile. I did some sleuthing and learned that the DSL kernel is configured with ext3 support as an external module, instead of being compiled directly into the kernel. I recompiled the kernel with ext3 compiled directly in, and now it works!

Or I think it works, at least. After switching to my new kernel, I can now power off my laptop with impunity, and it always reboots fine the next time without any fsck complaints. I don't see any special ext3 or journaling related messages at startup, but I assume it's working.

Question to the DSL maintainers: why is ext3 support not compiled directly into the DSL kernel by default? Since it's already included as a module, I don't think it would require any extra space to compile it in directly instead. That would solve a lot of problems that me and other people seem to have with ext2, without needing to worry about setting up reiserfs.

Posted by cbagger01 on Jan. 16 2006,05:13
I think it probably has something to do with keeping the kernel size managable, but I dunno.

You can accomplish the same feat by adding the ext3 or reiserfs modules to the minirt24.gz (frugal install) and also edit the linuxrc to load these modules at boot time.

You could also do something like this for a full hd install, but you would need to place these files on a separate EXT2 /boot partition because you get into a Catch-22 situation otherwise.  IE: You can't mount the root partition until you have the modules, but then again you can't get the modules until you have mounted the root partition :)

Powered by Ikonboard 3.1.2a
Ikonboard © 2001 Jarvis Entertainment Group, Inc.