6

I have a laptop which I intend to be dual-boot. It previously booted into Windows (7), and after Linux install now boots directly into Linux (openSUSE). I've edited /etc/grub.d/40_custom to add the Windows chainloader entry. So far, so good.

Unfortunately I can't get GRUB2 to display the selection menu at all, even to select the Safe Mode entry for the Linux install. I get a split-second flash of the "welcome to grub" message and then it boots directly into the default Linux entry.

Things I have tried:

  • Setting GRUB_TIMEOUT to an integer value and GRUB_HIDDEN_TIMEOUT to
    • 0
    • blank
    • commented out
  • Setting GRUB_HIDDEN_TIMEOUT_QUIET to both true and false
  • Setting GRUB_TERMINAL to console
  • Removing quiet and splash=silent from GRUB_CMDLINE_LINUX_DEFAULT

I am regenerating the config each time with /usr/sbin/grub2-mkconfig

Other info:

  • Holding shift during boot doesn't bring up the menu regardless of the state of GRUB_HIDDEN_TIMEOUT
  • I'm pretty sure this machine isn't using UEFI (I have no /sys/firmware/efi directory)
  • Legacy USB support is enabled in the BIOS.

Anything else I can try? This is getting really aggravating, I never had this much trouble with grub legacy!

Edit:

Section of grub.cfg related to timeout:

if [ x${boot_once} = xtrue]; then
    set timeout=0  
elif [ x$feature_timeout_style = xy ]; then  
    set timeout_style=menu  
    set timeout=0  
# Fallback normal timeout code in case the timeout_style feature is unavailable
else  
    set timeout=0  
fi

This is different to the output displayed by the grub update script, which has timeout = 10! Editing the grub.cfg file directly displays the menu as expected.

2
  • What output this command? grep -i timeout /boot/grub/grub.cfg
    – MiniMax
    Commented Jun 26, 2017 at 13:21
  • And, on Ubuntu, the Esc need to be holded, while booting, in some cases. Shift doesn't always work. Try with Esc button, may be it will work on OpenSUSE too.
    – MiniMax
    Commented Jun 26, 2017 at 13:32

2 Answers 2

10

Do this lines exist in the your /etc/default/grub? If not, add them.

GRUB_TIMEOUT=10
GRUB_TIMEOUT_STYLE=menu

run update-grub afterwards to update /boot/grub/grub.cfg

You can check, if the needed changes has happened, by this way:
grep -i timeout /boot/grub/grub.cfg

Output should be contained such values:

set timeout_style=menu
set timeout=10

From the grub manual:

GRUB_TIMEOUT

Boot the default entry this many seconds after the menu is displayed, unless a key is pressed. The default is 5. Set to 0 to boot immediately without displaying the menu, or to -1 to wait indefinitely. If GRUB_TIMEOUT_STYLE is set to countdown or hidden, the timeout is instead counted before the menu is displayed.

GRUB_TIMEOUT_STYLE

If this option is unset or set to menu, then GRUB will display the menu and then wait for the timeout set by GRUB_TIMEOUT to expire before booting the default entry. Pressing a key interrupts the timeout. If this option is set to countdown or hidden, then, before displaying the menu, GRUB will wait for the timeout set by GRUB_TIMEOUT to expire. If ESC is pressed during that time, it will display the menu and wait for input. If a hotkey associated with a menu entry is pressed, it will boot the associated menu entry immediately. If the timeout expires before either of these happens, it will boot the default entry. In the countdown case, it will show a one-line indication of the remaining time.

2
  • This looked like a really promising lead, as my default grub file had no GRUB_TIMEOUT_STYLE entry at all, but unfortunately same result as before :( I will try playing with the other values again with this entry added though. Thanks for the suggestion!
    – jam
    Commented Jun 27, 2017 at 8:56
  • Actually I think you may have put me on the right track asking about the grep output. When I run the update grub script for this OS it outputs what looks like the new contents of grub.cfg, and it has "set timeout=10", but if I grep grub.cfg itself, this line is "set timeout=0"! So a bug, possibly...
    – jam
    Commented Jun 27, 2017 at 9:09
1

As you describe, your changes to the grub configuration sources do not seem to have an effect. You state that you run grub2-mkconfig after each edit. However, if you look at the man-page, you will notice

-o, --output=FILE

output generated config to FILE [default=stdout]

As you can see, grub2-mkconfig (recently simply grub-mkconfig) doesn't write the actual configuration file, it only prints the contents to the console. To make the change become effective, use either

grub-mkconfig -o /boot/grub2/grub.cfg

or

grub-mkonfig > /boot/grub2/grub.cfg

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .