How to REINSTALL GRUB with LiveCD F10
FedoraForum.org - Fedora Support Forums and Community
Page 1 of 2 1 2 LastLast
Results 1 to 15 of 18
  1. #1
    Join Date
    Feb 2009
    Location
    Bitola, Macedonia
    Posts
    24
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    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 ?

  2. #2
    Join Date
    Oct 2004
    Location
    London, UK
    Posts
    4,995
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    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

  3. #3
    Join Date
    Feb 2009
    Location
    Bitola, Macedonia
    Posts
    24
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Smile

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


  4. #4
    Join Date
    Jun 2006
    Posts
    7,544
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    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.

  5. #5
    Join Date
    Feb 2009
    Location
    Bitola, Macedonia
    Posts
    24
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    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

  6. #6
    Join Date
    Jun 2006
    Posts
    7,544
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    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 08:20 PM.

  7. #7
    Join Date
    Aug 2008
    Location
    London, UK
    Posts
    85
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    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.

  8. #8
    Join Date
    Oct 2004
    Location
    London, UK
    Posts
    4,995
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    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

  9. #9
    Join Date
    Aug 2008
    Location
    London, UK
    Posts
    85
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by sideways
    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.

  10. #10
    Join Date
    Oct 2004
    Location
    London, UK
    Posts
    4,995
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    what does

    find /grub/grub.conf

    or

    find /boot/grub/grub.conf

    return when you boot from the hard disk?

  11. #11
    Join Date
    Aug 2008
    Location
    London, UK
    Posts
    85
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    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

  12. #12
    Join Date
    Oct 2004
    Location
    London, UK
    Posts
    4,995
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    yes it's possible that one grub is installed in the mbr and another in the (first sector of the) boot partition

  13. #13
    Join Date
    Aug 2008
    Location
    London, UK
    Posts
    85
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    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).

  14. #14
    Join Date
    Oct 2004
    Location
    London, UK
    Posts
    4,995
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    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.

  15. #15
    Join Date
    Aug 2008
    Location
    London, UK
    Posts
    85
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    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.

Page 1 of 2 1 2 LastLast

Similar Threads

  1. LiveCD, grub and MBR
    By juszczec in forum Installation, Upgrades and Live Media
    Replies: 2
    Last Post: 1st March 2008, 11:33 PM
  2. Reinstall Grub
    By michi in forum Installation, Upgrades and Live Media
    Replies: 2
    Last Post: 27th April 2006, 06:10 PM
  3. cant use grub after reinstall xp!help
    By c4danger in forum Installation, Upgrades and Live Media
    Replies: 2
    Last Post: 25th March 2006, 03:09 PM
  4. Q: Reinstall GRUB
    By aero-z in forum Installation, Upgrades and Live Media
    Replies: 2
    Last Post: 19th July 2005, 09:21 PM

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •