How to Reinstall GRUB | Repair Boot on Linux
YouTube Viewers YouTube Viewers
2.46K subscribers
16,337 views
0

 Published On Jan 28, 2024

In this video, I show you how to reinstall the GRUB bootloader when it breaks. This could happen if you are dual-booting Windows and Linux, and Windows overwrites GRUB with it's own bootloader, or if you did something to break GRUB and make your system unbootable.

If the damage to your GRUB is only minor (e.g. a missing grub.cfg file), you can skip to 4:41.

If you find this method confusing, here's an alternate method:    • How to Reinstall GRUB (Alternate Method)  

Prerequisites:
1. A Linux install media (any GRUB-based distribution with a live ISO should do)
THAT'S IT!

Commands to reinstall GRUB (from a live ISO):
List devices and partitions: sudo fdisk -l
Mount root partition: sudo mount /dev/sdXY /mnt (example: sudo mount /dev/sda3 /mnt)
Mount boot partition (if applicable): sudo mount /dev/sdXY /mnt/boot (example: sudo mount /dev/sda2 /mnt/boot)
Mount EFI System partition (if applicable): sudo mount /dev/sdXY /mnt/boot/efi (example: sudo mount /dev/sda1 /mnt/boot/efi)
Reinstall GRUB: sudo grub-install --root-directory=/mnt /dev/sdX (example: sudo grub-install --root-directory=/mnt /dev/sda)

Commands to boot from GRUB console:
List devices & partitions: ls
Set root partition: set root=[partition] (example: set root=(hd0,gpt3))
Specify vmlinuz file and root partition: linux [vmlinuz file] root=/dev/sdXY (example: linux /boot/vmlinuz root=/dev/sda3)
Specify initrd image: initrd [initrd image] (example: initrd /boot/initrd.img)
Boot the system: boot
*Don't forget to run "sudo update-grub" from within your Linux installation after doing this!*

Other commands used in this video:
List partition UUIDs: lsblk -o uuid
Edit fstab file (from a live ISO): sudo nano /mnt/etc/fstab

Join this channel to get access to perks:
https://www.youtube.com/drewhowdentec...

show more

Share/Embed