Rocky 9 Linux Booting Notes
This guy (jlehtone) actually sums it up fairly well;
On Rocky 8 [and Rocky 9] the boot process has two options:
- Legacy boot loads GRUB from
/boot/grub2/
and GRUB reads/boot/grub2/grub.cfg
- UEFI boot loads GRUB from
/boot/efi/EFI/rocky/
and GRUB reads/boot/efi/EFI/rocky/grub.cfg
On Rocky 9 the same happens, but the /boot/efi/EFI/rocky/grub.cfg
is a wrapper that makes the UEFI GRUB read /boot/grub2/grub.cfg
.
Either way, you do need only one real grub.cfg
In all cases, the there are two options:
- BLS is enabled and the grub.cfg should include
/boot/loader/entries/*.conf
files as boot entries. This is the default - BLS is disabled and all boot entries are within the grub.cfg
The entries as separate (BLS) files is easier for kernel updates: simply create file for new kernel and remove file of removed kernel. With entries in grub.cfg requires insert/remove lines type edits.
If no BLS entries were found, had they been erased, or did GRUB’s “locate BLS entries” somehow fail?
FROM: https://forums.rockylinux.org/t/grub-empty-after-dnf-upgrade/18132/9
Commands
Makes the /grub2/grub.cfg file based on settings in /etc/default/grub file: grub2-mkconfig -o /boot/grub2/grub.cfg
Makes a custom .efi File with a lot of extra modules (not needed if one of the below DNF commands is done): grub2-install --target=x86_64-efi --efi-directory=/boot/efi --bootloader-id=rocky --modules="part_gpt part_msdos fat ext2 normal linux configfile search search_fs_uuid lvm"
DNF Install Command for UEFI systems: dnf reinstall grub2-efi-x64 grub2-efi-x64-modules shim-x64 grub2-tools
DNF GRUB related install Commands for BIOS based systems: dnf install grub2-pc
And on this note;
https://bbs.archlinux.org/viewtopic.php?id=258039
set root=(hd0,gpt2)
linux /vmlinuz root=/dev/mapper/NVMe.P3-LV.ROOT ro
initrd /initramfs.img
boot
OR
configfile (hd0,gpt1)/grub2/grub.cfg
NOTE: Some would have you put this, but DON'T: configfile (hd0,gpt1)/boot/grub2/grub.cfg
efi/EFI/WhatEverNamedBootLoaderID/grub.cfg (usually /efi/EFI/rocky/grub.cfg)
grub.cfg "Stub File" that 'points' to /grub2/grub.cfg (that's the path from the "I am the booting OS" perspective, which is of course in /boot/grub2/grub.cfg after Linux has booted.
search --no-floppy --root-dev-only --fs-uuid --set=dev 5603d694-79c2-4c70-9200-2e11ab3c20e8
set prefix=($dev)/grub2
export $prefix
configfile $prefix/grub.cfg
...and for the above, look at that --set=dev UUID, make sure it is correct!
...and also, check the following;
Next time a new kernel is installed via DNF, make sure the /etc/default/grub and /etc/kernel/cmdline Files are configured properly.
And for LVM Related items
If changing an LV or VG name;
- fstab
- /etc/default/grub
- /etc/kernel/cmdline
- grub-mkconfig OR edit /boot/grub2/grub.cfg
- /boot/loader/entries
And for the annoying TUNED or GRUB automatically added entries similar to what's in /boot/loader/entries
dnf remove tuned
In /etc/default/grub, add: GRUB_DISABLE_OS_PROBER=true
..then grub2-mkconfig -o /boot/grub2/grub.cfg