[CentOS] Hiding a grub menuentry?

Thu Oct 17 20:19:45 UTC 2019
Young, Gregory <gregory.young at solarwinds.com>

As long as you include the Grub modules (an issue I ran into with UEFI boot last week on an .iso), you can use the "read" module to prompt for a hidden command. Load the read module at the top, then at the end, put in your prompt and secret boot option. In the case, you type "secret" at the prompt. If you hit <ENTER> as suggested, you get the normal boot menu without the secret option (below boot EFI, but it is a very similar process for BIOS, just use the BIOS linux and initrd commands):

insmod read
### BEGIN /etc/grub.d/40_custom ###
echo "Press the <ENTER> key to Boot."
read boot_cmd

if [ x"${ boot_cmd}" == x"secret" ]; then
	linuxefi /images/pxeboot/vmlinuz inst.stage2=hd:LABEL=CentOS\x207\x20x86_64 inst.ks=hd:LABEL=CentOS\x207\x20x86_64:/efiks.cfg inst.graphical rhgb quiet
	initrdefi /images/pxeboot/initrd.img
### END /etc/grub.d/40_custom ###

Gregory Young 

-----Original Message-----
From: CentOS <centos-bounces at centos.org> On Behalf Of James Pearson
Sent: October 15, 2019 9:53 AM
To: CentOS mailing list <centos at centos.org>
Subject: [CentOS] Hiding a grub menuentry?

Does anyone know if it is possible to 'hide' a grub menuentry with CentOS 7 ?

I have a custom menuentry that I don't want to be seen on the grub screen - but it needs to be selectable as the entry to boot via 'grub2-reboot'

I've scanned the grub2 documentation - but I can't find anything obvious
- so I'm guessing it can't be done - unless someone knows otherwise ?


James Pearson
CentOS mailing list
CentOS at centos.org