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
- 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.
- Open Terminal:
- Launch a terminal in the live environment.
- Identify Linux Partition:
- Identify the partition where your Linux system is installed. You can use commands like
fdisk -l
orlsblk
to list partitions.
- Identify the partition where your Linux system is installed. You can use commands like
- Mount the Partition:
- Mount the Linux partition. Replace
/dev/sdXY
with your actual partition identifier.sudo mount /dev/sdXY /mnt
- Mount the Linux partition. Replace
- 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
- Bind mount the necessary directories:
- Chroot into the Installed System:
- Chroot into your installed system:
sudo chroot /mnt
- Chroot into your installed system:
- 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.
- Reinstall GRUB to the Master Boot Record (MBR) of your drive:
- Update GRUB Configuration:
- Update GRUB configuration:
update-grub
- Update GRUB configuration:
- 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
- Exit the chroot environment and unmount partitions:
Scenario 2: GRUB Deleted or Overwritten by Another Bootloader
- Follow Steps 1 to 5 from Scenario 1:
- Boot from a Live CD/USB and mount the Linux partition.
- Install GRUB:
- Install GRUB to the MBR:
sudo grub-install --boot-directory=/mnt/boot /dev/sdX
- Replace
/dev/sdX
with your actual drive identifier.
- Install GRUB to the MBR:
- Update GRUB Configuration:
- Update GRUB configuration:
sudo update-grub
- Update GRUB configuration:
- Follow Steps 7 to 9 from Scenario 1:
- Exit the chroot environment, unmount partitions, and reboot.
Scenario 3: Windows Overwrote GRUB
- Follow Steps 1 to 5 from Scenario 1:
- Boot from a Live CD/USB and mount the Linux partition.
- 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.
- Install GRUB specifying the boot directory:
- Update GRUB Configuration:
- Update GRUB configuration:
sudo update-grub
- Update GRUB configuration:
- 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.
- 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.