[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: grub2 boot menu



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


Reply to: