techAdmin
Status: Site Admin
Joined: 26 Sep 2003
Posts: 3467
Location: East Coast, West Coast? I know it's one of them.
Back to top
Posted: Dec 14, 10, 16:03    Reinstalling Grub
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
julian516
Status: Interested
Joined: 18 Aug 2009
Posts: 43
Location: Loveland, CO
Back to top
Posted: Jan 21, 11, 15:23    
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.
Display posts from previous:   

All times are GMT - 8 Hours