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
> Date: Tuesday, October 15, 2019 14:52:39 +0100 > From: James Pearson <james-p at moving-picture.com> > > 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 ?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:> ** CAUTION: This email originated from outside of the organization. Do not click links or open attachments unless you recognize the sender and know the content is safe. ** > > >> Date: Tuesday, October 15, 2019 14:52:39 +0100 >> From: James Pearson <james-p at moving-picture.com> >> >> 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 ? > > 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.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 <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): grub.cfg: ... 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 clear 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 boot fi ### 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 ? Thanks James Pearson _______________________________________________ CentOS mailing list CentOS at centos.org https://lists.centos.org/mailman/listinfo/centos