r/linuxadmin • u/Pei-Pa-Koa • May 04 '26
Automatically recreating /boot/efi/EFI/redhat/grub.cfg
Hi,
On a RHEL-based OS, is it possible to automatically recreate /boot/efi/EFI/redhat/grub.cfg?
It's a small wrapper file pointing to the "real" grub.cfg, example:
search --no-floppy --root-dev-only --fs-uuid --set=dev 840c1267-3f6d-464f-8acd-cfe9186edefd
set prefix=($dev)/grub2
export $prefix
configfile $prefix/grub.cfgIs there a script to create it?
Thanks,
EDIT: On RHEL 9, reinstalling the grub2-common package re-creates /boot/efi/EFI/redhat/grub.cfg, on RHEL 8 you have to do it manually.
5
Upvotes
1
u/Vogtinator May 05 '26
On SLE and openSUSE it's done by shim-install and grub2-install.
1
u/dodexahedron May 05 '26
RHEL 8 uses a wrapper around the wrapper scripts for grub, called grubby. Use that. It combines a lot of the functionality of the various scripts into one interface and is the preferred interface for rhel.
grubby --info=ALLwill show you what it currently knows about.If there's nothing, then use
grubby --add-kernel=....to add an entry for a given kernel.Have a look at
man grubbyAlso, to avoid this complexity in the future (or to fix the system now, too), at least consider almost any other bootloader, like systemd-boot, rEFInd, etc., rather than trying to find the correct incantations to please the BIOS and MBR gods that grub was originally designed to worship.
0
u/[deleted] May 04 '26
[deleted] — view deleted comment