How to Reinstall GRUB | Repair Boot on Linux
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.
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/drewhowdentech/join
Views : 419
linux