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?

  • 2
    A 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 Feb 16 '13 at 14:56
  • A tailored LiveCD might be a solution... or perhaps even better a USB pendrive that can be switched read-only. – vonbrand Feb 16 '13 at 17:26
  • 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 Feb 16 '13 at 21:35

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.

  • 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 Jun 28 '13 at 9:06

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.