Linux Boots Grub - How to Fix a Broken grub.cfg

Abstract: Regenerate a broken grub.cfg using update-grub or a Live USB to restore Linux booting and resolve missing kernel errors.

Created: 2026-10-22 by
A broken grub.cfg prevents Linux from booting by removing valid kernel parameters or OS entries. The most reliable fix is to regenerate this file using the update-grub command, which scans your system for installed operating systems and rebuilds the configuration automatically. If you cannot reach a terminal, booting from a live USB allows you to mount your partitions and run the repair commands manually. This process restores the GRUB bootloader’s ability to locate kernels and initrd images, resolving black screen or "file not found" errors during startup.

Understanding the Role of grub.cfg

The grub.cfg file is the central configuration script that the GRand Unified Bootloader (GRUB) reads every time you start your computer. It tells the bootloader where to find the Linux kernel, the initial ramdisk (initrd), and any other operating systems like Windows on your machine. When this file becomes corrupted—often due to incomplete updates, manual editing errors, or disk failures—GRUB loses its roadmap. Instead of displaying a menu, the system may drop into a grub> prompt or display an error message stating that the required files are missing. Regenerating this file is generally safe because modern tools do not delete existing data; they simply overwrite the configuration with fresh, accurate information derived from your current system state. However, it is crucial to understand that grub.cfg is typically generated dynamically rather than edited by hand. Directly modifying this file is discouraged because any subsequent system update will likely overwrite your changes, leading to further confusion.

Fixing via Live USB Method

When your primary operating system fails to boot entirely, you must use a Live USB environment to access the necessary repair tools. This method works for almost all Debian-based distributions (like Ubuntu, Linux Mint, and Kali) and many others. First, create a bootable USB drive using your preferred Linux distribution’s ISO image. Insert the USB into your computer and restart it. Enter the BIOS or UEFI settings by pressing the appropriate key (commonly F2, F12, Del, or Esc) during startup. Change the boot order to prioritize the USB drive and save your changes. Once the system boots into the Live environment, open a terminal window. You need to identify which partition contains your root Linux installation. Run the following command to list available block devices:
lsblk
Look for the partition that matches the size of your main hard drive and is labeled as ext4 or btrfs. Let us assume this is /dev/sda2 for the sake of this guide. You must mount this partition to a temporary directory so the repair tool can see it. Execute these commands:
sudo mount /dev/sda2 /mnt
If you have a separate EFI System Partition (ESP), you must mount it as well. This is usually a small FAT32 partition, often /dev/sda1. Create a mount point and attach it:
sudo mkdir -p /mnt/boot/efi
sudo mount /dev/sda1 /mnt/boot/efi
In some cases, if you have a separate /boot partition, you should mount that too. For most standard setups, mounting the root and EFI partitions is sufficient. Now, you need to bind the virtual filesystems so that the chroot environment has access to device nodes and temporary files. Run:
sudo mount --bind /dev /mnt/dev
sudo mount --bind /proc /mnt/proc
sudo mount --bind /sys /mnt/sys
Now, change root into your mounted system:
sudo chroot /mnt
Once inside the chroot environment, you are effectively running as if you were logged into your broken system. The final step is to regenerate the GRUB configuration. For Debian-based systems, use:
update-grub
For Red Hat-based systems (like Fedora or CentOS), the command might differ slightly, often involving grub2-mkconfig -o /boot/grub2/grub.cfg. After the command completes successfully without errors, exit the chroot environment:
exit
Then unmount the partitions in reverse order:
sudo umount /mnt/dev
sudo umount /mnt/proc
sudo umount /mnt/sys
sudo umount /mnt/boot/efi
sudo umount /mnt
Remove the USB drive and reboot your computer. Your GRUB menu should now appear with all your operating systems listed correctly.

Repairing from the GRUB Command Line

Sometimes, you may be stuck at the grub> prompt but still have access to basic commands. This situation occurs when the configuration file is missing entirely, but the underlying files remain intact. You can manually boot into your system to gain access and then run the repair commands. At the grub> prompt, you need to set the root device to your Linux partition. Use the ls command to list available drives:
ls
This will output something like (hd0,gpt1), (hd0,gpt2), etc. Identify the partition containing your /boot directory. Set it as the root:
set root=(hd0,gpt2)
Next, specify the kernel path. Assuming your kernel is located in the root of the partition:
linux /vmlinuz root=/dev/sda2 ro
Replace /dev/sda2 with the actual device name of your root partition. Then, load the initial ramdisk:
initrd /initrd.img
Finally, boot the system:
boot
If successful, you will boot into your Linux desktop. Immediately open a terminal and run sudo update-grub (or the equivalent for your distro) to permanently fix the issue. This method is a temporary workaround to regain access; you must still run the regeneration command to ensure future boots work automatically.

Common Pitfalls and Verification

After regenerating grub.cfg, verify that the file contains entries for all your installed operating systems. Open the file with a text editor:
sudo nano /boot/grub/grub.cfg
Scroll through the file and look for menuentry blocks. Each installed OS should have its own entry. If Windows is missing, check that the os-prober package is installed and enabled. On newer GRUB versions, os-prober is disabled by default for security reasons. To enable it, edit /etc/default/grub and add the line GRUB_DISABLE_OS_PROBER=false, then run update-grub again. Another common issue arises with UEFI systems where the EFI partition is not mounted correctly during the chroot process. If you forget to mount the EFI partition, the new grub.cfg might not be written to the correct location, or the bootloader binaries might not be updated properly. Always double-check your mount points before running update-grub. For users dealing with complex dual-boot setups involving GPT and EFI system partitions, ensuring the correct partition alignment is vital. If you encounter persistent issues after following these steps, consider reviewing how the boot menu presents itself in specific UEFI environments. You can refer to our guide on How is the grub boot menu presented if the gpt looks for efi system partition for deeper insights into EFI partition structures. Additionally, if you are trying to restore access to older Windows installations that disappeared from the menu, the techniques used to reconstruct EFI files may provide additional context. See How to Reconstruct EFI File to Make Windows 7 Reappear on GRUB for those specific scenarios.

Frequently Asked Questions

Will updating GRUB delete my personal files?

No, regenerating grub.cfg only modifies the bootloader configuration file. It does not touch your home directory, documents, or installed applications. The operation is strictly limited to the /boot and /boot/grub directories.

What if update-grub says "command not found"?

This indicates you are likely using a non-Debian-based distribution such as Fedora, Arch, or openSUSE. These systems use different package managers and commands. For example, Fedora uses grub2-mkconfig. Check your distribution’s documentation for the specific command to regenerate GRUB configuration.

Can I manually edit grub.cfg instead of regenerating it?

While technically possible, it is strongly discouraged. Manual edits are fragile and will be overwritten by any future kernel updates or system upgrades. Using update-grub ensures that your configuration remains consistent with the currently installed kernels and modules.

Why does Windows disappear from the GRUB menu after an update?

Modern Linux distributions disable os-prober by default to prevent potential security vulnerabilities associated with scanning other partitions. If Windows vanishes, you likely need to enable os-prober in /etc/default/grub and run update-grub again to rescan for other operating systems.

Is it safe to run these commands on a RAID setup?

Yes, provided you identify the correct logical volume device (e.g., /dev/md0 or /dev/mapper/cryptroot) when mounting your root partition. The update-grub command handles software RAID configurations automatically as long as the underlying devices are accessible within the chroot environment.

Latest News

How to Display Output of xterm Command in Terminal Screen using Cron

Resolve the inability to display xterm output in a terminal screen from cron by redirecting logs or using wall instead of insecure X11 workarounds.

Read More
Expose Local Server on VPS Preserving Real Client IPs (OS Level)

Resolve VPS logging showing only gateway IPs by configuring reverse proxies to forward real client addresses via X-Forwarded-For headers.

Read More
How to Clear Recent Files History in Linux without Deleting Actual Files?

Clear recent files history in Linux by deleting ~/.local/share/recently-used.xbel without removing the actual files.

Read More
Best HDD Copy Strategy: Manually Syncing and Rewriting Scratch

Resolve data drift between two 4TB hard drives by using rsync with the --delete flag to manually sync and rewrite scratch data for an exact mirror.

Read More
Understanding Bash Prompt Abbreviations: An Overview

Resolve repetitive typing errors by creating and persisting Bash aliases in the .bashrc file for improved command-line efficiency.

Read More
Free Tools and Methods to Log Real-Time Performance Details in Task Manager

Log real-time CPU and memory metrics to CSV files using Windows Performance Monitor Data Collector Sets to troubleshoot system slowness.

Read More
Contact Qatar Airways Customer Service: Phone Number, Help Center, and More

Resolve urgent Qatar Airways reservation issues like flight changes and baggage claims using the US phone number +1801-855-5905 or online self-service tools.

Read More
Windows 11: Alt Codes Displaying Wrong Characters - Solutions

Resolve Windows 11 Alt codes showing wrong characters by verifying the US keyboard layout and enabling Num Lock.

Read More
Run Programs with Elevated Privileges: A Comprehensive Guide

Eliminates the need to type sudo for frequent administrative tasks by configuring .bashrc aliases or functions.

Read More
Dynamically Changing Dates in Excel Formulas Using Cells

Eliminate manual date updates in Excel by using cell references to create dynamic formulas that automatically adjust calculations when input dates change.

Read More
Granting Edit Access to a Specific Excel Sheet in an Office 365 User Email ID-Based Login

Excel Online lacks native sheet-level permissions, so users must split workbooks or use worksheet protection to isolate edit access for specific tabs.

Read More
Creating Network Load on Local Wi-Fi from One PC

Generate sustained Wi-Fi bandwidth load from a single PC using a VM SFTP server to test router stability and throughput.

Read More
Changing the Default Editor for Batch Files in Windows 11's File Explorer

Resolve the issue of batch files opening in Notepad by changing the default editor to a preferred application like VS Code.

Read More
Gain WiFi Connection Minutes Before Losing it by Changing MAC Address

Bypass MAC address filtering to restore WiFi connectivity temporarily when a device is blocked by network administrators.

Read More
Photos Folders Turned Black: Troubleshooting Picture Applications on Windows

Resolve black screens in Windows Photos by resetting the app, updating graphics drivers, and repairing system files.

Read More
Troubleshooting High CPU Temperature Values: A Step-by-Step Guide

Resolve high CPU temperatures and thermal throttling by monitoring with Speedfan, cleaning dust from cooling components, and replacing degraded thermal paste.

Read More
Make cURL establish TLS connection with CA unknown

Resolve cURL TLS connection failures with unknown or self-signed certificates by using the --insecure flag to bypass CA validation.

Read More
Troubleshooting Incorrect Network Metrics Values in Grafana, Prometheus, InfluxDB, and Telegraf

Fix incorrect network metrics in Grafana, Prometheus, InfluxDB, and Telegraf by verifying interface selection, resolving unit mismatches, and handling counter resets.

Read More
Start Another Terminal Window (cmd.exe) Windows Repair/Troubleshoot

Provides step-by-step instructions to access the Windows Command Prompt via bootable media for advanced system repair and troubleshooting.

Read More
Thinkpad P1 Gen 6: Sudden Thunderbolt 3 Dock USB-C Charging Stopped Working

Resolve sudden Thunderbolt 3 dock USB-C charging and internet failure on ThinkPad P1 Gen 6 by updating firmware, resetting the dock, and adjusting power settings.

Read More
ASUS Windows 11 Laptop: Internet Connection Issue with Hotspot

Resolve ASUS Windows 11 laptop spinning wheel issue when connecting to mobile hotspot by resetting network stack, disabling IPv6, and adjusting power settings.

Read More
Developing iOS Project with Firebase: Logging in and Sending Push Notifications

Integrates Firebase to enable secure user authentication and push notifications in iOS applications.

Read More
Troubleshooting Bash Script with Suspected Issues of Spaces, Dashes, Filenames and Quoting

Resolve Bash script failures caused by word splitting, globbing, and special characters in filenames by applying proper quoting techniques.

Read More
Populating OneDrive Folder for Local Backup without Affecting Remote Files

Prevent OneDrive from deleting remote files during Windows reinstallation by unlinking the account or using symbolic links to isolate local data.

Read More
Force First Frame as Keyframe Without Re-encoding: A Quick Solution

Resolve inaccurate seeking and playback glitches by re-encoding video to ensure the first frame is a valid keyframe.

Read More
Find Information in Database Using WSL (Ubuntu) on Windows-10

Resolve database connection issues from WSL Ubuntu on Windows 10 by configuring client tools and network access to query remote or local servers.

Read More
Configuring a New Router with Different Networks: One Family, One Guest

Resolve IP conflicts and isolate guest traffic by configuring a second router with a distinct subnet via its WAN port.

Read More
Quickly Open Multiple Stock Websites with a Single Command

Solve the problem of manually opening multiple stock research websites by creating a single command to launch them simultaneously on Windows, macOS, or Linux.

Read More
Improved Adobe Acrobat Search Experience: Access Advanced Search with Ease

Access advanced search filters like case sensitivity and regex in Adobe Acrobat by clicking More Options in the Find bar.

Read More
Port Forwarding VM via OpenVPN: A Comprehensive Guide

Configure OpenVPN server and iptables to forward specific ports from VPN clients to a virtual machine's internal IP address.

Read More
Understanding Partitions in the 1980s: A Look Back at MS-DOS and Master Boot Record

Explains how the Master Boot Record and partition table enabled MS-DOS to manage multiple disk volumes on a single physical drive.

Read More
Windows 10 Enterprise: Keyboard Not Detected in Managed Organization with Admin Privileges

Resolve Windows 10 Enterprise keyboard detection failures caused by Group Policy restrictions, driver corruption, or USB enumeration errors.

Read More
Can't Find x86_64 Versions of Applications on MacOS arm64 (M1)

Resolve missing x86_64 app issues on M1 Macs by installing Rosetta 2 and reinstalling apps as universal binaries.

Read More
How to Hide Installation Source for an Android App

Manage Android app installation source visibility by using USB transfers or file managers to reduce browser traces and isolate data via work profiles.

Read More
Connecting Momentus 4200.2 ST9808210A Hard Drive via USB Cable

Resolve inability to access Seagate Momentus 4200.2 ST9808210A hard drive by connecting it via USB using a compatible SATA-to-USB adapter and configuring the disk in Windows.

Read More