Power Loss Hardening


Newer boot processes don't use

The boot process is configured to wait for your input after a power loss. You don't want that on a remote server. Tell it to boot anyway by adding the grub_record_fail parameter to the gub config file. More detail here

echo "GRUB_RECORDFAIL_TIMEOUT=5" | sudo tee -a /etc/default/grub
sudo update-grub
sudo dpkg-reconfigure grub-pc

The filesystem is often configured by default to start in read-only mode on any errors - likely after a power outage. Edit the fstab and change the option to continue

sudo vim /etc/fstab

UUID=9affa900-0018-4289-9e7b-1ee9367153ac /               ext4    errors=continue       0       1

Make sure to scan the filesystem without intervention should it need fixing

sudo vim /etc/default/rcS

# automatically repair filesystems with inconsistencies during boot


EDIT 16.05.2018:
Ubuntu 18.04 /etc/default/rcS missing due to systemd
You have to pass a kernel parameter


GRUB_CMDLINE_LINUX_DEFAULT="quiet splash fsck.repair=yes"

Dont forget to run update-grub

An automated reboot is sometimes a good idea if you have problematic software that can break your remote access

sudo vim /etc/crontab

 0 3 * * 1 root /sbin/shutdown -r +10 "Weekly reboot in 10 minutes"