Small problem, a lot of hassle. My rootfs became corrupted in a way that fsck
refused to fix it in non-interactive mode. This means that I have to run
manually but since rootfs is already mounted, it’s not really safe. There are
couple ways one can handle this problem, here’s the one I prefer.
You have to reboot the system and modify kernel cmdline, using grub edit
rd.break=pre-mount in the line starting with
linux. The boot
process will break just before mounting any filesystem. This means that you can
now manually run
fsck on rootfs since it’s not mounted yet. Reboot the system
or just quit your shell after it’s done.
Some more info
This solution is similar to running shell as init process (
init=/bin/sh or in
case of using initramfs -
rdinit=/bin/sh, or in case of dracut -
rdinit=/bin/bash). It is, however, a little bit more handy since at the time
you are dropped to shell, all basic stuff (like procfs/sysfs) are already set
up. One another small advantage of this approach is that you can easily continue
the boot process just by leaving the shell (
Dracut has couple other breakpoints you can use. To check full list, run:
grep -E 'rd.?break' /usr/lib/dracut/modules.d/99base/init.sh
You can some more useful information on this wiki page.