Difference between revisions of "Modern GRUBing"

Wiki.TerraBase.info
Jump to navigation Jump to search
m
Line 1: Line 1:
Rocky Linux 9 does not use the /etc/default/grub and /boot/grub2/grub.cfg Files any longer.  Instead the BLS (Boot Loader Specification) 'method' is used.  If one reads the documentation from RedHat, it seems like thing got really messy (and confusing).
Rocky Linux 9 does not use the /etc/default/grub and /boot/grub2/grub.cfg Files any longer.  Instead the BLS (Boot Loader Specification) 'method' is used.  If one reads the documentation from RedHat, it seems like thing got really messy (and confusing).


==== Quick D for Cloning, err, "Recreating" a drive from a BackUp (IE, the closest thing to Acronis that Linux seems to have) ====
====Quick D for Cloning, err, "Recreating" a drive from a BackUp (IE, the closest thing to Acronis that Linux seems to have)====


* Create a duplicate or functionally similar Partition layout to the original
*Create a duplicate or functionally similar Partition layout to the original
** CFDISK and "Logical Volume Commands"
**CFDISK and "Logical Volume Commands"
** Use Blivet from a Rocky 8 Live Boot Device<br />
**Use Blivet from a Rocky 8 Live Boot Device<br />


==== Rough D ====
====Rough D====


* Start from a 'Clean Slate': <code>wipefs -a /dev/sdX</code> (make dang sure the proper 'sdX' is chosen!)
*Start from a 'Clean Slate': <code>wipefs -a /dev/sdX</code> (make dang sure the proper 'sdX' is chosen!)
* Set the Partition Type (MBR or GPT): <code>cfdisk /dev/sdX</code>, (select DOS or GPT, save it (write) )
*Set the Partition Type (MBR or GPT): <code>cfdisk /dev/sdX</code>, (select DOS or GPT, save it (write) )
* Create Partitions: cfdisk
*Create Partitions: cfdisk
** https://en.wikipedia.org/wiki/Partition_type
**https://en.wikipedia.org/wiki/Partition_type
** Linux EXT4: $83 (that's Commodore Speaky for 83h)
**Linux EXT4: $83 (that's Commodore Speaky for 83h)
** Linux LVM (and LVM2): $8E
**Linux LVM (and LVM2): $8E
* LVM Stuff using Commands or BLIVET
*LVM Stuff using Commands or BLIVET (sadly only Rocky Linux 8)
** <code>pvcreate /dev/sdX</code>
**<code>pvcreate /dev/sdX</code>
** <code>vgcreate VG.NVMe.ROOT /dev/sdX</code>
**<code>vgcreate VG.NVMe.ROOT /dev/sdX</code>
*** <code>vgrename WhatEverOldName WhatEverNewName</code>
***<code>vgrename WhatEverOldName WhatEverNewName</code>
** <code>lvcreate -L 64G -n LV.ROOT VG.NVMe.ROOT</code>
**<code>lvcreate -L 64G -n LV.ROOT VG.NVMe.ROOT</code>
* BLIVET
*Format Partitions
**mkfs.vfat -F32 /dev/sdXy
**<code>mkfs.ext4 -v -L ROOT.EXT4 /dev/sdX ( -v = Verbose, -L = Label )</code>
**<code>mkswap -L SWAP /dev/sdaX</code>
*MBR Stuff if desired
*UEFI Stuff
**Make sure UEFI Stuff is installed (if cloning from an MBR / BIOS based system): dnf install -y grub2-efi-x64 grub2-efi-x64-modules shim-x64 efibootmgr
**<code>mkdir /mnt/efi</code>
**<code>mount /dev/nvme0n1p1 /mnt/efi</code>
**<code>grub2-install --target=x86_64-efi --efi-directory=/mnt/efi --bootloader-id=rocky --recheck --force --no-nvram --removable</code> ( --force = Do it on a supposedly 'non-secure' system, --no-nvram = Do it even if a target drive is being prepared as a UEFI Booted system even if the current OS is an MBR / BIOS system, --removable installs the 'generic' BOOTX64.EFI module so the system can boot before )
**Command to show information on how a system was booted (and can boot): <code>bootctl status</code>
**Command for EFIBootMgr: <code>efibootmgr -v</code>
*...and the tribulations continue as the below command won't work from an MBR / BIOS system or theoretically from any system that isn't the one being booted, run from etc.;
**Entry for Hardware Firmware (AKA BIOS Settings): efibootmgr --create --disk /dev/sdb --part 1 --loader /EFI/rocky/grubx64.efi --label "Rocky Linux" --verbose
**Work Around:


====BLS (Boot Loader Specification)====
====BLS (Boot Loader Specification)====
Line 88: Line 102:
*On '''UEFI systems''', <code>grub2-install</code> registers <code>grubx64.efi</code> with the UEFI boot manager using <code>efibootmgr</code>.
*On '''UEFI systems''', <code>grub2-install</code> registers <code>grubx64.efi</code> with the UEFI boot manager using <code>efibootmgr</code>.


=== More from ChatGPT on "GRUBing" ===
===More from ChatGPT on "GRUBing"===


= '''Comprehensive Guide to Installing GRUB on Rocky Linux (UEFI & BIOS)''' =
='''Comprehensive Guide to Installing GRUB on Rocky Linux (UEFI & BIOS)'''=
This guide covers:
This guide covers:


* '''UEFI bootloader installation''' on a target drive.
*'''UEFI bootloader installation''' on a target drive.
* '''Legacy BIOS (MBR) bootloader installation'''.
*'''Legacy BIOS (MBR) bootloader installation'''.
* '''BLS (Boot Loader Specification) and its effect on <code>grub2-mkconfig</code>.'''
*'''BLS (Boot Loader Specification) and its effect on <code>grub2-mkconfig</code>.'''
* '''GRUB Boot Stages Explanation (Stage 1, Stage 1.5, Stage 2).'''
*'''GRUB Boot Stages Explanation (Stage 1, Stage 1.5, Stage 2).'''
* '''How to properly configure bootloader entries and verify installation.'''
*'''How to properly configure bootloader entries and verify installation.'''


----
----


== '''1. Understanding GRUB Boot Stages''' ==
=='''1. Understanding GRUB Boot Stages'''==
{| class="wikitable"
{| class="wikitable"
!'''GRUB Stage'''
!'''GRUB Stage'''
Line 125: Line 139:
----
----


== '''2. Installing GRUB for UEFI Booting''' ==
=='''2. Installing GRUB for UEFI Booting'''==


=== '''A. Identify the Target Drive''' ===
==='''A. Identify the Target Drive'''===
List available drives and partitions:
List available drives and partitions:


Line 134: Line 148:
Example: If the target drive is <code>/dev/sdb</code>, and the EFI partition is <code>/dev/sdb1</code>, mount it:
Example: If the target drive is <code>/dev/sdb</code>, and the EFI partition is <code>/dev/sdb1</code>, mount it:


=== '''B. Bind System Directories (for Chroot)''' ===
==='''B. Bind System Directories (for Chroot)'''===
If configuring an external system:
If configuring an external system:


=== '''C. Install Required UEFI GRUB Packages''' ===
==='''C. Install Required UEFI GRUB Packages'''===


=== '''D. Install GRUB to the Target Drive''' ===
==='''D. Install GRUB to the Target Drive'''===


* <code>--target=x86_64-efi</code> → Specifies '''UEFI mode'''.
*<code>--target=x86_64-efi</code> → Specifies '''UEFI mode'''.
* <code>--efi-directory=/boot/efi</code> → Ensures GRUB is installed in the EFI partition.
*<code>--efi-directory=/boot/efi</code> → Ensures GRUB is installed in the EFI partition.
* <code>--bootloader-id=rocky</code> → Labels the boot entry as '''"Rocky"'''.
*<code>--bootloader-id=rocky</code> → Labels the boot entry as '''"Rocky"'''.
* <code>--recheck</code> → Forces a re-scan of the drive layout.
*<code>--recheck</code> → Forces a re-scan of the drive layout.


=== '''E. Generate the GRUB Configuration''' ===
==='''E. Generate the GRUB Configuration'''===
⚠ '''However, Rocky Linux follows BLS, which makes this step less critical''' (explained in Section 4).
⚠ '''However, Rocky Linux follows BLS, which makes this step less critical''' (explained in Section 4).
----
----


== '''3. Installing GRUB for Legacy BIOS (MBR Boot)''' ==
=='''3. Installing GRUB for Legacy BIOS (MBR Boot)'''==


=== '''A. Mount the Target Drive's Root Partition''' ===
==='''A. Mount the Target Drive's Root Partition'''===
If the system has a separate <code>/boot</code> partition:
If the system has a separate <code>/boot</code> partition:


=== '''B. Chroot into the Target System''' ===
==='''B. Chroot into the Target System'''===


=== '''C. Install Required BIOS GRUB Packages''' ===
==='''C. Install Required BIOS GRUB Packages'''===


=== '''D. Install GRUB to the MBR of the Target Drive''' ===
==='''D. Install GRUB to the MBR of the Target Drive'''===


* <code>--target=i386-pc</code> → '''Required for Legacy BIOS (MBR) booting'''.
*<code>--target=i386-pc</code> → '''Required for Legacy BIOS (MBR) booting'''.
* <code>/dev/sdb</code> → '''Must be the whole disk (not a partition like <code>/dev/sdb1</code>)'''.
*<code>/dev/sdb</code> → '''Must be the whole disk (not a partition like <code>/dev/sdb1</code>)'''.
* <code>--recheck</code> → Forces a disk layout rescan.
*<code>--recheck</code> → Forces a disk layout rescan.


=== '''E. Generate the GRUB Configuration''' ===
==='''E. Generate the GRUB Configuration'''===
⚠ '''But due to BLS, <code>grub.cfg</code> is no longer the main configuration source.'''
⚠ '''But due to BLS, <code>grub.cfg</code> is no longer the main configuration source.'''
----
----


== '''4. Understanding BLS (Boot Loader Specification)''' ==
=='''4. Understanding BLS (Boot Loader Specification)'''==
Rocky Linux follows '''BLS (Boot Loader Specification)''', meaning '''boot entries are controlled by systemd-boot entries, not <code>grub2-mkconfig</code>'''.
Rocky Linux follows '''BLS (Boot Loader Specification)''', meaning '''boot entries are controlled by systemd-boot entries, not <code>grub2-mkconfig</code>'''.


=== '''How to Manually Manage BLS Entries''' ===
==='''How to Manually Manage BLS Entries'''===


# '''List Existing Boot Entries:'''
#'''List Existing Boot Entries:'''
# '''Manually Create a BLS Entry:'''
#'''Manually Create a BLS Entry:'''
# '''Example BLS Entry (<code>rocky.conf</code>)'''
#'''Example BLS Entry (<code>rocky.conf</code>)'''
# '''Enable BLS Support in GRUB (if needed)'''
#'''Enable BLS Support in GRUB (if needed)'''


=== '''Why BLS Makes <code>grub2-mkconfig</code> Less Relevant''' ===
==='''Why BLS Makes <code>grub2-mkconfig</code> Less Relevant'''===


* '''Traditional GRUB entries are no longer used''' in Rocky Linux.
*'''Traditional GRUB entries are no longer used''' in Rocky Linux.
* The '''bootloader reads BLS entries instead'''.
*The '''bootloader reads BLS entries instead'''.
* '''<code>grub.cfg</code> is still used for bootloader settings''', but '''kernel entries are controlled by BLS'''.
*'''<code>grub.cfg</code> is still used for bootloader settings''', but '''kernel entries are controlled by BLS'''.


----
----


== '''5. Verify Installation''' ==
=='''5. Verify Installation'''==


=== '''Check EFI Boot Entries (For UEFI Only)''' ===
==='''Check EFI Boot Entries (For UEFI Only)'''===


=== '''Check GRUB Installation''' ===
==='''Check GRUB Installation'''===


=== '''Check BLS Entries''' ===
==='''Check BLS Entries'''===


=== '''Reboot and Test''' ===
==='''Reboot and Test'''===
----
----


== '''6. Summary''' ==
=='''6. Summary'''==
{| class="wikitable"
{| class="wikitable"
!'''Boot Mode'''
!'''Boot Mode'''
Line 222: Line 236:
<br />
<br />


== '''1. The Presence (or Absence) of <code>/boot/grub2/grub.cfg</code>''' ==
=='''1. The Presence (or Absence) of <code>/boot/grub2/grub.cfg</code>'''==


* If '''<code>grub.cfg</code> exists''', GRUB will parse it.
*If '''<code>grub.cfg</code> exists''', GRUB will parse it.
* If '''<code>grub.cfg</code> does NOT exist''', GRUB will attempt to '''read the BLS entries directly''' instead.
*If '''<code>grub.cfg</code> does NOT exist''', GRUB will attempt to '''read the BLS entries directly''' instead.


This means:
This means:
Line 234: Line 248:
----
----


== '''2. GRUB’s Bootloader Installation (<code>grub2-install</code>)''' ==
=='''2. GRUB’s Bootloader Installation (<code>grub2-install</code>)'''==
The actual bootloader installed to the disk controls whether it defaults to '''BLS mode or <code>grub.cfg</code> mode'''.
The actual bootloader installed to the disk controls whether it defaults to '''BLS mode or <code>grub.cfg</code> mode'''.


Line 241: Line 255:
(''where <code>/dev/sdX</code> is your boot disk, like <code>/dev/sda</code> or <code>/dev/nvme0n1</code>''), it does the following:
(''where <code>/dev/sdX</code> is your boot disk, like <code>/dev/sda</code> or <code>/dev/nvme0n1</code>''), it does the following:


* Sets up '''GRUB’s core image''' (<code>/boot/grub2/i386-pc/core.img</code> for BIOS systems or <code>/boot/efi/EFI/rocky/grubx64.efi</code> for UEFI systems).
*Sets up '''GRUB’s core image''' (<code>/boot/grub2/i386-pc/core.img</code> for BIOS systems or <code>/boot/efi/EFI/rocky/grubx64.efi</code> for UEFI systems).
* Embeds the logic for '''how GRUB will find and load boot entries'''.
*Embeds the logic for '''how GRUB will find and load boot entries'''.
* If BLS is active, it instructs GRUB to '''skip parsing <code>grub.cfg</code> and go directly to BLS entries'''.
*If BLS is active, it instructs GRUB to '''skip parsing <code>grub.cfg</code> and go directly to BLS entries'''.


This means: ✔ If GRUB was installed '''with BLS enabled''', even if <code>grub.cfg</code> exists, it may not be used.
This means: ✔ If GRUB was installed '''with BLS enabled''', even if <code>grub.cfg</code> exists, it may not be used.
Line 250: Line 264:
----
----


== '''How to Explicitly Switch Between BLS and <code>grub.cfg</code>''' ==
=='''How to Explicitly Switch Between BLS and <code>grub.cfg</code>'''==


=== '''To Force BLS Mode (and Ignore <code>grub.cfg</code> Completely)''' ===
==='''To Force BLS Mode (and Ignore <code>grub.cfg</code> Completely)'''===


# '''Ensure BLS entries exist''':  If this folder is empty, something is broken.
#'''Ensure BLS entries exist''':  If this folder is empty, something is broken.
# '''Delete <code>grub.cfg</code>''' (this ensures GRUB won’t use it):
#'''Delete <code>grub.cfg</code>''' (this ensures GRUB won’t use it):
# '''Ensure GRUB is installed with BLS support''':  ''(For UEFI systems; adjust for BIOS if needed.)''
#'''Ensure GRUB is installed with BLS support''':  ''(For UEFI systems; adjust for BIOS if needed.)''
# '''Reboot''' and verify that <code>grub.cfg</code> is no longer in use.
#'''Reboot''' and verify that <code>grub.cfg</code> is no longer in use.


----
----


=== '''To Force Legacy <code>grub.cfg</code> Mode (and Ignore BLS)''' ===
==='''To Force Legacy <code>grub.cfg</code> Mode (and Ignore BLS)'''===


# '''Ensure <code>grub.cfg</code> is present''':
#'''Ensure <code>grub.cfg</code> is present''':
# '''Reinstall GRUB to disable BLS mode''':  ''(The <code>--no-bootloader-spec</code> flag explicitly prevents GRUB from using BLS.)''
#'''Reinstall GRUB to disable BLS mode''':  ''(The <code>--no-bootloader-spec</code> flag explicitly prevents GRUB from using BLS.)''
# '''Reboot''' and verify that <code>grub.cfg</code> is being used.
#'''Reboot''' and verify that <code>grub.cfg</code> is being used.


----
----


=== '''Final Answer''' ===
==='''Final Answer'''===
✔ '''The real switch between BLS and <code>grub.cfg</code> is NOT in <code>/etc/default/grub</code>—it's controlled by how GRUB is installed and configured.'''
✔ '''The real switch between BLS and <code>grub.cfg</code> is NOT in <code>/etc/default/grub</code>—it's controlled by how GRUB is installed and configured.'''



Revision as of 11:56, 10 February 2025

Rocky Linux 9 does not use the /etc/default/grub and /boot/grub2/grub.cfg Files any longer. Instead the BLS (Boot Loader Specification) 'method' is used. If one reads the documentation from RedHat, it seems like thing got really messy (and confusing).

Quick D for Cloning, err, "Recreating" a drive from a BackUp (IE, the closest thing to Acronis that Linux seems to have)

  • Create a duplicate or functionally similar Partition layout to the original
    • CFDISK and "Logical Volume Commands"
    • Use Blivet from a Rocky 8 Live Boot Device

Rough D

  • Start from a 'Clean Slate': wipefs -a /dev/sdX (make dang sure the proper 'sdX' is chosen!)
  • Set the Partition Type (MBR or GPT): cfdisk /dev/sdX, (select DOS or GPT, save it (write) )
  • Create Partitions: cfdisk
  • LVM Stuff using Commands or BLIVET (sadly only Rocky Linux 8)
    • pvcreate /dev/sdX
    • vgcreate VG.NVMe.ROOT /dev/sdX
      • vgrename WhatEverOldName WhatEverNewName
    • lvcreate -L 64G -n LV.ROOT VG.NVMe.ROOT
  • Format Partitions
    • mkfs.vfat -F32 /dev/sdXy
    • mkfs.ext4 -v -L ROOT.EXT4 /dev/sdX ( -v = Verbose, -L = Label )
    • mkswap -L SWAP /dev/sdaX
  • MBR Stuff if desired
  • UEFI Stuff
    • Make sure UEFI Stuff is installed (if cloning from an MBR / BIOS based system): dnf install -y grub2-efi-x64 grub2-efi-x64-modules shim-x64 efibootmgr
    • mkdir /mnt/efi
    • mount /dev/nvme0n1p1 /mnt/efi
    • grub2-install --target=x86_64-efi --efi-directory=/mnt/efi --bootloader-id=rocky --recheck --force --no-nvram --removable ( --force = Do it on a supposedly 'non-secure' system, --no-nvram = Do it even if a target drive is being prepared as a UEFI Booted system even if the current OS is an MBR / BIOS system, --removable installs the 'generic' BOOTX64.EFI module so the system can boot before )
    • Command to show information on how a system was booted (and can boot): bootctl status
    • Command for EFIBootMgr: efibootmgr -v
  • ...and the tribulations continue as the below command won't work from an MBR / BIOS system or theoretically from any system that isn't the one being booted, run from etc.;
    • Entry for Hardware Firmware (AKA BIOS Settings): efibootmgr --create --disk /dev/sdb --part 1 --loader /EFI/rocky/grubx64.efi --label "Rocky Linux" --verbose
    • Work Around:

BLS (Boot Loader Specification)

Nope, not anymore (sort of): /etc/fstab

Nope, not anymore (sort of): grub2-mkconfig -o /tmp/boot/grub2/grub.cfg --root-directory=/tmp/LV.ROOT

Look in /boot/loader/entries and / or use GRUBBY

...see below for key information on /etc/default/grub and BLS

GRUB "Installation" for MBR / BIOS

Installs the Stage 1 Boot Code (program) in the MBR and Stage 1.5 Boot Code (program) in the "MBR Gap": grub2-install --target=i386-pc /dev/sdd

...and don't forget to set the Boot Partition active using CFDISK or something else

OR

Use DD to clone the Boot Partition

Sources

https://www.baeldung.com/linux/grub-menu-management

https://www.freedesktop.org/wiki/Specifications/BootLoaderSpec/ > https://uapi-group.org/specifications/specs/boot_loader_specification/

https://docs.redhat.com/en/documentation/red_hat_enterprise_linux/9/html/managing_monitoring_and_updating_the_kernel/configuring-kernel-command-line-parameters_managing-monitoring-and-updating-the-kernel

ChatGPT's Opinion

GRUB "Installation" (What Does grub2-install Do?)

The grub2-install command is used to install the GRUB bootloader onto a disk or partition. It places the necessary GRUB boot code onto the target disk and copies GRUB modules required for booting.

How grub2-install Works

When executed, grub2-install performs the following actions:

1. Determines the Installation Target

  • If given a disk (e.g., /dev/sda), it installs GRUB to the MBR or GPT boot partition.
  • If given a partition (e.g., /dev/sda1), it may fail or install to the partition's boot sector (not recommended).
  • If on a BIOS system, it installs the i386-pc GRUB bootloader.
  • If on a UEFI system, it installs x86_64-efi and places EFI files in the EFI system partition.

2. Copies GRUB Core to the Correct Location

  • On BIOS/MBR systems, GRUB places its boot code in the MBR and additional code in the post-MBR gap (sectors after the MBR).
  • On GPT systems using BIOS (BIOS-GPT), it places GRUB in the BIOS Boot Partition.
  • On UEFI systems, it installs the grubx64.efi file into the EFI System Partition (ESP).

3. Selects the Correct GRUB Modules

  • grub2-install determines which GRUB modules are needed based on the filesystem, partition layout, and system firmware.
  • It installs these modules into /boot/grub2/ (BIOS) or /boot/efi/EFI/ (UEFI).

4. Writes GRUB Boot Code

  • BIOS (MBR) Installation:
    • The Stage 1 boot code is written into the MBR.
    • The Stage 1.5 boot code is stored in the post-MBR gap (if available).
    • The Stage 2 boot code (GRUB core modules) is stored in /boot/grub2/.
  • UEFI Installation:
    • The grubx64.efi file is copied to the EFI System Partition.
    • GRUB is registered as a boot entry with the system's UEFI firmware.

5. Registers the Bootloader (If UEFI)

  • On UEFI systems, grub2-install registers grubx64.efi with the UEFI boot manager using efibootmgr.

More from ChatGPT on "GRUBing"

Comprehensive Guide to Installing GRUB on Rocky Linux (UEFI & BIOS)

This guide covers:

  • UEFI bootloader installation on a target drive.
  • Legacy BIOS (MBR) bootloader installation.
  • BLS (Boot Loader Specification) and its effect on grub2-mkconfig.
  • GRUB Boot Stages Explanation (Stage 1, Stage 1.5, Stage 2).
  • How to properly configure bootloader entries and verify installation.

1. Understanding GRUB Boot Stages

GRUB Stage Description Applies To
Stage 1 MBR code (first 512 bytes of disk) loads Stage 1.5 or Stage 2. Legacy BIOS (MBR) Only
Stage 1.5 Located in the first 30KB after MBR, it helps find /boot/grub2. Legacy BIOS (MBR) Only
Stage 2 Loads the GRUB menu, kernel, and initrd. Both UEFI and BIOS
UEFI Firmware Boot Uses the EFI System Partition (ESP) instead of MBR. Loads grubx64.efi. UEFI Only

2. Installing GRUB for UEFI Booting

A. Identify the Target Drive

List available drives and partitions:

Look for the EFI System Partition (ESP), usually formatted as FAT32 (vfat).

Example: If the target drive is /dev/sdb, and the EFI partition is /dev/sdb1, mount it:

B. Bind System Directories (for Chroot)

If configuring an external system:

C. Install Required UEFI GRUB Packages

D. Install GRUB to the Target Drive

  • --target=x86_64-efi → Specifies UEFI mode.
  • --efi-directory=/boot/efi → Ensures GRUB is installed in the EFI partition.
  • --bootloader-id=rocky → Labels the boot entry as "Rocky".
  • --recheck → Forces a re-scan of the drive layout.

E. Generate the GRUB Configuration

However, Rocky Linux follows BLS, which makes this step less critical (explained in Section 4).


3. Installing GRUB for Legacy BIOS (MBR Boot)

A. Mount the Target Drive's Root Partition

If the system has a separate /boot partition:

B. Chroot into the Target System

C. Install Required BIOS GRUB Packages

D. Install GRUB to the MBR of the Target Drive

  • --target=i386-pcRequired for Legacy BIOS (MBR) booting.
  • /dev/sdbMust be the whole disk (not a partition like /dev/sdb1).
  • --recheck → Forces a disk layout rescan.

E. Generate the GRUB Configuration

But due to BLS, grub.cfg is no longer the main configuration source.


4. Understanding BLS (Boot Loader Specification)

Rocky Linux follows BLS (Boot Loader Specification), meaning boot entries are controlled by systemd-boot entries, not grub2-mkconfig.

How to Manually Manage BLS Entries

  1. List Existing Boot Entries:
  2. Manually Create a BLS Entry:
  3. Example BLS Entry (rocky.conf)
  4. Enable BLS Support in GRUB (if needed)

Why BLS Makes grub2-mkconfig Less Relevant

  • Traditional GRUB entries are no longer used in Rocky Linux.
  • The bootloader reads BLS entries instead.
  • grub.cfg is still used for bootloader settings, but kernel entries are controlled by BLS.

5. Verify Installation

Check EFI Boot Entries (For UEFI Only)

Check GRUB Installation

Check BLS Entries

Reboot and Test


6. Summary

Boot Mode Target Option for GRUB Install Command Config Location
UEFI x86_64-efi grub2-install --target=x86_64-efi --efi-directory=/boot/efi --bootloader-id=rocky /boot/efi/EFI/rocky/grub.cfg
BIOS (MBR) i386-pc grub2-install --target=i386-pc /dev/sdb /boot/grub2/grub.cfg
BLS (Rocky Linux Default) systemd-boot controlled bootctl list /boot/loader/entries/


1. The Presence (or Absence) of /boot/grub2/grub.cfg

  • If grub.cfg exists, GRUB will parse it.
  • If grub.cfg does NOT exist, GRUB will attempt to read the BLS entries directly instead.

This means:

Deleting grub.cfg forces GRUB to rely entirely on BLS.

Regenerating grub.cfg (grub2-mkconfig) puts GRUB back into a "hybrid mode" where it may still reference BLS but also maintain compatibility with legacy boot setups.


2. GRUB’s Bootloader Installation (grub2-install)

The actual bootloader installed to the disk controls whether it defaults to BLS mode or grub.cfg mode.

When GRUB is installed with:

(where /dev/sdX is your boot disk, like /dev/sda or /dev/nvme0n1), it does the following:

  • Sets up GRUB’s core image (/boot/grub2/i386-pc/core.img for BIOS systems or /boot/efi/EFI/rocky/grubx64.efi for UEFI systems).
  • Embeds the logic for how GRUB will find and load boot entries.
  • If BLS is active, it instructs GRUB to skip parsing grub.cfg and go directly to BLS entries.

This means: ✔ If GRUB was installed with BLS enabled, even if grub.cfg exists, it may not be used.

✔ If GRUB was installed without BLS support, it will fall back to grub.cfg.


How to Explicitly Switch Between BLS and grub.cfg

To Force BLS Mode (and Ignore grub.cfg Completely)

  1. Ensure BLS entries exist: If this folder is empty, something is broken.
  2. Delete grub.cfg (this ensures GRUB won’t use it):
  3. Ensure GRUB is installed with BLS support: (For UEFI systems; adjust for BIOS if needed.)
  4. Reboot and verify that grub.cfg is no longer in use.

To Force Legacy grub.cfg Mode (and Ignore BLS)

  1. Ensure grub.cfg is present:
  2. Reinstall GRUB to disable BLS mode: (The --no-bootloader-spec flag explicitly prevents GRUB from using BLS.)
  3. Reboot and verify that grub.cfg is being used.

Final Answer

The real switch between BLS and grub.cfg is NOT in /etc/default/grub—it's controlled by how GRUB is installed and configured.

Deleting grub.cfg forces BLS mode, provided GRUB was installed with BLS support.

Reinstalling GRUB with --no-bootloader-spec forces it to use grub.cfg instead of BLS.

To change modes, you must either delete grub.cfg (to force BLS) or reinstall GRUB (to force legacy mode).