Fast and reliable reboot after power loss

3

1

What is the best way to harden a linux system to power cycling? I often came upon systems used in shops, public, exhibitions, by several people where no one is responsible for. Usually those systems are shut down by loosing power if the main switch is turned off every evening or so.

With Linux, some annyoing problems arise:

  • GRUB shows a boot menu after power fail on most distributions. I was able to circumvent that by GRUB_RECORDFAIL_TIMEOUT=0 at /etc/default/grub. However I still wonder how long this setting is kept if packages get updated etc.
  • File system checks run after boot, sometimes failing or asking questions. While the checks can be disabled by /etc/fstab, this sometimes forces a read only mount of root, which leads to several problems as most applications, including vanilla X setups, are not aware running on read only filesystems. So I kept the check, but this slows down every boot by some minutes, depending on disk size and usage. Also I am not sure if the check guarantees a read write mount. So I replace errrors=remount-ro by errors=continue too, just by guess.

Is there any best practice to achieve maximum reliability? What are your thoughts?

dronus

Posted 2013-02-16T14:36:08.973

Reputation: 1 482

2A rock solid solution for presentation applications would be having the harddisk mounted read only, and use OverlayFS or something else to get a read write capable root fs, that only writes to a temporary ram fs. However it seems quite complex to turn a ordinary distribution into such a setup. – dronus – 2013-02-16T14:56:37.013

A tailored LiveCD might be a solution... or perhaps even better a USB pendrive that can be switched read-only. – vonbrand – 2013-02-16T17:26:15.253

The LiveCD was a good hint.. actually it seems a readonly partition overlayed with a writable tempfs would do the job for 'kiosk'-only uses. The harddisk would be mounted readonly this way, suffering no effects from powering off. So the fs should stay clean and reboot like usual every time. Will try this out. – dronus – 2013-02-16T21:35:54.677

Answers

1

For kiosk use, I found a quite reliable way to achieve power loss tolerance.

The solution for Ubuntu is found here: https://askubuntu.com/questions/211797/how-do-i-make-ubuntu-power-loss-proof/256952#256952

It uses overlayfs to keep the real root partition read-only and thus the filesystem clean on power loss.

It should be adaptable to other distros as well.

dronus

Posted 2013-02-16T14:36:08.973

Reputation: 1 482

This can also be combined with another eg. ext3 read-writable partition where single databases or log files are stored. As this partition is usually small and low on file count, it can be fscked in a short time and is unlikely to fail completely. Even if data gets corrupted, the system boots up, and your applications can be resilent to missing data if well made. – dronus – 2013-06-28T09:06:49.557