Hi together,
I'm trying to get a BBB running with readonly root filesystem to prevent filesystem corruption by inproper shutdown of the BBB. I'm using up to date so far unmodified Debian image (Linux beaglebone 4.1.1-ti-r2 #1 SMP PREEMPT Wed Jul 8 17:03:29 UTC 2015 armv7l GNU/Linux).
I found a script (
https://help.ubuntu.com/community/aufsRootFileSystemOnUsbFlash) which should work. I tried to use the overlayfs-version at the very end of the site.
- copy the script to /etc/initramfs-tools/scripts/init-bottom/root-ro
- make it executable
- update-initramfs -u
I had to adjust some words in the script (line 103 overlayfs->overlay) to get it work.
I have my adjusted script here:
http://pastebin.com/hVQ9BCdWNow, when I boot, I got the following error on serial console:
Begin: Running /scripts/init-bottom ... try to move: /root /mnt/root-ro
mount: invalid option --
Failure: root-ro ERROR: failed to move root away from /root to /mnt/root-ro done.
run-init: nuking initramfs contents: Directory not empty
[ 6.897327] Kernel panic - not syncing: Attempted to kill init! exitcode=0x00000100
[ 6.897327]
[ 6.906536] CPU: 0 PID: 1 Comm: run-init Not tainted 4.1.1-ti-r2 #1
[ 6.912833] Hardware name: Generic AM33XX (Flattened Device Tree)
[ 6.919005] [<c0019998>] (unwind_backtrace) from [<c0014b38>] (show_stack+0x20/0x24)
[ 6.926806] [<c0014b38>] (show_stack) from [<c096f0dc>] (dump_stack+0x8c/0xcc)
[ 6.934075] [<c096f0dc>] (dump_stack) from [<c096c900>] (panic+0xac/0x230)
[ 6.941005] [<c096c900>] (panic) from [<c0047718>] (complete_and_exit+0x0/0x2c)
[ 6.948360] [<c0047718>] (complete_and_exit) from [<c0047764>] (do_group_exit+0x0/0xd4)
[ 6.956408] drm_kms_helper: panic occurred, switching back to text console
[ 6.963348] ---[ end Kernel panic - not syncing: Attempted to kill init! exitcode=0x00000100
[ 6.963348]
[ 8.556964] random: nonblocking pool is initialized
I tried already to change the command in the script to "mount -M ..." but also producing an error.
HINT: If you try this out, you could interrupt the boot process at the beginning by pressing a key and enter the u-boot console. There type:
setenv optargs disable-root-ro=true
boot
Then you should boot with the readonly feature disabled.
Could someone help me with this problem? Or are there newer/other solutions to get the filesystem readonly? I must admit, I'm a quite unexperienced linux user. I was wondering, if there aren't more BBB users using a readonly filesystem to protect there BBB from datacorruption? Especially for long running unattended systems?
Thanks in advance!
Christian