Comment 4 for bug 788298

Revision history for this message
Keith Brown (keith-geoffreybrown) wrote :

Regarding the problem of grub-reboot not working with /boot on a RAID array (and in my case not being able to boot back into Ubuntu), I would be happy with a timed default. It wouldn't require GRUB_DEFAULT=saved or grubenv. As I imagine it, a user who normally uses e.g. GRUB_DEFAULT=0 would edit /etc/default/grub to add something like:

GRUB_TIMED_DEFAULT=6 300 # set the default menu entry to 6 for 300 seconds from when grub.cfg is generated

Then the user would run grub-update and it would result in something like the following in grub.cfg (using bash command substitution to get the date but perhaps a special environment variable could be added):

### BEGIN /etc/grub.d/00_header ###
if [ -s $prefix/grubenv ]; then
  load_env
fi
set default="0"
if [ $(date +%s) -le 1319894091 ] ; then # grub-update at Sat Oct 29 15:09:51 CEST 2011; date is 300 seconds in future
  set default="6"
fi
if [ ${prev_saved_entry} ]; then
...

If the user reboots at any point in time in the next 300 seconds then the default menu entry would be 6, after that it would be 0. To guard against a user forgetting that a timed default setting is present grub-update could issue an "are you sure" prompt.