Sunday, May 5, 2024
 Popular · Latest · Hot · Upcoming
18
rated 0 times [  18] [ 0]  / answers: 1 / hits: 19296  / 2 Years ago, thu, april 14, 2022, 7:47:28

I like to run a system unattended for every day 'kiosk' use.



However, the system may be powered off anytime without someone doing a proper shutdown before. By default, Ubuntu is not expected to be shut down by power loss. After rebooting after a power loss, fsck may be run to check the file system, and fsck may tell the system to reboot after it has finished. So even if no configuration data gets corrupted, the machine may not boot well after power loss. So I tested some workarounds:




  1. change the root mount fsck priority to 0 (last field in fstab root entry)
    that prevents running fsck after every power loss. However, the the system may boot with root mounted read-only then, which is not expected by many services and results in a console login prompt instead the graphical login.


  2. Replace errrors=remount-ro by errors=continue. This gives a bad feeling that further data loss may occur by an incosistent filesystem. However, with fsck enabled again, it should increase the system's boot propability after power loss. So I dropped 1).


  3. Reconfigure grub2 to use a normal default option timeout after a failed boot. For that, i've added GRUB_RECORDFAIL_TIMEOUT=0 to /etc/default/grub.




However, it is hard to know if these hacks make the system power loss proof. Any ideas? Any more one can do?


More From » boot

 Answers
2

For kiosk application, the problem is solved by using a readonly root partition. In addition, any changes users make or save are undone at the next reboot.



To provide a writable root for most applications needs, overlayfs can be used to overlay the readonly partition with a writable ram tempfs.



There is a script that helps creating such a setup at the bottom of https://help.ubuntu.com/community/aufsRootFileSystemOnUsbFlash . The script contains the instructions to set this up:




  • put the file in /etc/initramfs-tools/scripts/init-bottom/root-ro

  • sudo chmod 0755 root-ro

  • sudo update-initramfs -u



I suggest to add GRUB_RECORDFAIL_TIMEOUT=0 to /etc/default/grub and run sudo update-grub too, otherwise the boot menu may appear without timeout.



After that, reboot. The machine then starts in readonly mode, which can be checked by mount. Any change applied will vanish on next reboot. To make any changes, install software and updates etc. you just need to enter the GRUB menu, press e to change the boot command lines, and append disable-root-ro=true to the line starting with kernel. Press F10 to continue booting. You can then use mount to confirm root is mounted writable as usual. Make your changes and reboot, the system is readonly again.


[#34481] Thursday, April 14, 2022, 2 Years  [reply] [flag answer]
Only authorized users can answer the question. Please sign in first, or register a free account.
itteast

Total Points: 291
Total Questions: 123
Total Answers: 104

Location: Tuvalu
Member since Wed, Mar 29, 2023
1 Year ago
itteast questions
;