Page 1 of 3 123 LastLast
Results 1 to 10 of 23

Thread: GRUB reinstall without DVD

  1. #1
    Join Date
    Sep 2009
    Location
    Prague
    Posts
    18

    Default GRUB reinstall without DVD

    Hello,

    I'm going to reinstall the Windows partition for testing purposes. It will of course overwrite GRUB. How do I get it back in openSuse?

    In Debian I'd do "dpkg-reconfigure grub", in Gentoo I'd simply re-emerge it. What's the openSuse way of doing this? I don't want to download the whole installation DVD just to repair GRUB, I'm going to boot Gentoo CD, chroot and then repair it from within.

    Will just grub-install do? Or is there any "better" way, like something in Yast?

    Thanks in advance!

  2. #2

    Default Re: GRUB reinstall without DVD

    The best thing would be to download supergrub before installing windows:

    Super Grub Disk Homepage

    and burn it to a CD.
    That will later restore your grub.

    HTH

    Lenwolf

  3. #3
    Join Date
    Mar 2008
    Location
    Phuket, Thailand
    Posts
    27,109
    Blog Entries
    40

    Default Re: GRUB reinstall without DVD

    I'm not expert, but I think this depends on where grub is located.

    Is grub on the MBR? Or is it on the root partition?

    My wife just re-installed MS-Windows on her PC that dual boots between WinXP and openSUSE-11.1. Prior to installing MS-Windows, I went into YaST > System > Boot Loader > Boot Loader Installation to check where grub was located on her PC. I noted it was in the root with a generic MBR.

    Her MS-Windows was on /dev/sda1, and her openSUSE root on /dev/sda2. And hence grub was on /dev/sda2 and not on the MBR.

    So prior to installing MS-Windows, I changed her active partition from /dev/sda2 to /dev/sda1, rebooted, and noted her PC booted direct to MS-Windows with no grub (note I have various utility CDs standing by in case things get messed up, so such experimentation on her PC is not a worry).

    She is still (a day later) adding MS-Windows apps to her new winXP install, so it may be a day or two before I change her active partition back from /dev/sda1 to /dev/sda2. I anticipate when I change the active partition back to /dev/sda2 it should load grub, and things will work.

    But note if openSUSE's grub had been on the MBR it would not be this simple.

    I think you should always have an installation CD reader, DVD reader, or floppy, to handle contingencies. Borrow an external one if need be. And ensure you have rescue/contingency CD, DVD, or floppy's near by. Too many things can go wrong.

  4. #4

    Default Re: GRUB reinstall without DVD

    Also look at the comprehensive tutorial at:

    HowTo Boot into openSUSE when it won't Boot from the Grub Code on the Hard Drive

    Lenwolf

  5. #5
    Join Date
    Sep 2009
    Location
    Prague
    Posts
    18

    Default Re: GRUB reinstall without DVD

    Thank you for your replies!

    and burn it to a CD.
    This is just what I wanted to avoid, downloading and burning anything (though this is much smaller than openSuse DVD). I hope there is an easier way, I have an installed Linux system after all.

    I think you should always have an installation CD reader, DVD reader, or floppy, to handle contingencies. Borrow an external one if need be. And ensure you have rescue/contingency CD, DVD, or floppy's near by. Too many things can go wrong.
    Thanks for warning . I always keep Gentoo netinst CD handy, it's very useful. SystemRescue CD is based on it IIRC. Anyway, I usually need it only only to chroot into unbootable system.

    I'll just try a shot in the dark: reinstall Windoze and then "grub-install /dev/sda" in chrooted openSuse. It works in Gentoo, so why shouldn't it here, after all . Debian's "dpkg-reconfigure grub" does more or less the same. It will (should) install GRUB into MBR, while it's in root now, but what the heck, it should just work. Then I'll try to uninstall and re-install GRUB with Yast if the first didn't help, but I believe it will be just fine. I only fear that Yast won't like what I did and it will not find GRUB after I install it manually, let's hope it won't cause problems (it seems to me that Yast usually adds work and complicates things, but I admit that I don't understand it very well ).

    I'll keep you informed .

    EDIT (new post appeared before I finished this one):
    Also look at the comprehensive tutorial at:

    HowTo Boot into openSUSE when it won't Boot from the Grub Code on the Hard Drive

    Lenwolf
    I've found this article, but I don't want to download the whole DVD as I have a slow connection. Besides, it seems to me like taking a cannon to shot a sparrow...
    Last edited by tadeas_moravec; 29-Sep-2009 at 23:59. Reason: new post appeared before I finished this one

  6. #6

    Default Re: GRUB reinstall without DVD

    Quote Originally Posted by tadeas_moravec View Post
    Hello,

    I'm going to reinstall the Windows partition for testing purposes. It will of course overwrite GRUB. How do I get it back in openSuse?

    In Debian I'd do "dpkg-reconfigure grub", in Gentoo I'd simply re-emerge it. What's the openSuse way of doing this? I don't want to download the whole installation DVD just to repair GRUB, I'm going to boot Gentoo CD, chroot and then repair it from within.

    Will just grub-install do? Or is there any "better" way, like something in Yast?

    Thanks in advance!
    I assume you have Windows and SUSE on the same HD but in different partitions? And that this is the first HD (in bios boot sequence)? Can you confirm this?

    After you reinstall Windows, you just need to run a grub shell as root from anywhere, typically a live CD. Then type two commands:
    grub> root (hd0,x) - where x refers to the SuSE partition (probably 1 if Windows is at 0 - grub counts from 0)
    grub> setup (hd0)
    grub> quit

    That ought to reinstate the grub in your MBR.

    (you can confirm the address of the SuSE partition by using the grub command 'find /boot/vmlinuz')

    What is going on is that when you originally installed SuSE alongside Windows, SuSE created a GRUB menu at /boot/grub/menu.lst. This file defines the Grub OS selections. This menu should still be ok even if you reinstall Windows. When you execute the grub setup command it reinstalls the bootloader based on the menu.lst.

    If your HD is not the first HD in the bios boot sequence it gets more complicated. Let's leave that on the assumption that this is not your situation.

    See also (somewhat helpful): GNU GRUB Manual 0.97
    OS: Linux 2.6.27.29-0.1-default x86_64
    System: openSUSE 11.1 (x86_64)
    KDE: 4.1.3 (KDE 4.1.3) "release 4.10.4"

  7. #7

    Default Re: GRUB reinstall without DVD

    Quote Originally Posted by oldcpu View Post
    I'm not expert, but I think this depends on where grub is located.

    Is grub on the MBR? Or is it on the root partition?

    My wife just re-installed MS-Windows on her PC that dual boots between WinXP and openSUSE-11.1. Prior to installing MS-Windows, I went into YaST > System > Boot Loader > Boot Loader Installation to check where grub was located on her PC. I noted it was in the root with a generic MBR.

    Her MS-Windows was on /dev/sda1, and her openSUSE root on /dev/sda2. And hence grub was on /dev/sda2 and not on the MBR.

    So prior to installing MS-Windows, I changed her active partition from /dev/sda2 to /dev/sda1, rebooted, and noted her PC booted direct to MS-Windows with no grub (note I have various utility CDs standing by in case things get messed up, so such experimentation on her PC is not a worry).

    She is still (a day later) adding MS-Windows apps to her new winXP install, so it may be a day or two before I change her active partition back from /dev/sda1 to /dev/sda2. I anticipate when I change the active partition back to /dev/sda2 it should load grub, and things will work.

    But note if openSUSE's grub had been on the MBR it would not be this simple.

    I think you should always have an installation CD reader, DVD reader, or floppy, to handle contingencies. Borrow an external one if need be. And ensure you have rescue/contingency CD, DVD, or floppy's near by. Too many things can go wrong.
    I'm still getting to grips with some of this myself. My understanding is that the bios always runs the bootloader from the MBR which is always at the physical start of the HD before the first partition. I understand that Windows puts a bootloader here and that when SuSE is installed this bootloader is replaced by GRUB's (stage 1). So although SuSE may be at (hd0,1) the GRUB bootloader is still instantiated at the MBR at the start of the disk.

    So if your wife were to reinstall Windows I reckon you'd lose your GRUB and you wouldn't be able to access SuSE in the second partition.

    See also: Master boot record - Wikipedia, the free encyclopedia
    OS: Linux 2.6.27.29-0.1-default x86_64
    System: openSUSE 11.1 (x86_64)
    KDE: 4.1.3 (KDE 4.1.3) "release 4.10.4"

  8. #8

    Default Re: GRUB reinstall without DVD

    For the record I imagine that to recover an overwritten GRUB you can use any live linux CD or USB. So you could probably use a Knoppix live CD or fedora USB stick to run linux, then open a command terminal, become root and run grub. IOW I don't think you need to use a SuSE grub to fix your SuSE bootloader because the grub instructions are contained in menu.lst in your SuSE /boot/grub directory.
    OS: Linux 2.6.27.29-0.1-default x86_64
    System: openSUSE 11.1 (x86_64)
    KDE: 4.1.3 (KDE 4.1.3) "release 4.10.4"

  9. #9
    Join Date
    Mar 2008
    Location
    Phuket, Thailand
    Posts
    27,109
    Blog Entries
    40

    Default Re: GRUB reinstall without DVD

    Quote Originally Posted by traderbam View Post
    Quote Originally Posted by oldcpu View Post
    Prior to installing MS-Windows, I went into YaST > System > Boot Loader > Boot Loader Installation to check where grub was located on her PC. I noted it was in the root with a generic MBR.

    Her MS-Windows was on /dev/sda1, and her openSUSE root on /dev/sda2. And hence grub was on /dev/sda2 and not on the MBR. ..... I anticipate when I change the active partition back to /dev/sda2 it should load grub, and things will work.
    I'm still getting to grips with some of this myself. My understanding is that the bios always runs the bootloader from the MBR which is always at the physical start of the HD before the first partition. I understand that Windows puts a bootloader here and that when SuSE is installed this bootloader is replaced by GRUB's (stage 1). So although SuSE may be at (hd0,1) the GRUB bootloader is still instantiated at the MBR at the start of the disk.

    So if your wife were to reinstall Windows I reckon you'd lose your GRUB and you wouldn't be able to access SuSE in the second partition.

    See also: Master boot record - Wikipedia, the free encyclopedia
    My wife is a big winXP user, and not much of a Linux fan, although she does want Linux on her PC. I guess I'll find out in a day or two about her MBR and grub (and what winXP did to the MBR), when she asks me to restore the Linux (grub) boot loader selection (upon boot) back on her PC.

    Given the many recovery boot CDs I have, I'm not worried, and it should be a good learning experience to see what happens when I try different things.

    Edit - for educational purposes (ie educate myself) the 1st thing I will try is simply change the active partition from /dev/sda1 to /dev/sda2.

  10. #10

    Default Re: GRUB reinstall without DVD

    Quote Originally Posted by oldcpu View Post
    My wife is a big winXP user, and not much of a Linux fan, although she does want Linux on her PC. I guess I'll find out in a day or two about her MBR and grub (and what winXP did to the MBR), when she asks me to restore the Linux (grub) boot loader selection (upon boot) back on her PC.

    Given the many recovery boot CDs I have, I'm not worried, and it should be a good learning experience to see what happens when I try different things.

    Edit - for educational purposes (ie educate myself) the 1st thing I will try is simply change the active partition from /dev/sda1 to /dev/sda2.
    from: Understanding Hard Disk Partitions
    Each hard drive also has one of its possible 4 partitions flagged as an active partition. The active partition is a special flag assigned to only one partition on a hard drive that the Master Boot Record (MBR) uses to boot your computer into an operating system. As only one partition may be set as the active partition, you may be wondering how people can have multiple operating systems installed on different partitions, and yet still be able to use them all. This is accomplished by installing a boot loader in the active partition. When the computer starts, it will read the MBR and determine the partition that is flagged as active. This partition is the one that contains the boot loader. When the operating system boots off of this partition the boot loader will start and allow you to choose which operating systems you would like to boot from.
    The active "flag" in the MBR partition table tells the bios which partition to look in for a bootloader to run. Ok so it seems in the case of a dual-boot off the same HD, the MBR partition table is altered to define the new, second partition and make it active. The GRUB bootloader program is installed in the second partition. The Windows bootloader program in the first partition is unaffected.

    This explains why, when you change the active flag, that Windows' bootloader starts up and you don't see a GRUB menu.

    In the case of a dual boot system where Windows is on hd0 and SuSE is on hd1 and the system boots off hd0 the GRUB bootloader must replace the Windows bootloader on hd0. In this case, if Windows is reinstalled the GRUB bootloader gets overwritten.

    If all this is true, then for a dual-boot off the same HD, all one needs to do is reset the active partition to the SuSE one after a Windows repair/reinstall.

    But for a dual boot off different HDs where the Windows HD is the first boot device, one must reinstall the grub bootloader. This makes this configuration a pest and I think it should be avoided. The better approach is to make the SuSE HD the first boot device, have the GRUB bootloader on the SuSE HD and not touch the Windows HD at all.
    OS: Linux 2.6.27.29-0.1-default x86_64
    System: openSUSE 11.1 (x86_64)
    KDE: 4.1.3 (KDE 4.1.3) "release 4.10.4"

Page 1 of 3 123 LastLast

Posting Permissions

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