 |
 |
 |
 |
| Using Fedora General support for current versions. Ask questions about Fedora and it's software that do not belong in any other forum. |

18th February 2009, 09:20 PM
|
 |
Registered User
|
|
Join Date: Feb 2009
Location: Bitola, Macedonia
Posts: 24

|
|
|
How to REINSTALL GRUB with LiveCD F10
I reinstalled winXP and lost grub loader. I have LiveCD with Fedora 10. How can I reinstall GRUB using this CD ?
|

18th February 2009, 10:29 PM
|
 |
Retired User
|
|
Join Date: Oct 2004
Location: London, UK
Posts: 4,999

|
|
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
|

18th February 2009, 11:16 PM
|
 |
Registered User
|
|
Join Date: Feb 2009
Location: Bitola, Macedonia
Posts: 24

|
|
Quote:
Originally Posted by sideways
|
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
|

23rd February 2009, 06:27 PM
|
|
Registered User
|
|
Join Date: Jun 2006
Posts: 7,551

|
|
Quote:
|
Originally Posted by goxi
I mange to repair grub with super grub disk...
|
Hello goxi and sideways,
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/temp
mount /dev/sda5 /mnt/temp
grub-install --root-directory=/mnt/temp /dev/sda When the busted system has separate ext3 boot and root partitions (say, /dev/sda5 and /dev/sda6)... mkdir -p /mnt/temp/boot
mount /dev/sda5 /mnt/temp/boot
mount /dev/sda6 /mnt/temp
grub-install --root-directory=/mnt/temp /dev/sda When 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)... mkdir -p /mnt/temp/boot
vgchange -a y
lvdisplay
mount /dev/sda5 /mnt/temp/boot
mount /dev/VolGroup00/LogVol00 /mnt/temp
grub-install --root-directory=/mnt/temp /dev/sda If 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... /sbin/grub
grub> root (hdx,y)
grub> setup (hd0)
Last edited by stoat; 17th June 2010 at 01:00 AM.
|

24th February 2009, 04:27 PM
|
 |
Registered User
|
|
Join Date: Feb 2009
Location: Bitola, Macedonia
Posts: 24

|
|
Quote:
Originally Posted by stoat
Hello goxi and sideways,
I think everyone that 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/temp
mount /dev/sda5 /mnt/temp
grub-install --root-directory=/mnt/temp /dev/sda When the busted system has separate ext3 boot and root partitions (say, /dev/sda5 and /dev/sda6)... mkdir -p /mnt/temp/boot
mount /dev/sda5 /mnt/temp/boot
mount /dev/sda6 /mnt/temp
grub-install --root-directory=/mnt/temp /dev/sda When 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)... mkdir -p /mnt/temp/boot
vgchange -a y
vgscan
lvdisplay
mount /dev/sda5 /mnt/temp/boot
mount /dev/VolGroup00/LogVol00 /mnt/temp
grub-install --root-directory=/mnt/temp /dev/sda If 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... /sbin/grub
grub> root (hdx,y)
grub> setup (hd0)
|
Thanks stoat. I tried something like this, but maybe I missed something. I hope that I will not have need to do this. Anyway your solution is more elegant
|

24th February 2009, 06:49 PM
|
|
Registered User
|
|
Join Date: Jun 2006
Posts: 7,551

|
|
Quote:
|
Originally Posted by goxi
I tried something like this, but maybe I missed something. I hope that I will not have need to do this. Anyway your solution is more elegant
|
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.
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 07:20 PM.
|

7th April 2009, 06:55 PM
|
|
Registered User
|
|
Join Date: Aug 2008
Location: London, UK
Posts: 69

|
|
|
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.
|

7th April 2009, 07:53 PM
|
|
Registered User
|
|
Join Date: Aug 2008
Location: London, UK
Posts: 69

|
|
Quote:
Originally Posted by sideways
|
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.
|

7th April 2009, 08:22 PM
|
 |
Retired User
|
|
Join Date: Oct 2004
Location: London, UK
Posts: 4,999

|
|
|
what does
find /grub/grub.conf
or
find /boot/grub/grub.conf
return when you boot from the hard disk?
|

7th April 2009, 08:30 PM
|
|
Registered User
|
|
Join Date: Aug 2008
Location: London, UK
Posts: 69

|
|
Quote:
Originally Posted by sideways
what does
find /grub/grub.conf
or
find /boot/grub/grub.conf
return when you boot from the hard disk?
|
Thanks.
find /grub/grub.conf returns (hd0,4) while find /boot/grub/grub.conf returns file not found.
Last edited by alexuk; 7th April 2009 at 08:41 PM.
Reason: results reported
|

7th April 2009, 08:40 PM
|
 |
Retired User
|
|
Join Date: Oct 2004
Location: London, UK
Posts: 4,999

|
|
|
yes it's possible that one grub is installed in the mbr and another in the (first sector of the) boot partition
|

7th April 2009, 10:22 PM
|
|
Registered User
|
|
Join Date: Aug 2008
Location: London, UK
Posts: 69

|
|
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).
|

7th April 2009, 10:43 PM
|
 |
Retired User
|
|
Join Date: Oct 2004
Location: London, UK
Posts: 4,999

|
|
|
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.
|

8th April 2009, 07:40 AM
|
|
Registered User
|
|
Join Date: Aug 2008
Location: London, UK
Posts: 69

|
|
|
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.
|
| Thread Tools |
Search this Thread |
|
|
|
| Display Modes |
Linear Mode
|
Posting Rules
|
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
HTML code is Off
|
|
|
Current GMT-time: 13:34 (Wednesday, 19-06-2013)
|
|
 |
 |
 |
 |
|
|