2

I want to extend an existing Debian 6.0 system so that it is able to automatically fix a corrupt root file system by restoring a separate image. That process should start automatically instead of the typical

UNEXPECTED INCONSISTENCY; RUN fsck MANUALLY

error message (so that the machine can be left unattended).

I was expecting that some script in initrd.img is responsible for checking the root fs (and handling error cases like the one above), but I can't find it. Is that job perhaps done by the Kernel itself or the boot loader (GRUB in this case) ?

(I'm using initramfs)

3
  • How about setting it up with a read-only rootfs?
    – peterph
    Nov 20, 2012 at 17:01
  • The problem is that the rootfs needs to be changed from time to time (application upgrades, configurations) and I can't update the initramfs each time. Instead, falling back to a older backup and re-applying the changes is the better way for me.
    – Udo G
    Nov 20, 2012 at 17:09
  • Depending on how often you update, it might be viable to do it off-line on the image and just replace it on next boot - e.g. by setting a parameter on kernel command line which the initramfs notices and replaces the rootfs without asking.
    – peterph
    Nov 21, 2012 at 9:48

1 Answer 1

4

Its handled in the init scripts, in particular /etc/init.d/checkroot.sh. After this message, you should be dropped into a shell (or given a single user password prompt) to run that fsck.

Its warning you that there is some error in the filesystem beyond the fairly normal (from unexpected power failures, etc.) and trivial to fix errors that -p will fix automatically.

You can configure it to do its best to fix everything (at the risk of eating the filesystem, or moving large parts to lost+found) by editing /etc/default/rcS and setting FSCKFIX=yes. (This corresponds to fsck -y instead of fsck -p)

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .