If the raspberry pi doesn't shut down cleanly, it forces a
fsck at boot. My filesystem is on a 64GB micro SD card and it takes quite a while to
fsck. Before the
fsck finishes, a couple of services timeout, so it ends up in emergency mode. This happens, even though the filesystem is fine.
This is a problem for me because I want this raspberry pi to run unattended and headless. If it goes into emergency mode after a power outage it'll just disappear from the network and I won't be able to do anything about it until I can physically access it again. Raspbian shouldn't require that much care and attention.
I can reproduce the problem by forcing it to check the filesystem with:
sudo tune2fs -c 10 -C 15 /dev/mmcblk0p2.
NOTE: If you do this, it causes the pi to always go to emergency mode. So make sure you can log in to the console to switch it back again with
sudo tune2fs -c -1
Googling the problem, it seems that some other people have run into this too. See RPI boots into emergency mode, how do I remove it?.
It's also been suggested that the fsck is unnecessary.
But since this is my root filesystem I can't remove it from
/etc/fstab. I tried adding
noauto,x-systemd.automount to the options in
/etc/fstab, but it didn't change anything.
Does anyone have a recipe for any of these?
- lengthening the timeout
- preventing an fsck on startup
- preventing the filesystem being marked as dirty on unexpected power loss