How to fix/re-install grub from a live usb/cd.


First, boot the affected computer from a live usb or cd. Then mount the root file system on /mnt (assumes the hard drive you want to install grub on is /dev/sda).

mount /dev/sda2 /mnt

If necessary, mount /boot

mount /dev/sda1 /mnt/boot

Mount the virtual file systems /dev/, proc, etc

mount --bind /dev /mnt/dev
mount --bind /dev/pts /mnt/dev/pts
mount --bind /proc /mnt/proc
mount --bind /sys /mnt/sys

Chroot into the mounted environment.

sudo chroot /mnt

Install grub.

grub-install /dev/sda

Generate a grub config file.

update-grub

Exit the chroot environment and unmount the file systems.

exit
umount /mnt/sys
umount /mnt/proc
umount /mnt/dev/pts
umount /mnt/dev
umount /mnt

Reboot!

 

 

 

 

Tags: grub, Linux
2015-05-26 04:37 Roy Kidder {writeRevision}
Average rating: 0 (0 Votes)

You cannot comment on this entry

Chuck Norris has counted to infinity. Twice.