Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Re: grub2 boot menu

42 views
Skip to first unread message

Greg Wooledge

unread,
Jun 24, 2021, 10:10:05 AM6/24/21
to
On Thu, Jun 24, 2021 at 02:51:06PM +0100, mick crane wrote:
> I was dual booting but got another PC so I can have windows and debain at
> the same time. Just for tidiness of booting I'd have liked to comment out
> the submenu entry in /boot/grub/grub.cfg for windows just in case I wanted
> to put it back but not allowed.
> Physically removing the windows disk and "grub-mkconfig" and/or
> "update-grub" sorts itself out but is there any way to do this manually as
> used to be the case ?

You want the GRUB menu to skip over Windows? The easiest way would
probably be to remove the os-prober package, so update-grub never sees
Windows and never includes it in the generated menu.

Felix Miata

unread,
Jun 24, 2021, 10:40:05 AM6/24/21
to
mick crane composed on 2021-06-24 14:51 (UTC+0100):

> I was dual booting but got another PC so I can have windows and debain
> at the same time. Just for tidiness of booting I'd have liked to comment
> out the submenu entry in /boot/grub/grub.cfg for windows just in case I
> wanted to put it back but not allowed.
> Physically removing the windows disk and "grub-mkconfig" and/or
> "update-grub" sorts itself out but is there any way to do this manually
> as used to be the case ?

You can use any of:
/etc/grub.d/40_custom
/etc/grub.d/41_custom
/boot/grub/custom.cfg
or 40_custom and/or 41_custom copied e.g. to
/etc/grub.d/06_custom or /etc/grub.d/07_custom.
The actual names in /etc/grub.d/ do not seem to be carved in stone, but
/boot/grub/custom.cfg does seem to be. Within the /etc/grub.d/ hierarchy,
the names affect where the custom entries appear in the boot menu. Before
10 entries are first listed, the 4x entries are shown after the auto-generated
entries. I use custom.cfg, which I populate with the kernel & initrd symlinks
so that need to maintain custom.cfg is minimal.

The custom.cfg entries can be seriously simplified compared to the auto-generated
ones. e.g.:

menuentry "Debian 11 Bullseye defkernel" {
search --no-floppy --set=root --hint-baremetal=ahci0,gpt9 --label tg1p09deb11
linuxefi /vmlinuz root=LABEL=tg1p09deb11 noresume ipv6.disable=1 net.ifnames=0 mitigations=auto consoleblank=0
initrdefi /initrd.img
}

Note omission of UUIDs and inclusion of volume labels in their place.
--
Evolution as taught in public schools is, like religion,
based on faith, not based on science.

Team OS/2 ** Reg. Linux User #211409 ** a11y rocks!

Felix Miata

The Wanderer

unread,
Jun 24, 2021, 10:50:05 AM6/24/21
to
On 2021-06-24 at 10:32, Felix Miata wrote:

> mick crane composed on 2021-06-24 14:51 (UTC+0100):
>
>> I was dual booting but got another PC so I can have windows and debain
>> at the same time. Just for tidiness of booting I'd have liked to comment
>> out the submenu entry in /boot/grub/grub.cfg for windows just in case I
>> wanted to put it back but not allowed.
>> Physically removing the windows disk and "grub-mkconfig" and/or
>> "update-grub" sorts itself out but is there any way to do this manually
>> as used to be the case ?
>
> You can use any of:
> /etc/grub.d/40_custom
> /etc/grub.d/41_custom
> /boot/grub/custom.cfg
> or 40_custom and/or 41_custom copied e.g. to
> /etc/grub.d/06_custom or /etc/grub.d/07_custom.

From looking at those files, it seems as if they can be used to *add*
entries manually, and your example matches up with doing that - but can
they be used to modify (or remove) entries which would otherwise appear,
as seems to be the desire in this instance? I'm not seeing an obvious
way how, if so.

--
The Wanderer

The reasonable man adapts himself to the world; the unreasonable one
persists in trying to adapt the world to himself. Therefore all
progress depends on the unreasonable man. -- George Bernard Shaw

signature.asc

David Wright

unread,
Jun 24, 2021, 3:10:05 PM6/24/21
to
On Thu 24 Jun 2021 at 14:51:06 (+0100), mick crane wrote:
> I was dual booting but got another PC so I can have windows and debain
> at the same time. Just for tidiness of booting I'd have liked to
> comment out the submenu entry in /boot/grub/grub.cfg for windows just
> in case I wanted to put it back but not allowed.
> Physically removing the windows disk and "grub-mkconfig" and/or
> "update-grub" sorts itself out but is there any way to do this
> manually as used to be the case ?

Some BIOSes will allow you to turn off a disk interface.
But I can't see the point, myself. I've only done this
when I had an interface that would stall booting (and
updating Grub) for 10 minutes while it repeatedly timed
out many many times. (IOW it was broken.)

The Windows entry would disappear when grub.cfg is rebuilt
(unless you edit it yourself). Of course, when you wanted
Windows back, you'd need to rebuild grub.cfg again before
you could boot it (unless you learn a few raw Grub commands).

Can you not just ignore the entry. It's usually right at the
bottom of the list. In fact, do you really *read* the grub
menu when you boot?

Cheers,
David.

didier gaumet

unread,
Jun 24, 2021, 3:30:04 PM6/24/21
to

Hello, 

Grub can ignore all or only certain OSes that os-prober detects by
setting up the desired behaviour in /etc/default/grub

from the grub info page:
[...]"
'GRUB_DISABLE_OS_PROBER'
Normally, 'grub-mkconfig' will try to use the external 'os-prober'
program, if installed, to discover other operating systems
installed on the same system and generate appropriate menu entries
for them. Set this option to 'true' to disable this.

'GRUB_OS_PROBER_SKIP_LIST'
List of space-separated FS UUIDs of filesystems to be ignored from
os-prober output. For efi chainloaders it's <UUID>@<EFI FILE>
"[...]

:-)

elvis

unread,
Jun 25, 2021, 3:10:06 AM6/25/21
to

On 24/6/21 11:51 pm, mick crane wrote:
> hello,
> I was dual booting but got another PC so I can have windows and debain
> at the same time. Just for tidiness of booting I'd have liked to
> comment out the submenu entry in /boot/grub/grub.cfg for windows just
> in case I wanted to put it back but not allowed.
> Physically removing the windows disk and "grub-mkconfig" and/or
> "update-grub" sorts itself out but is there any way to do this
> manually as used to be the case ?
> mick

you can still edit /boot/grub/grub.cfg

It's a bit more complex than the old grub but it's pretty obvious which bit it which when you look at it.

Any changes will be overwritten by grub-mkconfig but I assume that is what you want.



--
Sir John Hoskyns, an adviser to Margaret Thatcher, observed that governments are formed from ?a talent pool that could not sustain a single multinational company.?

Cindy Sue Causey

unread,
Jun 25, 2021, 11:50:04 AM6/25/21
to
This is basically just noise, but, ooohhh, that sounds NICE.... and
HANDY. I'm wondering how many other tricks like that exist that never
see the light of day. In a perfect World, maybe someone with deep
knowledge of those features could approach Debian-Publicity about
submitting e.g. "Hey, Did You Know You Can...." tips that are included
in their newsletters and updates?

Speaking as someone with cognitive issues such that I operate as a
perennial newbie, it would surely help if someone could point GRUB
Users to what that "<EFI FILE>" is referencing.

For now, it just sounds like part of the fancier loading needs that
are occasionally discussed here on Debian-User. My thought process is
that maybe hearing it further described will trigger a fellow lurker's
interest in learning more about how their Debian works right from the
boot beginning.

Cindy :)
--
Cindy-Sue Causey
Talking Rock, Pickens County, Georgia, USA

* runs with birdseed *

didier gaumet

unread,
Jun 25, 2021, 3:20:05 PM6/25/21
to


Le vendredi 25 juin 2021 à 11:40 -0400, Cindy Sue Causey a écrit :
> On 6/24/21, didier gaumet <didier...@gmail.com> wrote:
>
[...]
> > 'GRUB_OS_PROBER_SKIP_LIST'
> >     List of space-separated FS UUIDs of filesystems to be ignored
> > from
> >      os-prober output.  For efi chainloaders it's <UUID>@<EFIFILE>"
[...]
> it would surely help if someone could point GRUB
> Users to what that "<EFI FILE>" is referencing.
[...]

My laptop (with an EFI firmware) has a dual boot with Debian Bullseye
and Windows 10. In this Windows 10 case, it is an EFI chainloading
(that would not be the case (chainloading) with another OS without its
self bootloader installed and properly configured)

My /boot/grub.grub.cfg contains:
"[...]
### BEGIN /etc/grub.d/30_os-prober ###
menuentry 'Windows Boot Manager (on /dev/nvme0n1p3)' --class windows --
class os $menuentry_id_option 'osprober-efi-FAF2-88F6' {
insmod part_gpt
insmod fat
if [ x$feature_platform_search_hint = xy ]; then
search --no-floppy --fs-uuid --set=root FAF2-88F6
else
search --no-floppy --fs-uuid --set=root FAF2-88F6
fi
chainloader /EFI/Microsoft/Boot/bootmgfw.efi
}
### END /etc/grub.d/30_os-prober ###
[...]"

I edit /etc/default/grub to add this line:
GRUB_OS_PROBER_SKIP_LIST='FAF2-88F6@/EFI/Microsoft/Boot/bootmgfw.efi'

then I update the config:
didier@hp-notebook14:~$ sudo update-grub
Generating grub configuration file ...
Found background image: /usr/share/images/desktop-base/desktop-grub.png
Found linux image: /boot/vmlinuz-5.10.0-7-amd64
Found initrd image: /boot/initrd.img-5.10.0-7-amd64
Skipped Windows Boot Manager on
/dev/nvme0n1p3@/EFI/Microsoft/Boot/bootmgfw.efi by user request.
Adding boot menu entry for EFI firmware configuration
done

So the Windows 10 entry has been skipped

It is confirmed by inspecting /boot/grub/grub.cfg:
"[...]
### BEGIN /etc/grub.d/30_os-prober ###
### END /etc/grub.d/30_os-prober ###
[...]"

Cheers :-)
0 new messages