RobertCNelson / omap-image-builder

omap image builder
http://elinux.org/BeagleBoardUbuntu
MIT License
152 stars 201 forks source link

Add fsprotect to the list of included packages #119

Closed stepleton closed 5 years ago

stepleton commented 5 years ago

(This change is more of a proposal than a proper, full change.)

Adding https://packages.debian.org/buster/fsprotect might make it easier to configure Beagles as components in appliances where the power might be cut unexpectedly---before the user can initiate a clean shutdown.

As an example, I'd like to be able to set up https://github.com/stepleton/cameo/tree/master/aphid so that it can emulate an internal hard drive, but the PocketBeagle's power button is inaccessible when the Beagle is installed inside a computer's case. When the computer shuts off, power to the PocketBeagle is cut off as well, without warning.

If I could protect most of the Beagle's filesystem with fsprotect, then as long as my own software took care of flushing writes to the hard drive emulator's disk image, I wouldn't have to worry about filesystem components being damaged during power loss.

This seems like a useful facility for Beagles in general, which seem ideally suited to applications where they are embedded within other, larger systems.

RobertCNelson commented 5 years ago

@stepleton sorry for the delay, had to catch up with work after a little vacation..

I do like the idea of this and have started playing around with fsprotect. So far i've patch aufs-tools and fsprotect to no longer need aufs-dev/aufs-dkms (and thus kernel module source) as we have aufs patched into our kernel:

wget http://gfnd.rcn-ee.org:81/farm/outgoing/stretch/armhf/aufs-tools_4.9+20170918-2/aufs-tools_4.9+20170918-2rcnee0~stretch+20180830_armhf.deb
wget http://gfnd.rcn-ee.org:81/farm/outgoing/stretch/armhf/fsprotect_1.0.7/fsprotect_1.0.7rcnee0~stretch+20180830_all.deb

Regards,

RobertCNelson commented 5 years ago

and found this:

https://github.com/leiqin/fsprotect

leiqin patched the project to use OverlayFS!

Regards,

RobertCNelson commented 5 years ago

@stepleton okay, with one small patch (1) (sent upstream) i got overlayroot working pretty good, plus it has an option to "switch" to the ro schroot via:

sudo overlayroot-chroot

So it's a little easier then fsprotect to go from tmpfs-ro to rw..

I'm going to push a commit shortly that adds overlayroot as a option for stretch/buster/bionic

1: https://github.com/rcn-ee/repos/blob/master/debian-9-cloud-initramfs-tools/suite/stretch/debian/patches/0001-overlayroot-fstab-use-fs-virtual-for-debugfs-entries.patch

Regards,

stepleton commented 5 years ago

Thanks, this looks like a great solution! Can't wait to try this out.