1 |
On Sat, Feb 17, 2018 at 3:36 PM, Grant Edwards |
2 |
<grant.b.edwards@×××××.com> wrote: |
3 |
> |
4 |
> I'm trying to figure out how to configure grub 2.02 so that no menu is |
5 |
> displayed and it will boot immediately to the default unless shift is |
6 |
> held down during boot -- in which case it displays the menu and waits |
7 |
> indefinitely for a choice to be made. |
8 |
> |
9 |
> This is a bare-bones grub2 installation without any of the |
10 |
> auto-magical, config generator scripts. All I have is grub.cfg and an |
11 |
> editor. |
12 |
> |
13 |
> I've found many web pages that say all you have to to is edit |
14 |
> /etc/default/grub and set GRUB_TIMEOUT=0 and GRUB_HIDDEN_TIMEOUT=0 and |
15 |
> Bob's your uncle. Of course that file gets mashed about by dozens of |
16 |
> shell scripts comprising thousands of lines of code to product the |
17 |
> real grub.cfg containing hundreds of lines of code. |
18 |
> |
19 |
> [Oh God, how I hate grub2.] |
20 |
> |
21 |
> AFAICT, you end up with |
22 |
> |
23 |
> set timeout=0 |
24 |
> set timeout_style=hidden |
25 |
> |
26 |
> But, that doesn't seem to work. Holding down the shift key during boot |
27 |
> doesn't cause the menu to be displayed, and it always boots directly |
28 |
> to the default no matter what you do. |
29 |
> |
30 |
> Any grub2 experts care to lend a clue? |
31 |
|
32 |
I don't have a grub2-on-Gentoo install but the below is from a test Debian VM. |
33 |
|
34 |
"90-grub" is the only executable file in "/etc/grub.d/" and pressing |
35 |
"shift" displays the grub menu. |
36 |
|
37 |
I've had problems with "shift" with grub1 and grub2 in the past and |
38 |
I'd use "set timeout=1" and press "esc" in order to display the grub |
39 |
menu if I were you. |
40 |
|
41 |
root@sysd ~ # grub-install --version |
42 |
grub-install (GRUB) 2.02-2 |
43 |
|
44 |
root@sysd ~ # cat /etc/grub.d/90-grub |
45 |
#!/bin/sh |
46 |
|
47 |
cat <<EOF |
48 |
|
49 |
# menu |
50 |
set default=0 |
51 |
set timeout=0 |
52 |
set timeout_style=hidden |
53 |
|
54 |
# kernel |
55 |
insmod gzio |
56 |
|
57 |
# disk/partition |
58 |
insmod part_msdos |
59 |
|
60 |
# filesystem |
61 |
insmod ext2 |
62 |
|
63 |
# /boot |
64 |
search --no-floppy --fs-uuid --set=root 87e976c8-1411-4dab-9c63-d5c7eec9975f |
65 |
|
66 |
# video |
67 |
terminal_input console |
68 |
terminal_output console |
69 |
|
70 |
menuentry 'systemd' { |
71 |
linux /boot/kernel root=UUID=87e976c8-1411-4dab-9c63-d5c7eec9975f ro |
72 |
initrd /boot/ramfs |
73 |
} |
74 |
|
75 |
menuentry 'systemd (single)' { |
76 |
linux /boot/kernel root=UUID=87e976c8-1411-4dab-9c63-d5c7eec9975f ro single |
77 |
initrd /boot/ramfs |
78 |
} |
79 |
|
80 |
menuentry 'systemd (emergency)' { |
81 |
linux /boot/kernel root=UUID=87e976c8-1411-4dab-9c63-d5c7eec9975f ro emergency |
82 |
initrd /boot/ramfs |
83 |
} |
84 |
|
85 |
EOF |
86 |
|
87 |
root@sysd ~ # |