Ultimate Guide to Fixing GRUB on UEFI Systems | Reinstall GRUB and GRUB2 in 6 Steps!

πŸ”§ Ultimate Guide to Fixing GRUB on UEFI Systems | Motherboard Changed, grub.cfg Lost? 6 Steps to Reinstall GRUB!

πŸ“– Introduction: Do You Feel This Way Too?

First Paragraph: Pain Point Scenario

Have you ever encountered such a desperate situation? The server suddenly fails to boot, the screen is black, and you can’t even see the GRUB menu. You try various methods, but the system is stuck at the boot stage, and you can’t even access the operating system!

Worse still, you find:

β€’The motherboard has just been replaced, and the system cannot boot to GRUB.β€’<span><span>/boot/efi/EFI/redhat/grub.cfg</span></span> file has been accidentally deleted or corrupted.β€’The system is in UEFI mode, and you are afraid to run <span><span>grub-install</span></span> casually, fearing it will make things worse.

You try to enter rescue mode but don’t know what to do next. Your boss asks you, “Why can’t the system boot?” You can only helplessly reply, “GRUB is having issues, but I don’t know how to fix it…” This vicious cycle of “GRUB failure, system cannot boot” is driving you crazy, isn’t it?

If you have also experienced this nightmare of “GRUB failure on UEFI systems,” then today FYC has good news for you:Reinstalling GRUB on UEFI systems actually follows a standard procedure! As long as you follow the correct steps, you can safely restore GRUB boot!

Second Paragraph: Overview of the Solution

Today we will discussreinstalling GRUB and GRUB2 on UEFI-based computers, which is a key skill in RHEL system maintenance. We will start with the principles of UEFI booting and guide you step by step on how to reinstall GRUB in rescue mode and how to correctly add UEFI boot entries.

This article will bring you:

β€’πŸŽ― Principles of UEFI Booting: Why can’t UEFI systems run grub-install directly? What is the UEFI boot process?β€’πŸ”§ Complete Repair Process: A 6-step complete guide from entering rescue mode to reinstalling GRUB.β€’βœ… Differences in RHEL Versions: Different handling methods for RHEL 6, RHEL 7+, and RHEL 9+.β€’βš οΈ Key Considerations: 5 major pitfalls in UEFI system GRUB repair to avoid.β€’πŸ’‘ Practical Case Analysis: Handling methods for real scenarios such as motherboard replacement and grub.cfg loss.

Follow FYC, and say goodbye to the era of “GRUB failure on UEFI systems!”

Third Paragraph: 5-Dimensional Scoring Table

Dimension Score Description
Difficulty Level ⭐⭐ Requires a deep understanding of UEFI boot process and GRUB mechanism.
Practical Value ⭐⭐⭐⭐⭐ Solves key issues of UEFI system boot failure.
Technical Depth ⭐⭐ Involves UEFI, GRUB2, shim, efibootmgr.
Operability ⭐⭐⭐⭐⭐ All commands and configurations can be used directly.
Urgency ⭐⭐⭐⭐⭐ System boot failure is usually the highest priority issue, affecting a wide range.

πŸ“š Main Content: Packed with Useful Information!

⚑ 1. Principles of UEFI Booting: Why Can’t grub-install Be Run Directly?

πŸ“‹ UEFI vs BIOS: Fundamental Differences in Boot Process

In traditional BIOS systems, the boot process is relatively simple:

BIOS β†’ MBR (Master Boot Record) β†’ GRUB β†’ Kernel Boot

But in UEFI systems, the boot process is more complex:

UEFI Firmware β†’ EFI System Partition (ESP) β†’ shim.efi β†’ grubx64.efi β†’ Kernel Boot

Key Differences:

β€’βœ… BIOS Systems: GRUB is installed in the MBR or partition boot sector, and you can run <span><span>grub-install</span></span> or <span><span>grub2-install</span></span> directly to repair.β€’βŒ UEFI Systems: GRUB is stored as an EFI executable file (.efi) in the EFI system partition (ESP),and cannot run grub-install/grub2-install directly on the boot disk.β€’βš οΈ Important Warning: Running <span><span>grub-install</span></span> or <span><span>grub2-install</span></span> directly on the boot disk in UEFI systems may corrupt the UEFI boot configuration!

🎯 Key Components of UEFI Booting

In UEFI systems, the following key components are required for booting:

1EFI System Partition (ESP): Usually <span><span>/boot/efi</span></span>, formatted as FAT32.2shim.efi: The bridge for secure boot, located at <span><span>/boot/efi/EFI/redhat/shimx64.efi</span></span>3grubx64.efi: The EFI executable file for GRUB2, located at <span><span>/boot/efi/EFI/redhat/grubx64.efi</span></span>4grub.cfg: The GRUB configuration file, located at <span><span>/boot/efi/EFI/redhat/grub.cfg</span></span> (RHEL 9+) or <span><span>/boot/grub2/grub.cfg</span></span>5UEFI Boot Entries: Stored in the motherboard’s NVRAM, pointing to shim.efi or grub.efi.

Example of File Structure:

/boot/efi/EFI/redhat/
β”œβ”€β”€ shimx64.efi          # Bridge for secure boot
β”œβ”€β”€ grubx64.efi          # GRUB2 EFI executable
β”œβ”€β”€ grub.cfg             # GRUB configuration file (RHEL 9+)
└── BOOTX64.CSV          # Boot entry configuration

πŸ“Š Common GRUB Failure Scenarios

β€’βŒ Motherboard Replacement: The UEFI firmware of the new motherboard does not have the correct boot entry and cannot find GRUB.β€’βŒ grub.cfg Deleted: <span><span>/boot/efi/EFI/redhat/grub.cfg</span></span> has been accidentally deleted or corrupted.β€’βŒ EFI File Corrupted: <span><span>shimx64.efi</span></span> or <span><span>grubx64.efi</span></span> file is corrupted.β€’βŒ ESP Partition Issues: The EFI system partition is corrupted or cannot be mounted.β€’βŒ UEFI Boot Entry Missing: The boot entry in NVRAM has been cleared or corrupted.

πŸ”§ 2. UEFI System GRUB Repair: 6-Step Complete Guide

Repairing GRUB on UEFI systems requires 6 steps, each of which is crucial!

Step 1: Enter Rescue Mode

First, you must enter rescue mode to repair GRUB.

Method 1: Use Installation Media to Enter Rescue Mode

# 1. Boot the system using RHEL installation media (DVD or USB)
# 2. In the installation interface, select "Troubleshooting" β†’ "Rescue a Red Hat Enterprise Linux system"
# 3. Follow the prompts to select language, keyboard layout, etc.
# 4. Choose whether to start the network (recommended to select Yes)
# 5. Choose whether to find and mount the installed system (select Continue)
# 6. The system will automatically mount to /mnt/sysimage

Method 2: Use grub rescue (if you can still see the GRUB interface)

If the system can still display the GRUB interface, you can try using the GRUB command line:

# Press 'c' on the GRUB interface to enter command line mode
grub> set root=(hd0,gpt1)  # Set ESP partition
grub> linux /vmlinuz-$(uname -r) root=/dev/mapper/rhel-root
grub> initrd /initramfs-$(uname -r).img
grub> boot

⚠️ Important Note:

β€’After entering rescue mode, the system will mount to <span><span>/mnt/sysimage</span></span>β€’You need to <span><span>chroot</span></span> to <span><span>/mnt/sysimage</span></span> to perform repair operations.β€’Ensure the network is available (if you need to download packages).

Step 2: Mount the System and chroot

After entering rescue mode, you need to mount the system and switch to the system root directory.

# 1. Check if the system has been automatically mounted
ls /mnt/sysimage

# 2. If not automatically mounted, mount manually
# Assuming the root partition is /dev/sda2, and the ESP partition is /dev/sda1
mkdir -p /mnt/sysimage
mount /dev/sda2 /mnt/sysimage
mount /dev/sda1 /mnt/sysimage/boot/efi

# 3. Mount necessary virtual file systems
mount --bind /dev /mnt/sysimage/dev
mount --bind /proc /mnt/sysimage/proc
mount --bind /sys /mnt/sysimage/sys
mount --bind /run /mnt/sysimage/run

# 4. chroot to the system root directory
chroot /mnt/sysimage /bin/bash

# 5. Verify chroot success
pwd  # Should display /
ls /boot/efi  # Should see the contents of the EFI system partition

⚠️ Important Note:

β€’Must correctly mount the ESP partition (usually <span><span>/boot/efi</span></span>)β€’Must mount virtual file systems (dev, proc, sys, run) to execute commands properly.β€’After chroot, all operations are performed in the original system.

Step 3: Reinstall GRUB Related Packages (RHEL 7 and Above)

For RHEL 7 and above, you need to reinstall <span><span>grub2-efi-x64</span></span> and <span><span>shim-x64</span></span> packages.

# 1. Check the current system version
cat /etc/redhat-release

# 2. Reinstall grub2-efi-x64 and shim-x64
# This will reinstall all files under /boot/efi/EFI/
yum reinstall grub2-efi-x64 shim-x64

# Or use rpm command (if yum is unavailable)
# rpm -ivh --replacepkgs --replacefiles grub2-efi-x64-<version>.rpm shim-x64-<version>.rpm

⚠️ Important Note:β€’Do not run <span><span>grub-install</span></span> or <span><span>grub2-install</span></span> on the boot disk!β€’Reinstalling the packages will automatically restore all EFI files under <span><span>/boot/efi/EFI/redhat/</span></span>β€’If the network is unavailable, you need to configure the network first or use a local repository.

Step 4: Additional Steps for RHEL 9+: Reinstall grub2-common

For RHEL 9 and above, if <span><span>/boot/efi/EFI/redhat/grub.cfg</span></span> has been deleted, you need to reinstall <span><span>grub2-common</span></span>.

# Check RHEL version
cat /etc/redhat-release

# If it is RHEL 9 or above, reinstall grub2-common
# This will trigger a scriptlet to generate /boot/efi/EFI/redhat/grub.cfg
yum reinstall grub2-common

⚠️ Important Note:β€’RHEL 9+ stores <span><span>grub.cfg</span></span> in <span><span>/boot/efi/EFI/redhat/grub.cfg</span></span>β€’Reinstalling <span><span>grub2-common</span></span> will trigger a post-install script to automatically generate <span><span>grub.cfg</span></span>β€’This is a step unique to RHEL 9+

Step 5: Add UEFI Boot Entries

After reinstalling the packages, you may need to add new UEFI boot entries (especially in the case of motherboard replacement).

⚠️ Key Warning:

If the system is currently booting from a different system (e.g., the disk is mounted to a rescue virtual machine), do not run <span><span>efibootmgr</span></span> command!

This command will update the NVRAM on the motherboard; if run from a different system, it will update the NVRAM of the current boot environment, potentially leaving that system in a corrupted state.

Correct Operation Method:

# 1. Confirm that the current system is booting from the original system (the system after chroot)
# 2. Confirm the location of the ESP partition
df -h /boot/efi
# Output example:
# Filesystem      Size  Used Avail Use% Mounted on
# /dev/sda1       200M  100M  100M  50% /boot/efi

# 3. Determine the disk device (e.g., /dev/sda)
# 4. Determine the ESP partition number (usually partition 1, i.e., -p 1)

# 5. Add UEFI boot entry
# For RHEL 7/8/9/10:
efibootmgr -c -d /dev/sda -p 1 -l \EFI\redhat\shimx64.efi -L "Red Hat Enterprise Linux 8"

# For RHEL 7, replace with:
# efibootmgr -c -d /dev/sda -p 1 -l \EFI\redhat\shimx64.efi -L "Red Hat Enterprise Linux 7"

# For RHEL 9, replace with:
# efibootmgr -c -d /dev/sda -p 1 -l \EFI\redhat\shimx64.efi -L "Red Hat Enterprise Linux 9"

# For RHEL 10, replace with:
# efibootmgr -c -d /dev/sda -p 1 -l \EFI\redhat\shimx64.efi -L "Red Hat Enterprise Linux 10"

Parameter Explanation:

β€’<span><span>-c</span></span>: Create a new boot entry.β€’<span><span>-d /dev/sda</span></span>: Specify the disk device (replace with the actual disk).β€’<span><span>-p 1</span></span>: Specify the ESP partition number (usually 1).β€’<span><span>-l \EFI\redhat\shimx64.efi</span></span>: Specify the EFI file path (note the use of double backslashes).β€’<span><span>-L "Red Hat Enterprise Linux X"</span></span>: Boot entry label (modify according to system version).

Step 6: Verify Boot Entries and Exit Rescue Mode

# 1. Verify that the boot entry has been added
efibootmgr -v

# Output example:
# BootCurrent: 0000
# Timeout: 0 seconds
# BootOrder: 0000,0001,0002
# Boot0000* Red Hat Enterprise Linux 8    HD(1,GPT,xxx-xxx-xxx,0x800,0x64000)/File(\EFI\redhat\shimx64.efi)

# 2. Verify that the EFI file exists
ls -lh /boot/efi/EFI/redhat/
# Should see:
# shimx64.efi
# grubx64.efi
# grub.cfg (RHEL 9+)

# 3. Exit chroot
exit

# 4. Unmount file systems
umount /mnt/sysimage/run
umount /mnt/sysimage/sys
umount /mnt/sysimage/proc
umount /mnt/sysimage/dev
umount /mnt/sysimage/boot/efi
umount /mnt/sysimage

# 5. Reboot the system
reboot

⚠️ Important Note:β€’If the boot entry is added correctly, the system should boot normally.β€’If the problem persists, you need to create a Red Hat support case and provide the output of <span><span>efibootmgr -v</span></span>.

πŸ” 3. Special Handling for RHEL 6: Using grub Package

For RHEL 6, the handling method is slightly different because RHEL 6 uses an older version of GRUB.

# 1. Enter rescue mode and chroot (refer to Step 1 and Step 2)

# 2. Reinstall grub package
# This will reinstall the /boot/efi/EFI/redhat/grub.efi file
yum reinstall grub

# Or use rpm command
# rpm -ivh --replacepkgs --replacefiles grub-<version>.rpm

# 3. Add UEFI boot entry
# Note: RHEL 6 uses grub.efi instead of shimx64.efi
efibootmgr -c -d /dev/sda -p 1 -l \EFI\redhat\grub.efi -L "Red Hat Enterprise Linux 6"

# 4. Verify and reboot
efibootmgr -v
reboot

Key Differences:

β€’RHEL 6 uses the <span><span>grub</span></span> package instead of <span><span>grub2-efi-x64</span></span>β€’RHEL 6’s EFI file is <span><span>grub.efi</span></span>, not <span><span>shimx64.efi</span></span> and <span><span>grubx64.efi</span></span>β€’RHEL 6 does not support Secure Boot.

⚠️ 4. 5 Major Pitfalls in UEFI System GRUB Repair: Avoid These Mistakes

Understanding these pitfalls can help you avoid problems during the repair process:

Pitfall 1: Running grub-install Directly on UEFI Systems

β€’βŒ Incorrect Practice: Running <span><span>grub-install</span></span> or <span><span>grub2-install</span></span> directly on the boot disk in UEFI systems.β€’βš οΈ Risk: This may corrupt the UEFI boot configuration, causing the system to be completely unbootable.β€’βœ… Correct Practice: Reinstall <span><span>grub2-efi-x64</span></span> and <span><span>shim-x64</span></span> packages, allowing the package manager to handle it automatically.

Example:

# ❌ Incorrect: Do not do this!
grub2-install /dev/sda

# βœ… Correct: Reinstall the package
yum reinstall grub2-efi-x64 shim-x64

Pitfall 2: Running efibootmgr from a Different System

β€’βŒ Incorrect Practice: Mounting the disk to a rescue virtual machine and then running <span><span>efibootmgr</span></span> from the virtual machine.β€’βš οΈ Risk: This will update the NVRAM of the rescue virtual machine instead of the original system’s NVRAM, potentially causing the original system to be unbootable.β€’βœ… Correct Practice: Ensure to run <span><span>efibootmgr</span></span> from the original system (or chroot to the original system).

Scenario Explanation:

# ❌ Incorrect Scenario:
# 1. Mount the original system disk to a rescue virtual machine.
# 2. Run efibootmgr on the rescue virtual machine.
# Result: Updated the rescue virtual machine's NVRAM, and the original system is still unbootable.

# βœ… Correct Scenario:
# 1. Boot into rescue mode on the original system using installation media.
# 2. chroot to the original system.
# 3. Run efibootmgr in the original system.
# Result: Updated the original system's NVRAM, and the system can boot normally.

Pitfall 3: Forgetting to Reinstall grub2-common (RHEL 9+)

β€’βŒ Incorrect Practice: Only reinstalling <span><span>grub2-efi-x64</span></span> and <span><span>shim-x64</span></span>, forgetting to reinstall <span><span>grub2-common</span></span>β€’βš οΈ Risk: If <span><span>/boot/efi/EFI/redhat/grub.cfg</span></span> has been deleted, the system will still be unbootable.β€’βœ… Correct Practice: On RHEL 9+, in addition to reinstalling <span><span>grub2-efi-x64</span></span> and <span><span>shim-x64</span></span>, also reinstall <span><span>grub2-common</span></span>

Verification Method:

# Check if grub.cfg exists
ls -lh /boot/efi/EFI/redhat/grub.cfg

# If it does not exist, reinstall grub2-common
yum reinstall grub2-common

Pitfall 4: ESP Partition Not Properly Mounted

β€’βŒ Incorrect Practice: Not mounting the ESP partition after chroot and directly reinstalling the package.β€’βš οΈ Risk: After the package is reinstalled, the EFI files cannot be written to the ESP partition, leading to repair failure.β€’βœ… Correct Practice: Ensure the ESP partition is correctly mounted to <span><span>/boot/efi</span></span>

Verification Method:

# Check if the ESP partition is mounted
df -h /boot/efi

# Check the contents of the ESP partition
ls -lh /boot/efi/EFI/redhat/

# If empty or does not exist, you need to mount the ESP partition first
mount /dev/sda1 /boot/efi

Pitfall 5: Using Incorrect efibootmgr Parameters

β€’βŒ Incorrect Practice: Using incorrect disk device, partition number, or EFI file path.β€’βš οΈ Risk: The created boot entry points to the wrong file, and the system still cannot boot.β€’βœ… Correct Practice: Carefully confirm the disk device, partition number, and EFI file path.

Verification Steps:

# 1. Confirm the location of the ESP partition
df -h /boot/efi
# Output: /dev/sda1 on /boot/efi

# 2. Confirm the disk device (remove the partition number)
# /dev/sda1 β†’ /dev/sda

# 3. Confirm the partition number (usually 1)
# /dev/sda1 β†’ partition number is 1

# 4. Confirm the EFI file exists
ls -lh /boot/efi/EFI/redhat/shimx64.efi

# 5. Use the correct parameters to create the boot entry
efibootmgr -c -d /dev/sda -p 1 -l \EFI\redhat\shimx64.efi -L "Red Hat Enterprise Linux 8"

πŸ’‘ 5. Practical Case: GRUB Repair After Motherboard Replacement

Scenario Description

A production environment server’s motherboard was replaced due to failure, and after the replacement, the system could not boot, displaying “Boot device not found” or directly entering the UEFI setup interface. The operations team needs to repair GRUB to allow the system to boot normally.

Problem Analysis

β€’βœ… Root Cause: The UEFI firmware of the new motherboard does not have the correct boot entry and cannot find the GRUB EFI file.β€’βœ… Impact Scope: The system is completely unbootable, unable to enter the operating system.β€’βœ… Repair Plan: Enter rescue mode, reinstall the GRUB package, and add UEFI boot entries.

Repair Steps

# ======== Step 1: Enter Rescue Mode ======
# 1. Boot using RHEL installation media.
# 2. Select "Troubleshooting" β†’ "Rescue a Red Hat Enterprise Linux system."
# 3. Select to start the network (Yes).
# 4. Select to find and mount the installed system (Continue).

# ====== Step 2: Mount the System and chroot ======
# Check if the system has been automatically mounted
ls /mnt/sysimage

# If not automatically mounted, mount manually
# Assuming the root partition is /dev/sda2, and the ESP partition is /dev/sda1
mount /dev/sda2 /mnt/sysimage
mount /dev/sda1 /mnt/sysimage/boot/efi

# Mount virtual file systems
mount --bind /dev /mnt/sysimage/dev
mount --bind /proc /mnt/sysimage/proc
mount --bind /sys /mnt/sysimage/sys
mount --bind /run /mnt/sysimage/run

# chroot to the system root directory
chroot /mnt/sysimage /bin/bash

# ====== Step 3: Check System Version ======
cat /etc/redhat-release
# Output: Red Hat Enterprise Linux release 8.8 (Ootpa)

# ====== Step 4: Reinstall GRUB Package ======
# Reinstall grub2-efi-x64 and shim-x64
yum reinstall grub2-efi-x64 shim-x64

# Verify that the EFI files have been restored
ls -lh /boot/efi/EFI/redhat/
# Should see:
# shimx64.efi
# grubx64.efi

# ====== Step 5: Confirm ESP Partition Location ======
df -h /boot/efi
# Output:
# Filesystem      Size  Used Avail Use% Mounted on
# /dev/sda1       200M  100M  100M  50% /boot/efi

# Disk Device: /dev/sda
# Partition Number: 1

# ====== Step 6: Add UEFI Boot Entry ======
efibootmgr -c -d /dev/sda -p 1 -l \EFI\redhat\shimx64.efi -L "Red Hat Enterprise Linux 8"

# ====== Step 7: Verify Boot Entry ======
efibootmgr -v
# Output:
# BootCurrent: 0000
# Timeout: 0 seconds
# BootOrder: 0000,0001,0002
# Boot0000* Red Hat Enterprise Linux 8    HD(1,GPT,xxx-xxx-xxx,0x800,0x64000)/File(\EFI\redhat\shimx64.efi)

# ====== Step 8: Exit and Reboot ========
exit
umount /mnt/sysimage/run
umount /mnt/sysimage/sys
umount /mnt/sysimage/proc
umount /mnt/sysimage/dev
umount /mnt/sysimage/boot/efi
umount /mnt/sysimage
reboot

Verification Results

# After rebooting, the system should boot normally to the GRUB menu.
# After logging in, verify the boot entry
efibootmgr -v

# Verify GRUB configuration
cat /boot/efi/EFI/redhat/grub.cfg  # RHEL 9+
# Or
cat /boot/grub2/grub.cfg  # RHEL 7/8

# Check system boot logs
journalctl -b | grep -i grub

πŸ’‘ 6. Practical Case: Recovery of grub.cfg Deleted (RHEL 9+)

Scenario Description

On a certain RHEL 9 system, the <span><span>/boot/efi/EFI/redhat/grub.cfg</span></span> file was accidentally deleted, and the system could not boot, displaying a “file not found” error. The operations team needs to restore the <span><span>grub.cfg</span></span> file.

Problem Analysis

β€’βœ… Root Cause: RHEL 9+ stores <span><span>grub.cfg</span></span> in <span><span>/boot/efi/EFI/redhat/grub.cfg</span></span>, and after this file is deleted, GRUB cannot find the configuration file.β€’βœ… Impact Scope: The system cannot boot, and GRUB cannot load the kernel.β€’βœ… Repair Plan: Reinstall <span><span>grub2-common</span></span>, triggering a scriptlet to generate <span><span>grub.cfg</span></span>

Repair Steps

# ======== Step 1: Enter Rescue Mode and chroot ======
# (Refer to Case 1's Step 1 and Step 2)

# ====== Step 2: Check System Version ======
cat /etc/redhat-release
# Output: Red Hat Enterprise Linux release 9.2 (Plow)

# ====== Step 3: Confirm grub.cfg Does Not Exist ======
ls -lh /boot/efi/EFI/redhat/grub.cfg
# Output: ls: cannot access '/boot/efi/EFI/redhat/grub.cfg': No such file or directory

# ====== Step 4: Reinstall grub2-common ======
# This will trigger a scriptlet to generate /boot/efi/EFI/redhat/grub.cfg
yum reinstall grub2-common

# ====== Step 5: Verify grub.cfg Has Been Generated ======
ls -lh /boot/efi/EFI/redhat/grub.cfg
# Output:
# -rw-r--r-- 1 root root 1234 Dec 10 10:00 /boot/efi/EFI/redhat/grub.cfg

# View grub.cfg content
cat /boot/efi/EFI/redhat/grub.cfg
# Should contain kernel boot configuration

# ====== Step 6: Verify EFI Files Are Complete ======
ls -lh /boot/efi/EFI/redhat/
# Should see:
# shimx64.efi
# grubx64.efi
# grub.cfg  # Restored

# ====== Step 7: Exit and Reboot ========
exit
# (Unmount file systems and reboot, refer to Case 1)
reboot

Verification Results

# After rebooting, the system should boot normally.
# After logging in, verify grub.cfg
cat /boot/efi/EFI/redhat/grub.cfg

# Check if GRUB configuration is correct
grub2-mkconfig -t grub2-efi-x64

🎁 Conclusion!

πŸ“‹ Value Summary

Today, FYC has brought you the complete guide to GRUB repair on UEFI systems:

βœ… Principles of UEFI Booting:

β€’UEFI systems use EFI executable files (.efi) instead of MBR.β€’Cannot run <span><span>grub-install</span></span> directly on the boot disk.β€’Need to reinstall GRUB packages and let the package manager handle it automatically.

βœ… Repair Key Points:

β€’6-step complete repair process, each step is crucial.β€’Handling methods for RHEL 6, RHEL 7+, and RHEL 9+ are slightly different.β€’Must correctly mount the ESP partition and chroot to the original system.β€’When using <span><span>efibootmgr</span></span> to add UEFI boot entries, pay attention to warnings.

βœ… Key Pitfalls:

β€’5 major pitfalls to help you avoid mistakes.β€’Do not run <span><span>grub-install</span></span> directly on UEFI systems.β€’Do not run <span><span>efibootmgr</span></span> from a different system.β€’RHEL 9+ requires additional reinstallation of <span><span>grub2-common</span></span>

By mastering the GRUB repair methods for UEFI systems, you can quickly restore system boot in scenarios such as motherboard replacement and grub.cfg loss, ensuring business continuity!

🎯 Call to Action

Do you find this article not enough? Want to see more detailed GRUB repair scripts, UEFI boot entry management methods, and more real cases?

πŸ‘‰ Click on my subsequent WeChat mini-program 【FYC’s Knowledge Planet】, to get:

β€’πŸ“š One-click script for UEFI system GRUB repair (automated 6-step repair process).β€’πŸ”§ Complete guide to using efibootmgr (boot entry management, backup, recovery).β€’πŸ“Š UEFI system boot failure troubleshooting checklist (Checklist).β€’πŸ’‘ More GRUB repair case analyses (motherboard replacement, multi-system boot, etc.).β€’πŸŽ― Comparison analysis of UEFI vs BIOS boot processes (in-depth understanding of boot mechanisms).

FYC’s Mission: To make every operations engineer a boot failure diagnosis expert! Technology should be hardcore, and the copy should be engaging!πŸ”₯

#Operations #Linux #GRUB #UEFI #Boot Failure #System Repair #Troubleshooting #RCA #Root Cause Analysis #Technical Content #RedHat #RHEL

Leave a Comment