Ubuntu – update-grub ignoring some options in /etc/default/grub

grub2partitioningtimeout

Just installed another hard drive and noticed that grub automatically added the necessary menu entries to boot off it. I wanted to adjust these new entries by editing /etc/default/grub, but it seems some settings are ignored or overridden by the update-grub and grub-mkconfig scripts. Specifically these lines:

GRUB_TIMEOUT=2
GRUB_OS_PROBER_SKIP_LIST="469841589841479F"

I did remove the GRUB_HIDDEN_TIMEOUT=0 line as the documentation said it was deprecated and replaced it with:

GRUB_TIMEOUT_STYLE="hidden"

After running either script, the resulting grub.cfg file does contain:

if [ "${recordfail}" = 1 ] ; then
  set timeout=-1
else
  if [ x$feature_timeout_style = xy ] ; then
    set timeout_style=hidden
    set timeout=2
  # Fallback hidden-timeout code in case the timeout_style feature is
  # unavailable.
  elif sleep --interruptible 2 ; then
    set timeout=0
  fi
fi
### END /etc/grub.d/00_header ###

So the timeout option is used here. The problem seems to be later with the /etc/grub.d/30_os-prober section. Before I had the second hard drive, there were obviously no entries from that. Now that there is, this gets added to grub.cfg:

### BEGIN /etc/grub.d/30_os-prober ###
menuentry 'Windows 7 (loader) (on /dev/sdb1)' --class windows --class os $menuentry_id_option 'osprober-chain-CA0E41BE0E41A3F3' {

[snip]
}
menuentry 'Windows Recovery Environment (loader) (on /dev/sdb2)' --class windows --class os $menuentry_id_option 'osprober-chain-469841589841479F' {

[snip]
}
set timeout_style=menu
if [ "${timeout}" = 0 ]; then
  set timeout=10
fi
### END /etc/grub.d/30_os-prober ###

So, not only does it not ignore the partition I told it to, but the os-prober part of the script will not allow me to set a timeout of 0 AND forces a menu(I'm used to just holding down the left shift key when powering on if I ever want to change boot options).

A second or two timeout delay is only mildly annoying, but having a menu forced when I explicitly don't want one, and this menu including a partition that should never be listed is much more so.

Short of editing grub.cfg every time, or tweaking /etc/grub.d/30_os-prober (which may get overwritten during an upgrade?) is there a fix for this?

Thanks!

Best Answer

Grub checks GRUB_OS_PROBER_SKIP_LIST against EXPUUID not UUID, so the proper format for GRUB_OS_PROBER_SKIP_LIST is UUID@/dev/???? for example:

GRUB_OS_PROBER_SKIP_LIST="A3F5-6DF3@/dev/sda1"
Related Question