make Ubuntu server powerloss proof

Hi

Sometimes, after powerloss Ubuntu hangs on boot or asking to fix filesystem errors.
To avoid this problems simply edit following files:

Edit the file:

 /etc/default/grub
GRUB_RECORDFAIL_TIMEOUT=2

After that you have to rebuild grub configuration:

update-grub

Edit the file:

/etc/default/rcS
FSCKFIX=yes

EDIT 16.05.2018:
Ubuntu 18.04 /etc/default/rcS missing due to systemd
You have to pass a kernel parameter
https://www.freedesktop.org/software/systemd/man/systemd-fsck@.service.html

/etc/default/grub

GRUB_CMDLINE_LINUX_DEFAULT="quiet splash fsck.repair=yes"

Dont forget to run update-grub

Have fun!