Найти в Дзене

Error no such partition entering rescue mode grub rescue как исправить

The "error: no such partition. Entering rescue mode… grub rescue>" message means that GRUB (Grand Unified Bootloader), which is responsible for booting your Linux operating system, can’t find the partition where your Linux installation (and specifically the /boot directory or the kernel) is located. This typically happens after certain events, such as:

Resizing, moving, or deleting a partition that GRUB relied on. Installing another operating system (like Windows) that overwrote the GRUB boot record or changed partition tables. Disk errors or corruption in the partition table or the boot sector. Adding/removing a hard drive that changed the order of disk enumeration. Cloning a disk where the partition UUIDs (Universally Unique Identifiers) might not have been correctly updated.

Understanding Grub rescue>

In grub rescue> mode, you have a very limited set of commands. Your goal is to tell GRUB where to find its essential files so it can boot your system, or at least get you into a live environment to fix it properly.

How to Fix "error: no such partition. Entering rescue mode… grub rescue>"

Here’s a step-by-step approach to fix this, starting with the most common solutions.

Method 1: Identify and Set the Correct Boot Partition (Most Common Fix)

This method involves manually telling GRUB where your Linux boot files are located.

List Disks and Partitions: At the grub rescue> prompt, type:

2. ls

This will show you a list of your disks and partitions, like (hd0), (hd0,msdos1), (hd0,gpt1), (hd1,msdos1), etc.

(hdX) refers to the disk. (hdX, Y) refers to a partition on that disk. msdos indicates an MBR partition table, gpt indicates a GPT partition table.

Find the Linux Boot Partition: Now, you need to find which partition contains your Linux installation’s /boot directory (or the kernel files). You can do this by trying to list the contents of each potential partition:

4. ls (hd0,msdos1)/

5. ls (hd0,msdos2)/

6. ls (hd0,gpt1)/

7. # …and so on for all listed partitions

Look for a partition that, when listed, shows directories like boot/, etc/, home/, usr/, and most importantly, vmlinuz and initrd. img files (these are your Linux kernel and initial RAM disk). If you find boot/, try:

Ls (hdX, Y)/boot/grub/

You should see files like normal. mod, linux. mod, grub. cfg, etc., indicating this is your GRUB installation.

Example: Let’s say you find your /boot directory on (hd0,gpt2).

Set the Root Partition: Once you’ve identified the correct partition (e. g., (hd0,gpt2)), you need to tell GRUB where your boot files are.

9. set prefix=(hd0,gpt2)/boot/grub

10.set root=(hd0,gpt2)

(Note: if /boot is a separate partition, Set root would point to the / partition, and Prefix would point to the /boot/grub directory on the separate boot partition. However, in most single-partition Linux installs, /boot is part of the root partition, so Set root and Prefix often point to the same partition, with /boot/grub appended to Prefix).

Load Necessary Modules: GRUB needs certain modules to function.

12.insmod normal

If that command fails, you might need to load other modules first, like linux. mod, ext2.mod (if your file system is ext2/3/4), or fat. mod (if it’s FAT). If insmod normal works, you should see the regular GRUB prompt (not grub rescue>).

Boot Your System:

14.normal

If successful, you should see the GRUB menu or your system will start booting directly.

Update GRUB (After successful boot): Once your system boots, Immediately open a terminal and update GRUB to make the changes permanent.

Bash

Sudo update-grub

Sudo grub-install /dev/sdX # Replace /dev/sdX with your boot drive (e. g., /dev/sda)

(You can find your boot drive using lsblk or fdisk — l).

Method 2: Boot from a Live USB and Repair GRUB

This is often the most robust and recommended method, especially if Method 1 doesn’t work or you’re unsure.

Create a Live USB:

Download the ISO image of your Linux distribution (e. g., Ubuntu, Linux Mint). Use a tool like Rufus (Windows), Etcher (Windows/macOS/Linux), or dd command (Linux) to create a bootable Live USB.

Boot from Live USB:

Plug in the Live USB. Restart your computer and enter your BIOS/UEFI settings (usually by pressing F2, F10, Del, Esc during boot-up). Change the boot order to boot from the USB drive. Select "Try Ubuntu" (or your distribution’s equivalent) to run the live system.

Identify Your Linux Partitions: Once in the live environment, open a terminal and use lsblk or sudo fdisk — l to identify your Linux root partition (where / is mounted) and, if you have one, your separate /boot partition.

Example: Let’s say your root partition is /dev/sda1 and your /boot partition is /dev/sda2 (if you have a separate one, otherwise /boot is on /dev/sda1).

Mount Your Partitions:

Bash

Sudo mount /dev/sda1 /mnt # Mount your root partition

Sudo mount /dev/sda2 /mnt/boot # If you have a separate /boot partition

(If you have a separate EFI System Partition (ESP) for UEFI boot, usually formatted as FAT32, mount it too):

Bash

Sudo mount /dev/sdaX /mnt/boot/efi # Replace /dev/sdaX with your ESP partition

Chroot into Your System: This command changes your root directory to the mounted Linux installation, allowing you to run commands as if you were already booted into your system.

Bash

For i in /sys /proc /run /dev; do sudo mount —bind "$i" "/mnt$i"; done

Sudo chroot /mnt

Reinstall and Update GRUB: Now, inside the chroot environment:

Bash

Update-grub # Update GRUB configuration

Grub-install /dev/sda # Reinstall GRUB to the Master Boot Record (MBR) or EFI partition

Important: Replace /dev/sda with the Disk (not partition) where GRUB should be installed. This is usually the disk where your Linux system is installed. You can check using lsblk. For UEFI systems, grub-install usually handles the EFI partition automatically if it’s mounted correctly.

Exit Chroot and Unmount:

Bash

Exit

Sudo umount — R /mnt

Reboot: Remove the Live USB and reboot your computer. Your system should now boot normally.

Tips and Troubleshooting:

UEFI vs. Legacy (BIOS): GRUB installation differs slightly between UEFI and legacy BIOS systems. Method 2 (Live USB) usually handles this automatically. If you’re manually trying Method 1, be aware of your system’s boot mode. Secure Boot: If you’re using UEFI, ensure Secure Boot is disabled in your BIOS/UEFI settings, as it can sometimes interfere with GRUB. Disk Order: If you recently added or removed a hard drive, the disk enumeration (/dev/sda, /dev/sdb, etc.) might have changed, confusing GRUB. Method 2 helps re-identify and fix this. Backup: Always back up important data before performing major system repairs.

If you’re unsure at any step, it’s safer to seek help from a knowledgeable friend or a professional, as incorrect commands can lead to data loss or further system damage.