Alright, remounting in read-only mode did the trick; thank you!
Somehow i thought of ro-mode as not useful and write-protected also for fsck. But fsck and tune2fs can modify the filesystem in ro-mode.
Now i will combine it with another tip to put the check before rw-remount in:
or i will wait for boot-completion and do the check with a few remounts.
So while this is possible to have the running system fsck'ed i wonder why the process of checking and fixing is not supported by LEDE/OpenWRT on its own? Sudden powerloss accidents do happen from time to time ...
I'm not sure which exact command @conner2 used but I had success on the Raspberry Pi (running 17.01 based system) by modifying the /lib/preinit/80_mount_root file adding this new line (you need to have the e2fsprogs package installed): /usr/sbin/e2fsck -y -v -f /dev/mmcblk0p2
before this existing line: [ "$INITRAMFS" = "1" ] || boot_hook_add preinit_main do_mount_root
Also I tested the in-built "check filesystem" option under the menu System->Mount Points but it didn't appear to work and in most cases gave a 'Bad Gateway' error after which the only recovery path was a reboot/power cycle.
Anyway it would be great if there was working support for filesystem checks in OpenWRT/LEDE as some storage systems and set ups aren't quite so reliable.
On desktop systems, it behaves like this...on OpenWRT/LEDE it does NOT!
As stated in the initial post, no method whatsoever will enable this at boot for the root partition.
My solution is to drive the system in read-only mode for all filesystems that reside on the sd-card. I additionally mount an USB-stick with ext4 to write stuff. There it behaves like you would expect and properly recovers from power failures and such incidents.
When a file-system has gone to read-only state, you can fsck and repair it from within a running running system...even if it is the root partition. And then you can force it to stay read-only as i have explained above. Or you need to take out the sd-card, check and repair it on a desktop system and then prevent it from going to write-mode ever again if you want to protect it.
can you translate that to simpler terms?. The reference link is way over my head. I have a USB3 external drive and would like to have the fsck run on boot. Where exactly is this line placed (in what config file)? Thanks.
Oh, wow, that was easy. Under the "System", "Mount Points" following down the list of topics there is a section "Mount Points" with the USB drive is in the list and is checked if it is enabled. If you click the "Edit" option, then on the "Advanced settings" is a check box for "Run system file check" (on boot). Excellent! Thanks!!