Hiding A Grub Menuentry?

Home » CentOS » Hiding A Grub Menuentry?
CentOS 3 Comments

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 ?

Thanks

James Pearson

3 thoughts on - Hiding A Grub Menuentry?

  • I believe that you can accomplish what you are after by changing the quoted menuentry label in grub.cfg:

    menuentry ‘CentOS Linux (3.10.0-1062.1.2.el7.x86_64) 7 (Core)’ …

    to just a blank:

    menuentry ‘ ‘ …

    for the specific entry. I do this for the windows side of my dual-boot laptop. I boot to windows by scrolling down to the blank line below the CentOS entries.

  • Richard wrote:

    Looks like this might work – I can use a ‘blank’ label and also use the
    ‘–id’ option to allow grub2-reboot to select the required menuentry by its ‘id’ …

    Thanks

    James Pearson

  • 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 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):

    grub.cfg:
    … insmod read

    ### BEGIN /etc/grub.d/40_custom ###
    echo “Press the key to Boot.”
    read boot_cmd

    if [ x”${ boot_cmd}” == x”secret” ]; then clear linuxefi /images/pxeboot/vmlinuz inst.stage2=hd:LABEL