I reinstalled winXP and lost grub loader. I have LiveCD with Fedora 10. How can I reinstall GRUB using this CD ?
I reinstalled winXP and lost grub loader. I have LiveCD with Fedora 10. How can I reinstall GRUB using this CD ?
Theoretically you can do it like this, but last time I tried the '-o dev' option in mount it didn't make the /dev nodes appear.
So probably best to do it from a rescue session or the super grub boot disk
Thanks sideways. I mange to repair grub with super grub disk, but with version 1.0 (1.5 not do the job). I first copied boot folder from ext3 partition on my winXP partition and loaded kernel image in super grub disk so I started fedora after reboot, and from fedora I reinstalled grub with
grub-install
![]()
Hello goxi and sideways,Originally Posted by goxi
I think everyone who uses a GRUB-booted system should possess a Super Grub Disk. But the title question is still a good one. Here are some more LiveCD methods that should work (just for the record). I tested the following examples using a Fedora 10 LiveCD to re-install GRUB in the master boot record of /dev/sda. Boot with the LiveCD, and open a terminal, get root privileges with su -, and then...
When the busted system is in a single ext3 root partition (say, /dev/sda5)...mkdir /mnt/tempWhen the busted system has separate ext3 boot and root partitions (say, /dev/sda5 and /dev/sda6)...
mount /dev/sda5 /mnt/temp
grub-install --root-directory=/mnt/temp /dev/sdamkdir -p /mnt/temp/bootWhen the busted system has a separate ext3 boot partition (say, /dev/sda5), and the root partition is a logical volume (say, /dev/VolGroup00/LogVol00 according to lvdisplay)...
mount /dev/sda5 /mnt/temp/boot
mount /dev/sda6 /mnt/temp
grub-install --root-directory=/mnt/temp /dev/sdamkdir -p /mnt/temp/bootIf grub-install fails with a read error or the boot loader still doesn't work, always try the GRUB shell (and vice versa). They both accomplish the same thing, but different things occur in the background. It's not necessary to mount partitions when using the GRUB shell commands in the LiveCD. Change x & y in the example to the busted system's boot partition...
vgchange -a y
lvdisplay
mount /dev/sda5 /mnt/temp/boot
mount /dev/VolGroup00/LogVol00 /mnt/temp
grub-install --root-directory=/mnt/temp /dev/sda/sbin/grub
grub> root (hdx,y)
grub> setup (hd0)
Last edited by stoat; 17th June 2010 at 01:00 AM.
Well actually, even though I always have LiveCDs around, I never use them to repair the GRUB boot loader. I have always used the Super Grub Disk, or a GRUB boot floppy, or a GRUB boot CD (all of which I also always have handy) to boot the busted system. Then, once it's running, I use the GRUB shell or grub-install in a terminal of the now running system to re-install GRUB.Originally Posted by goxi
But I still think your original question was good and needed an answer. I tested every one of those examples on a computer that I use just for testing ideas. I published the results here just for the record and future readers who will come here only because they have the same question. But I'm glad that you fixed your own problem no matter how it was done.
Last edited by stoat; 24th February 2009 at 08:20 PM.
I tried stoat's procedure (variant 3 given my case) but at the last step I am getting grub complaining about stage2 not being read correctly. Any ideas? Incidentally I do not know why I lost the mbr on this machine (dual boot vista/fc10) perhaps related with the install of the latest kernel.
The commands under grub do not work either (setting root(hd0,4) plus setup): says all checks succeeded but when rebooting all I get is a GRUB prompt.
Any help appreciated. Could download the rescue disc but I have little broadband from here and doing this with a livecd FC10.
Do you mean you have a grub command prompt?
In that case you can follow from step 2 here
http://dailypackage.fedorabook.com/i...ling-Grub.html
I can get a grub prompt either through the live image on usb and through booting hd0. However as I was trying to say above, if I do a root (hd0,4) and setup (hd0) grub reports success but the machine does not boot (gives a grub prompt). This's happened to me before but I always fixed it easily - I must be missing something.
what does
find /grub/grub.conf
or
find /boot/grub/grub.conf
return when you boot from the hard disk?
yes it's possible that one grub is installed in the mbr and another in the (first sector of the) boot partition
OK, managed to boot by passing grub:
grub> configfile (hd0,4)/grub/grub.conf
and then ran grub-install /dev/sda from there.
Thanks to sideways and to the excellent http://forums.fedoraforum.org/showthread.php?t=197514
A big boo to yum which messed up the mbr while installing a kernel update (at least I think).
When yum installs a new kernel it does not reinstall grub, all it does is update grub.conf wherever it is located for the current installation. Now, if you are multibooting it's possible your grub bootloader in the mbr doesn't read grub.conf from your current /boot/grub directory - it may be read from an existing separate /boot partition.
I suspect that's what's happened here, in that case you may just be booting the old kernel unless you edit the grub.conf in the separate partition to point to the new kernel.
I checked and I am running 21-170 which is the latest I installed I think. It'd be good to get to the bottom of this but happy it's all up and running now. Thanks again.