skip to Main Content

How to list GRUB2’s “menuentries” in command-line under Centos-8?
The used workable method “fgrep menuentry /etc/grub2.conf” failed.

Because at Centos-8/RHEL-8, they DO NOT store menuentry in /etc/grub2.conf.
Instead, they search and build entries at booting runtime.

And how to add a custom cmdline parameter to special menuentry?
There is no menuentry in /etc/grub2.conf, I can not edit any menuentry.

2

Answers


  1. Grub menu entries in RHEL/CentOS 8 are assembled from various files and scripts so we won’t see static entries as was the case for previous versions of the OSes. (You can see the un-expanded boot entry configuration files located in the /boot/loader/entries/ directory)

    In order to view the default menu entry, you can use:

    grubby --info DEFAULT
    

    In order to view all the menu entries, you can use:

    grubby --info ALL
    

    The latter also gives us the corresponding index for each of the entries that can be useful. For instance, the following will list the meny entry details for the 3rd entry:

    grubby --info 2
    

    In order to customize a specific entry you can do so by either referencing the index:

    grubby --args amd_iommu=on --update-kernel 2
    

    Or by simply using the kernel version as the following for the current kernel:

    grubby --args amd_iommu=on --update-kernel=/boot/vmlinuz-$(uname -r) 
    

    Once you do a modification to an entry, the options should be expanded and listed in the corresponding entry file in /boot/loader/entries/ (otherwise you will see variables).

    Login or Signup to reply.
  2. Unfortunately, grubby won’t list menu entries that you’ve added to /boot/grub2/custom.cfg (loaded by /etc/grub.d/41_custom). I’m not sure if it will include entries loaded in /etc/grub.d/40_custom, either.

    I’ve had some success seeing grub’s menu entries by compiling grub2-emu and running that:

    https://github.com/Jolicloud/grub2/blob/master/util/grub-emu.c

    It’s available in some repositories as the grub-emu or grub2-emu package. It shows you a simulation of the grub menu, as it would appear at boot time.

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search