What do these four things have in common? Ubuntu headless server will not boot after power failure as Grub will indefinitely wait for user input. The root of this problem lies inside Ubuntu default Grub configuration as Grub will simply set timeout to infinity when recordfail parameter is set.
The easiest way to solve the above-mentioned issue is to edit
/etc/default/grub configuration file and define
GRUB_RECORDFAIL_TIMEOUT variable to set timeout after unclean shutdown.
$ echo GRUB_RECORDFAIL_TIMEOUT=20 | sudo tee -a /etc/default/grub $ sudo update-grub
If you want to understand why this issue is happening then read the following merge request by Ben Howard, and reviewed by Colin Watson.