avoiding fsck problems


Forum: HD Install
Topic: avoiding fsck problems
started by: danielp

Posted by danielp on June 23 2007,09:42
Hi all,

I'm trying to build a digital picture frame with an old laptop and DSL. I am at the stage of testing the whole thing before taking the laptop apart.

One problem I have is that the laptop has a dead battery, so it has to run off traditional AC electricity. This is fine, but when a power outage happens, DSL stops suddenly. When it then reboots, it complains that the file system (ext2) is not in correct shape. Can't remember the exact message right now (I'm not in front of it), but I think it's because of fsck checking the disk, and then only booting in read-only mode, which then prevents DSL from further booting.

The solution I've found is that I need to send the command:
sudo reboot
which then reboots and then DSL loads.

The problem with this however, is when the keyboard will be taken apart, I won't be able to type this! I want to use SSH or another remote system later to control the PC.

Is there a way to avoid these fsck checks properly? I mean, would there be a way to reboot automatically after the fsck? I suppose fsck is really needed in the first place? (if you just turn off the power without doing a proper shutdown)

Thanks for reading and any pointers towards the right direction.

Daniel

Posted by curaga on June 23 2007,11:18
That could be done by editing the boot scripts..

But I would use a frugal install with a readonly main partition. Then a blackout could do nothing to it, and no need for fsck'ing..

Posted by lucky13 on June 23 2007,14:47
Quote
Can't remember the exact message right now

That's what dmesg is for. You can also get it from the stats script (there's a tab for dmesg, iirc).

As annoying as forced checks are, I wouldn't disable it or attempt to override it. I've been through that enough times (Linux, Windows, etc.) to know how infuriating it can be, but it only takes one time to catch a serious problem to make it worthwhile. The man page for tune2fs warns:

Quote
You should strongly consider the consequences of disabling mount-count-dependent checking entirely. Bad disk drives, cables, memory, and kernel bugs could all corrupt a filesystem without marking the filesystem dirty or in error. If you are using journaling on your filesystem, your filesystem will never be marked dirty, so it will not normally be checked. A filesystem error detected by the kernel will still force an fsck on the next reboot, but it may already be too late to prevent data loss at that point.


It's one thing if your computer is shut down due to a power failure. It's another if something's wrong with your filesystem(s) that you really need to know about. Despite what curaga suggested, your data (pics, settings, etc.) are stored separate partition from the ISO in a frugal install and that partition isn't read-only. It should be checked following a forced and improper shut down, whether it's related to a blackout or something else (imo).

See the tune2fs man page for commands that will allow you to disable checks.
(e.g., tune2fs -i 0 -c 0 /dev/hda)
< http://www.netadmintools.com/html/tune2fs.man.html >

Posted by curaga on June 23 2007,15:41
I meant that. The system would be unharmed, but the data checked.. But non-root partition check doesn't need a reboot, just a remount

I think fsck exits with different codes depending on what it did. So look them up, and something like this to make it reboot after a check:

fsck line
$?=check code && reboot

Posted by danielp on June 23 2007,20:07
Here's the exact message:
------------------
/dev/hda1 was not cleanly unmounted, fsck started
....
fsck failed. Please repair manually and reboot. Please note that the root file system is currently mounted read-only. To remount it read-write:
#mount -n -o remount,rw /

Then DSL tries to continue loading and hangs on:
xinit: Connection refused (errno 111): unable to connect to X server
...
xauth: error in locking authority file /home/dsl/.Xauthority
---------------

Anyway, it's not so much the error message that's important. It's how to continue without using the keyboard!

Where is the fsck command at boot? How can I make it reboot after a check? (sorry, complete Linux newbie here)

Curaga, you suggest installing a frugal install with a 2nd partition for the data? Would that continue loading DSL and at least start SSH in the case of a blackout?
I guess in that case I would be able to access the PC from remote?

Posted by curaga on June 24 2007,06:49
If the first (DSL) partition is readonly, it will boot ok after a blackout.
It will also load ssh if you use the ssh bootcode..

But if it checks another partition than root, and mounts it readonly, is that a bad thing? As long as new pics aren't added on that session, old ones get shown just fine, no need for ssh..

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