Google
 

Tuesday, May 10, 2011

Grub2 recordfail FAIL

I have this headless, keyboardless server running on Ubuntu 10.04. Runs fine, but once in a while while there's power cut off the server still remains dead when the power is back. I connected monitor and keyboard and found that the problem is with Grub2.

Turns out there's a variable named recordfail which is set to 1 during next boot whenever there's some problem with the computer (like due to power failure).

Now if you see /boot/grub/grub.cfg file, it has the following lines:

if [ ${recordfail} = 1 ]; then
set timeout=-1
else
set timeout=10
fi
Which means, the timeout counter is disabled whenever the recordfail variable is set. This is nice for desktop environment, which has a monitor, so I can see the Grub countdown is disabled so I can proceed with Repair option if I have to, but for headless servers the computer just sits idle at Grub screen, puzzling the poor sysadmin.

Fix? I changed the timeout=-1 to timeout=10.

4 comments:

  1. I once had GRUB error while booting Ubuntu 10.10 and couldn't open OS. I was dual booting Ubuntu with XP. How can I fix grub error?

    ReplyDelete
  2. tried this? https://help.ubuntu.com/community/RecoveringUbuntuAfterInstallingWindows

    ReplyDelete
  3. Doesnt' /boot/grub/grub.cfg get updated every time there is a new kernel version? - Is there a better solution for this?

    I looked at /etc/grub.d and it seems there are a few conditions that can cause a timeout=-1 -- this is a really bizzare default for a ubuntu-server - isnt' timeout=-1 always a bad idea on a server? :/

    ReplyDelete
  4. I've had the same experience with you. Today I found a bug report on this problem in Launchpad: https://bugs.launchpad.net/ubuntu/+source/grub2/+bug/669481

    Hope this will be fixed soon.

    ReplyDelete