The "Minimal BASH like line editing is supported" error indicates that GRUB has lost its configuration files or cannot find the boot partition. To fix this, you must manually locate your root partition using ls, identify the correct UUID, and then chainload your operating system kernel directly from the GRUB command line before reinstalling the bootloader permanently.
Understanding the Rescue Shell
When GRUB fails to loadgrub.cfg, it drops into a minimal shell environment. This state is not a bug but a safety feature designed to allow manual intervention when automatic boot processes fail. You will see a prompt that looks like grub rescue>. At this stage, standard commands like set or insmod may not work because the environment variables pointing to the GRUB modules are missing.
The primary goal in this phase is to re-establish the path to the GRUB modules and the root partition. Do not panic if the screen looks empty or if previous configurations seem lost. The disk geometry remains intact; only the pointer to the boot loader configuration is broken. This often happens after deleting partitions, resizing disks, or installing Windows which overwrites the Master Boot Record (MBR) or EFI system partition.
Identifying Available Partitions
The first step is to discover which partitions are available to the BIOS/UEFI firmware. In thegrub rescue> prompt, type ls and press Enter. The output will list all detected drives and partitions, typically appearing as (hd0,gpt1), (hd0,msdos2), or similar variations depending on whether you use GPT or MBR partition tables.
Note that these identifiers differ from Linux device names like /dev/sda1. A drive named (hd0) usually corresponds to the first physical disk, while (hd1) is the second. The numbers following the comma represent the partition number. If you have multiple hard drives, ensure you are looking at the correct one where your Linux installation resides.
Locating the Boot Partition
Simply listing partitions is not enough; you must find the one containing thegrub directory or the Linux kernel. Use the ls command followed by the partition identifier to inspect its contents. For example, run ls (hd0,gpt1)/. If the partition contains a grub folder, a vmlinuz file, or an EFI directory, you have likely found the correct root or boot partition.
If the first partition returns "unknown filesystem" or appears empty, try the next one. It is common for the EFI System Partition (ESP) to be separate from the root Linux partition in UEFI systems. In such cases, the ESP might be (hd0,gpt1) and the root partition (hd0,gpt2). You need to identify both: one for the GRUB modules and one for the OS files.
Setting the Root Device
Once you have identified the correct partition, set it as the root device. Typeset root=(hd0,gptX), replacing X with the correct partition number. Press Enter. If the command succeeds without error, the variable root is now set. You can verify this by typing echo $root, though this may not always work in the rescue shell.
Next, you need to tell GRUB where its modules are located. If your GRUB directory is inside the same partition as the root, you can set the prefix. Type set prefix=(hd0,gptX)/boot/grub or set prefix=(hd0,gptX)/grub depending on your distribution's structure. After setting the prefix, you must load the normal module by typing insmod normal. If this command executes successfully, you can restore the full menu by typing normal.
Booting Manually from the Command Line
If thenormal command fails or you prefer to boot directly, you can manually specify the kernel and initramfs. First, ensure you know the exact name of your kernel file, such as vmlinuz-linux or vmlinuz-5.15.0-generic. Locate this file in the root partition using the ls command again.
To boot, you must construct a command that loads the kernel and passes the correct root device. Use the UUID of your root partition rather than the device path for reliability. Find the UUID by running blkid if you can access a live USB later, or by checking the grub.cfg if you can mount it. The command structure looks like this:
linux (hd0,gptX)/boot/vmlinuz-linux root=UUID=your-uuid-here ro
initrd (hd0,gptX)/boot/initramfs-linux.img
boot
Replace (hd0,gptX) with your actual partition, the kernel name with your specific version, and the UUID with the actual identifier of your root partition. The ro flag mounts the root filesystem as read-only initially, which is standard practice. Once the system boots, you can immediately begin the permanent repair process.
Permanent Repair via Live USB
Booting manually is a temporary solution. To permanently fix the issue, you should boot from a Linux Mint or Ubuntu Live USB. Once in the live environment, open a terminal and identify your root partition usinglsblk or fdisk -l. Ensure you mount the correct partitions: the root partition and the EFI partition if applicable.
Mount the root partition to /mnt and the EFI partition to /mnt/boot/efi if they are separate. Then, bind the necessary directories for chroot:
sudo mount /dev/sdXY /mnt
sudo mount /dev/sdZW /mnt/boot/efi
sudo mount --bind /dev /mnt/dev
sudo mount --bind /proc /mnt/proc
sudo mount --bind /sys /mnt/sys
After mounting, enter the chroot environment with sudo chroot /mnt. Inside the chroot, reinstall GRUB using the appropriate command for your architecture. For UEFI systems, use grub-install --target=x86_64-efi --efi-directory=/boot/efi. For BIOS systems, use grub-install /dev/sdX, specifying the disk, not the partition. Finally, update the GRUB configuration with update-grub. Reboot the system, and the error should be resolved.
For more detailed steps on restoring GRUB specifically, refer to our guide on How to Restore GRUB in My Case?. Additionally, if you experience display issues after fixing the bootloader, check our article on Display Bug on UEFI, GRUB, Linux, and Plugged in Windows.
Frequently Asked Questions
Why does my GRUB show (hd0,msdos1) instead of (hd0,gpt1)?
This difference indicates the partition table format used on your disk. msdos refers to the older MBR scheme, while gpt refers to the modern GUID Partition Table. You must use the identifier that matches your disk's actual format; using the wrong one will result in "unknown filesystem" errors.
Can I fix this error without a Live USB?
It is extremely difficult to permanently fix GRUB issues solely from the rescue shell because you lack the tools to reinstall the bootloader binaries. While you can manually boot the kernel once, you cannot easily regenerate grub.cfg or install GRUB modules without a full Linux environment mounted on the system.
What if the ls command shows no partitions?
If ls returns nothing, your BIOS/UEFI may not be detecting the drive correctly, or the drive is failing. Check your BIOS settings to ensure the SATA mode is set to AHCI rather than RAID or IDE. Also, verify that the cable connections are secure if this is a desktop computer.
Does reinstalling Windows cause this error?
Yes, installing Windows often overwrites the boot sector or EFI system partition, removing the GRUB bootloader. Windows assumes it is the sole operating system and does not preserve multi-boot configurations. You must repair GRUB after any Windows installation to restore access to your Linux distribution.
Is it safe to change the root variable in GRUB?
Changing the set root variable is safe and necessary for troubleshooting. It only affects the current session in the GRUB shell. These changes do not persist to the next boot unless you modify the actual grub.cfg file or reinstall GRUB, so you can experiment freely to find the correct partition.