error: no such partition

GRUB config missing: fix 'error: no such partition' on boot

Linux & Unix Intermediate 👁 6 views 📅 Jun 28, 2026

Your PC boots to a black screen with 'error: no such partition' after a kernel update or partition resize. The fix is rebuilding GRUB from a live USB.

You boot your Linux machine one morning, and instead of the familiar GRUB menu, you get a black screen with error: no such partition. Then it drops you to a grub> prompt. Nothing works. You can't type boot or exit. This usually happens right after you resized a partition with GParted, or after a kernel update that rewrote GRUB's config.

The real cause is simple: GRUB's configuration file (usually /boot/grub/grub.cfg) points to a partition number that doesn't match reality. For example, your root partition used to be (hd0,msdos5), but after resizing, it moved to (hd0,msdos6). GRUB uses the old number, and it can't find the files it needs to boot.

You can fix this without reinstalling your OS. The trick is to boot from a live USB, mount your system, and run a few commands to regenerate the GRUB config. Here's exactly how.

What you'll need

  • A live USB with Ubuntu, Debian, or any Linux distro (same architecture, 64-bit or 32-bit).
  • About 10 minutes.
  • Basic comfort with a terminal.

Step-by-step fix

  1. Boot from the live USB.

    Plug the USB in, restart your machine, and press the key to enter the boot menu (F12, F2, Del, or Esc — it depends on your motherboard). Choose your USB drive. After a minute or two, you'll see the live desktop.

    Expected outcome: You're sitting at a normal desktop with a terminal you can open.

  2. Open a terminal.

    In most distros, you can press Ctrl+Alt+T. Or find Terminal in the applications menu.

  3. Find your Linux partition.

    Run sudo fdisk -l. You'll see a list of drives. Look for your main Linux partition — it's usually ext4 or btrfs, and it's probably the largest one. Mine is /dev/sda2. Write yours down.

    sudo fdisk -l

    Expected outcome: A list like /dev/sda1 (EFI or boot), /dev/sda2 (root), /dev/sda3 (swap).

  4. Mount your root partition.

    Replace /dev/sda2 with your actual partition.

    sudo mount /dev/sda2 /mnt

    Expected outcome: No output means it worked. If you get an error like "mount: wrong fs type", you might have the wrong partition. Double-check with lsblk -f.

  5. Mount the boot and EFI partitions (if you have them).

    If you have a separate /boot partition (check with lsblk), mount it:

    sudo mount /dev/sda1 /mnt/boot

    If you have an EFI partition (usually FAT32, labeled EFI System), mount it too:

    sudo mount /dev/sda1 /mnt/boot/efi

    Expected outcome: Both should mount silently. If you get "mount point does not exist", create it with sudo mkdir -p /mnt/boot/efi then try again.

  6. Chroot into your system.

    This makes the terminal act like you're inside your installed Linux, not the live USB.

    sudo chroot /mnt

    Expected outcome: The prompt changes to something like root@host:/#. You're now inside your system.

  7. Reinstall GRUB to the drive's MBR or EFI.

    For BIOS/MBR systems (older style):

    grub-install /dev/sda

    For UEFI systems (newer style):

    grub-install --target=x86_64-efi --efi-directory=/boot/efi --bootloader-id=GRUB

    Expected outcome: You should see "Installation finished. No error reported." If you get an error about grub-install: error: cannot find a device for /boot/efi, your EFI partition isn't mounted. Go back to step 5.

  8. Regenerate the GRUB configuration file.

    This is the key step. It creates a fresh grub.cfg that uses the current partition numbers.

    update-grub

    If that command isn't found (some distros use grub-mkconfig), try:

    grub-mkconfig -o /boot/grub/grub.cfg

    Expected outcome: You'll see lines like "Found linux image: /boot/vmlinuz-5.10.0-21-amd64" and "Found initrd image: /boot/initrd.img-5.10.0-21-amd64". If you see nothing or an error, your /boot might be empty — that's a different problem.

  9. Exit chroot and unmount.

    Type exit to leave the chroot environment. Then unmount everything:

    sudo umount /mnt/boot/efi
    sudo umount /mnt/boot
    sudo umount /mnt

    Expected outcome: No errors.

  10. Reboot.

    Remove the live USB and restart: sudo reboot.

    Expected outcome: You should see the GRUB menu, and your system should boot normally.

If it still fails

Check these things in order:

  • Partition order changed again? Sometimes after a resize, the partition numbers shift. Run sudo fdisk -l from the live USB and compare to what you mounted. If the root partition changed from /dev/sda2 to /dev/sda3, mount the new number and repeat steps 4–10.
  • Boot flag missing? Use sudo fdisk /dev/sda, then press a and choose the partition you want to mark as bootable (usually the same as your root partition if you don't have a separate /boot). Then write changes with w.
  • UEFI vs BIOS mismatch? If your system was installed in UEFI mode and you tried to install GRUB for BIOS, it won't work. Check your firmware settings (F2 at boot) — if it says "UEFI" or "Legacy", make sure you use the matching command in step 7.
  • Boot partition is full? If /boot is 100% full, update-grub will fail. From the chroot, run df -h /boot. If it's over 90%, delete old kernels with apt autoremove or manually delete files in /boot (keep the current ones!).
  • Filesystem corruption? Run sudo fsck /dev/sda2 from the live USB (unmount it first). If it finds errors, run it again with -y to auto-fix them.

This fix has saved me more times than I can count. The trick is always the same: chroot, reinstall, update-grub. Don't skip the update-grub step — that's where the magic happens.

Was this solution helpful?