public inbox for gentoo-user@lists.gentoo.org
 help / color / mirror / Atom feed
* [gentoo-user] grub2: hidden menu unless shift pressed?
@ 2018-02-17 20:36 Grant Edwards
  2018-02-17 20:58 ` Daniel Frey
                   ` (2 more replies)
  0 siblings, 3 replies; 5+ messages in thread
From: Grant Edwards @ 2018-02-17 20:36 UTC (permalink / raw
  To: gentoo-user

I'm trying to figure out how to configure grub 2.02 so that no menu is
displayed and it will boot immediately to the default unless shift is
held down during boot -- in which case it displays the menu and waits
indefinitely for a choice to be made.

This is a bare-bones grub2 installation without any of the
auto-magical, config generator scripts.  All I have is grub.cfg and an
editor.

I've found many web pages that say all you have to to is edit
/etc/default/grub and set GRUB_TIMEOUT=0 and GRUB_HIDDEN_TIMEOUT=0 and
Bob's your uncle.  Of course that file gets mashed about by dozens of
shell scripts comprising thousands of lines of code to product the
real grub.cfg containing hundreds of lines of code.

[Oh God, how I hate grub2.]

AFAICT, you end up with

set timeout=0
set timeout_style=hidden 

But, that doesn't seem to work. Holding down the shift key during boot
doesn't cause the menu to be displayed, and it always boots directly
to the default no matter what you do.

Any grub2 experts care to lend a clue?

-- 
Grant Edwards               grant.b.edwards        Yow! MERYL STREEP is my
                                  at               obstetrician!
                              gmail.com            



^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [gentoo-user] grub2: hidden menu unless shift pressed?
  2018-02-17 20:36 [gentoo-user] grub2: hidden menu unless shift pressed? Grant Edwards
@ 2018-02-17 20:58 ` Daniel Frey
  2018-02-18  0:13   ` Tom H
  2018-02-17 22:15 ` [gentoo-user] " Grant Edwards
  2018-02-18  0:06 ` [gentoo-user] " Tom H
  2 siblings, 1 reply; 5+ messages in thread
From: Daniel Frey @ 2018-02-17 20:58 UTC (permalink / raw
  To: gentoo-user

On 02/17/18 12:36, Grant Edwards wrote:
> I'm trying to figure out how to configure grub 2.02 so that no menu is
> displayed and it will boot immediately to the default unless shift is
> held down during boot -- in which case it displays the menu and waits
> indefinitely for a choice to be made.
> 
> This is a bare-bones grub2 installation without any of the
> auto-magical, config generator scripts.  All I have is grub.cfg and an
> editor.
> 
> I've found many web pages that say all you have to to is edit
> /etc/default/grub and set GRUB_TIMEOUT=0 and GRUB_HIDDEN_TIMEOUT=0 and
> Bob's your uncle.  Of course that file gets mashed about by dozens of
> shell scripts comprising thousands of lines of code to product the
> real grub.cfg containing hundreds of lines of code.
> 
> [Oh God, how I hate grub2.]
> 
> AFAICT, you end up with
> 
> set timeout=0
> set timeout_style=hidden 
> 
> But, that doesn't seem to work. Holding down the shift key during boot
> doesn't cause the menu to be displayed, and it always boots directly
> to the default no matter what you do.
> 
> Any grub2 experts care to lend a clue?
> 

It's been a while since I've done this, but I thought the hotkey was ESC
not shift?

All I had to do was use:

GRUB_TIMEOUT=0
GRUB_HIDDEN_TIMEOUT=5

Grub will wait for the escape key to be pressed for 5 seconds, if no
keypress, it would boot.

Dan


^ permalink raw reply	[flat|nested] 5+ messages in thread

* [gentoo-user] Re: grub2: hidden menu unless shift pressed?
  2018-02-17 20:36 [gentoo-user] grub2: hidden menu unless shift pressed? Grant Edwards
  2018-02-17 20:58 ` Daniel Frey
@ 2018-02-17 22:15 ` Grant Edwards
  2018-02-18  0:06 ` [gentoo-user] " Tom H
  2 siblings, 0 replies; 5+ messages in thread
From: Grant Edwards @ 2018-02-17 22:15 UTC (permalink / raw
  To: gentoo-user

On 2018-02-17, Grant Edwards <grant.b.edwards@gmail.com> wrote:

> I'm trying to figure out how to configure grub 2.02 so that no menu is
> displayed and it will boot immediately to the default unless shift is
> held down during boot -- in which case it displays the menu and waits
> indefinitely for a choice to be made.

FWIW, the config file I ended up with is below. For a good laugh,
compare it with the 300-line monstrosity your favorite distro produces
auto-magically.

Despite grub2 documentation to the contrary, 'keystatus --shift' does
not always return true if the shift key is held down.  In my testing
it only returns true if shift was up when grub started and _then_ was
pressed and held down.  If you press shift before grub starts (and
hold it down) then 'keystatus --shift' returns false.  [Maybe this is
HW dependent?]

That's why I added the double "A above middle C" beep followed by 1
second of silence: provides a window during which you can press the
shift key.  I would prefer it if you could just press and hold the
shift key immediately after power-on, but it'll do.

----------------------------------------------------------------------
set root=(hd0,3)

insmod play
play 6000 440 10 0 20 440 10 0 100

set default=0

if keystatus --shift; then
  set timeout=-1
  set timeout_style=menu
else
  set timeout=0
  set timeout_style=hidden
fi

menuentry "Windows"{
  [...]
}

menuentry "Recovery"{
  [...]
}
----------------------------------------------------------------------


-- 
Grant Edwards               grant.b.edwards        Yow! I wonder if I ought
                                  at               to tell them about my
                              gmail.com            PREVIOUS LIFE as a COMPLETE
                                                   STRANGER?



^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [gentoo-user] grub2: hidden menu unless shift pressed?
  2018-02-17 20:36 [gentoo-user] grub2: hidden menu unless shift pressed? Grant Edwards
  2018-02-17 20:58 ` Daniel Frey
  2018-02-17 22:15 ` [gentoo-user] " Grant Edwards
@ 2018-02-18  0:06 ` Tom H
  2 siblings, 0 replies; 5+ messages in thread
From: Tom H @ 2018-02-18  0:06 UTC (permalink / raw
  To: Gentoo User

On Sat, Feb 17, 2018 at 3:36 PM, Grant Edwards
<grant.b.edwards@gmail.com> wrote:
>
> I'm trying to figure out how to configure grub 2.02 so that no menu is
> displayed and it will boot immediately to the default unless shift is
> held down during boot -- in which case it displays the menu and waits
> indefinitely for a choice to be made.
>
> This is a bare-bones grub2 installation without any of the
> auto-magical, config generator scripts. All I have is grub.cfg and an
> editor.
>
> I've found many web pages that say all you have to to is edit
> /etc/default/grub and set GRUB_TIMEOUT=0 and GRUB_HIDDEN_TIMEOUT=0 and
> Bob's your uncle. Of course that file gets mashed about by dozens of
> shell scripts comprising thousands of lines of code to product the
> real grub.cfg containing hundreds of lines of code.
>
> [Oh God, how I hate grub2.]
>
> AFAICT, you end up with
>
> set timeout=0
> set timeout_style=hidden
>
> But, that doesn't seem to work. Holding down the shift key during boot
> doesn't cause the menu to be displayed, and it always boots directly
> to the default no matter what you do.
>
> Any grub2 experts care to lend a clue?

I don't have a grub2-on-Gentoo install but the below is from a test Debian VM.

"90-grub" is the only executable file in "/etc/grub.d/" and pressing
"shift" displays the grub menu.

I've had problems with "shift" with grub1 and grub2 in the past and
I'd use "set timeout=1" and press "esc" in order to display the grub
menu if I were you.

root@sysd ~ # grub-install --version
grub-install (GRUB) 2.02-2

root@sysd ~ # cat /etc/grub.d/90-grub
#!/bin/sh

cat <<EOF

# menu
set default=0
set timeout=0
set timeout_style=hidden

# kernel
insmod gzio

# disk/partition
insmod part_msdos

# filesystem
insmod ext2

# /boot
search --no-floppy --fs-uuid --set=root 87e976c8-1411-4dab-9c63-d5c7eec9975f

# video
terminal_input console
terminal_output console

menuentry 'systemd' {
linux /boot/kernel root=UUID=87e976c8-1411-4dab-9c63-d5c7eec9975f ro
initrd /boot/ramfs
}

menuentry 'systemd (single)' {
linux /boot/kernel root=UUID=87e976c8-1411-4dab-9c63-d5c7eec9975f ro single
initrd /boot/ramfs
}

menuentry 'systemd (emergency)' {
linux /boot/kernel root=UUID=87e976c8-1411-4dab-9c63-d5c7eec9975f ro emergency
initrd /boot/ramfs
}

EOF

root@sysd ~ #


^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [gentoo-user] grub2: hidden menu unless shift pressed?
  2018-02-17 20:58 ` Daniel Frey
@ 2018-02-18  0:13   ` Tom H
  0 siblings, 0 replies; 5+ messages in thread
From: Tom H @ 2018-02-18  0:13 UTC (permalink / raw
  To: Gentoo User

On Sat, Feb 17, 2018 at 3:58 PM, Daniel Frey <djqfrey@gmail.com> wrote:
>
> It's been a while since I've done this, but I thought the hotkey was ESC
> not shift?
>
> All I had to do was use:
>
> GRUB_TIMEOUT=0
> GRUB_HIDDEN_TIMEOUT=5
>
> Grub will wait for the escape key to be pressed for 5 seconds, if no
> keypress, it would boot.

"GRUB_HIDDEN_TIMEOUT" and "GRUB_HIDDEN_TIMEOUT_QUIET" have been
deprecated (not - yet? - obsoleted) in favor of "GRUB_TIMEOUT_STYLE".


^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2018-02-18  0:14 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2018-02-17 20:36 [gentoo-user] grub2: hidden menu unless shift pressed? Grant Edwards
2018-02-17 20:58 ` Daniel Frey
2018-02-18  0:13   ` Tom H
2018-02-17 22:15 ` [gentoo-user] " Grant Edwards
2018-02-18  0:06 ` [gentoo-user] " Tom H

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox