Prevent OS damage

Dear sirs,

We are working in a new project with a beaglebone black as main control system.

Our first difficult is wich OS or software arquitecture used to prevent system corruption for multiple “not controlled shutdowns” (the system will work inside a machine and the way to turn it off is cut electrical source) Battery backup system is not a valid choice for us.
RAM OS? More ideas?

Thanks in advance!

Yeah use a little pacakge called "overlayroot" newer image have it
installed by default..

If you dont:

sudo apt update
sudo apt install overlayroot

Then make sure to regenerate the initrd..

sudo update-initramfs -uk `uname -r`

Then in /boot/uEnv.txt append this variable to your existing cmdline settings.

cmdline=(existing settings) overlayroot=tmpfs

Then reboot, your system is now "Read Only"..

So Beyond that, what's really really nice about overlayroot, you can
login and actually write stuff to the drive by doing:

sudo overlayroot-chroot


or you can use buildroot with read-only fs.

but ultimately we have made one 18650 lithium battery-backed UPS.

when power is out, gracefully shutdown and when power is good, start the am335x. giving us peace of mind.