Recovering from a Damaged or Deleted GRUB Installation

Recovering from a Damaged or Deleted GRUB Installation

Recovering from a damaged or deleted GRUB (Grand Unified Bootloader) installation is essential for restoring your system’s ability to boot. Here’s a guide on how to recover GRUB in different scenarios:

Scenario 1: GRUB Missing or Corrupted

  1. Boot from a Live CD/USB:
    • Use a live CD or USB with the same version of Ubuntu or Linux distribution that is installed on your system.
  2. Open Terminal:
    • Launch a terminal in the live environment.
  3. Identify Linux Partition:
    • Identify the partition where your Linux system is installed. You can use commands like fdisk -l or lsblk to list partitions.
  4. Mount the Partition:
    • Mount the Linux partition. Replace /dev/sdXY with your actual partition identifier.
      sudo mount /dev/sdXY /mnt
  5. Bind Mount Important Directories:
    • Bind mount the necessary directories:
      sudo mount --bind /dev /mnt/dev sudo mount --bind /proc /mnt/proc sudo mount --bind /sys /mnt/sys
  6. Chroot into the Installed System:
    • Chroot into your installed system:
      sudo chroot /mnt
  7. Reinstall GRUB:
    • Reinstall GRUB to the Master Boot Record (MBR) of your drive:
      grub-install /dev/sdX
    • Replace /dev/sdX with your actual drive identifier.
  8. Update GRUB Configuration:
    • Update GRUB configuration:
      update-grub
  9. Exit and Reboot:
    • Exit the chroot environment and unmount partitions:
      exit sudo umount /mnt/sys sudo umount /mnt/proc sudo umount /mnt/dev sudo umount /mnt
    • Reboot your system:
      sudo reboot

Scenario 2: GRUB Deleted or Overwritten by Another Bootloader

  1. Follow Steps 1 to 5 from Scenario 1:
    • Boot from a Live CD/USB and mount the Linux partition.
  2. Install GRUB:
    • Install GRUB to the MBR:
      sudo grub-install --boot-directory=/mnt/boot /dev/sdX
    • Replace /dev/sdX with your actual drive identifier.
  3. Update GRUB Configuration:
    • Update GRUB configuration:
      sudo update-grub
  4. Follow Steps 7 to 9 from Scenario 1:
    • Exit the chroot environment, unmount partitions, and reboot.

Scenario 3: Windows Overwrote GRUB

  1. Follow Steps 1 to 5 from Scenario 1:
    • Boot from a Live CD/USB and mount the Linux partition.
  2. Install GRUB with a Specific Path:
    • Install GRUB specifying the boot directory:
      sudo grub-install --boot-directory=/mnt/boot /dev/sdX
    • Replace /dev/sdX with your actual drive identifier.
  3. Update GRUB Configuration:
    • Update GRUB configuration:
      sudo update-grub
  4. Fix Windows Bootloader (if needed):
    • If Windows overwrote the MBR, you might need to repair the Windows bootloader. Use a Windows installation USB/DVD and run the “Repair your computer” option.
  5. Follow Steps 7 to 9 from Scenario 1:
    • Exit the chroot environment, unmount partitions, and reboot.

These steps should help you recover GRUB and restore your system’s ability to boot into Linux. Adjust the commands based on your system’s specifics.

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.