Reinstalling Grub
techAdmin
Status: Site Admin
Joined: 26 Sep 2003
Posts: 4128
Location: East Coast, West Coast? I know it's one of them.
Reply Quote
Assume drive is attached or you are in a livecd.

Assume we are mounting it to /media/sda1

What is happening is that we are mounting enough of our local file system to enable the chroot environment to emulate what grub requires to operate.

:: Code ::
mount /dev/sda1 /media/sda1

mount --bind /proc /media/sda1/proc
mount --bind /dev /media/sda1/dev
mount --bind /sys /media/sda1/sys
chroot /media/sda1
update-grub
umount /media/sda1/sys
umount /media/sda1/dev
umount /media/sda1/proc
exit


if you need to reinstall grub to partition boot sector, or to mbr, do this instead of update-grub:
:: Code ::
# to install to partition root, let's say it's /dev/sda1
update-grub
grub-install --force /dev/sda1

# or, if you want to install to MBR, main boot menu that is:
update-grub
grub-install /dev/sda


Before you run update grub, after you've mounted and chrooted, you might also want to add, to: /etc/default/grub
GRUB_DISABLE_OS_PROBER="true"
if you don't want all the other operating systems on the computer to show, this is useful for systems where you boot from one master mbr grub, which has all the os install choices, and then each sub os boots from partition root, where you don't need to see the other os'es

Edit this before running update-grub
Back to top
julian516
Status: Interested
Joined: 18 Aug 2009
Posts: 43
Location: Loveland, CO
Reply Quote
This has saved me a number of times, while I grind my teeth.

Grub2 tends to do that.

Thanks once again, this will help a bunch of people.
Back to top
Display posts from previous:   

All times are GMT - 8 Hours