Grub2 wont start after power failure

Asked by Aggtaa

Grub2 (supplied with Karmic server) does not display a timeout and thus does not boot anything without user interaction after an unexpected shutdown or reboot, e.g. power failure. For a home server, which is set in BIOS to auto "Power on" on power restore, this is unacceptable. Is it intentional behavior and how to fix it?

/etc/default/grub is as follows:

GRUB_DEFAULT=0
GRUB_HIDDEN_TIMEOUT=0
GRUB_HIDDEN_TIMEOUT_QUIET=true
GRUB_TIMEOUT="0"
GRUB_DISTRIBUTOR=`lsb_release -i -s 2> /dev/null || echo Debian`
GRUB_CMDLINE_LINUX_DEFAULT="quiet splash"
GRUB_CMDLINE_LINUX=""

...

Question information

Language:
English Edit question
Status:
Solved
For:
Ubuntu grub2 Edit question
Assignee:
No assignee Edit question
Solved by:
Trygve Vea
Solved:
Last query:
Last reply:
Revision history for this message
Trygve Vea (trygve-vea-gmail) said :
#1

Hello,

I am puzzled on how this can be related to the power outage you experienced, but anyway;

A timeout of 0 means that GRUB will wait indefinitly, and you have to pick the boot entry before it boots.

I would recommend that you set it to 1, and run grub-update to make the change go into effect.

I hope this helps

Regards
Trygve

Revision history for this message
Aggtaa (azykov) said :
#2

Oh. I am really sorry for the inconvenience. It is "10" there, not "0". Just mistyped.

It is clearly connected to power failures, I can easly reproduce it by rebooting my server dozen times watching it booting and then simply unplugging power cord - it wont boot being plugged back in.

Revision history for this message
Best Trygve Vea (trygve-vea-gmail) said :
#3

This was actually new for me - but it seems that this behaviour is caused by the last lines in /etc/grub.d/00_header

if [ \${recordfail} = 1 ]; then
  set timeout=-1
else
  set timeout=${GRUB_TIMEOUT}
fi

I suggest that you create a /etc/grub.d/01_recordfail_override, set the +x permission, and make it look like this:

cat << EOF
set timeout=${GRUB_TIMEOUT}
EOF

then run dpkg-reconfigure grub-pc

Revision history for this message
Aggtaa (azykov) said :
#4

Thanks Trygve Vea, that solved my question.