Pls. help repair/restore grub in multiboot system

Discussion in 'all things UNIX' started by taytong888, Apr 3, 2010.

Thread Status:
Not open for further replies.
  1. taytong888

    taytong888 Registered Member

    Joined:
    Mar 26, 2006
    Posts:
    168
    Hi,

    I have a laptop with 250 GB SATA HD that has the following:

    Win7 Pro installed first with sda1=system reserved partition, sda2=C: drive, sda5=separate software application programs to differentiate from Windows' Program Files. Ubuntu 9.10 was installed next (sda6=common swap partition for all Linux distros, sda7=Ubuntu root, sda8=Ubuntu home). Then Opensuse 11.2 was installed with sda12=root and sda13=home. Finally FedoraCore11 was installed with sda9=boot, sda10=root and sda11=home. Ubuntu and Suse have grub loader in their own root partitions.

    Suse's grub menu controls all OS's. From this grub menu I can select Windows or any other Linuxes. Suse uses legacy grub because it was installed right after Ubuntu 9.10 which uses (legacy) grub.

    Here is opensuse's grub menu:

    # Modified by YaST2. Last modification on Wed Mar 31 11:49:28 EST 2010
    # THIS FILE WILL BE PARTIALLY OVERWRITTEN by perl-Bootloader
    # Configure custom boot parameters for updated kernels in /etc/sysconfig/bootloader

    default 1
    timeout 15
    ##YaST - generic_mbr
    gfxmenu (hd0,11)/boot/message
    ##YaST - activate

    ###Don't change this comment - YaST2 identifier: Original name: linux###
    title Debug -- openSUSE 11.2 - 2.6.31.12-0.2
    root (hd0,11)
    kernel /boot/vmlinuz-2.6.31.12-0.2-debug root=/dev/disk/by-id/ata-Hitachi_HTS543225L9A300_090707FB2D00LJCT6UGB-part12 resume=/dev/disk/by-id/ata-Hitachi_HTS543225L9A300_090707FB2D00LJCT6UGB-part6 splash=silent quiet showopts vga=0x317
    initrd /boot/initrd-2.6.31.12-0.2-debug

    ###Don't change this comment - YaST2 identifier: Original name: linux###
    title openSUSE 11.2 - 2.6.31.12-0.2
    root (hd0,11)
    kernel /boot/vmlinuz-2.6.31.12-0.2-default root=/dev/disk/by-id/ata-Hitachi_HTS543225L9A300_090707FB2D00LJCT6UGB-part12 resume=/dev/disk/by-id/ata-Hitachi_HTS543225L9A300_090707FB2D00LJCT6UGB-part6 splash=silent quiet showopts vga=0x317 acpi=off noapic
    initrd /boot/initrd-2.6.31.12-0.2-default

    ###Don't change this comment - YaST2 identifier: Original name: failsafe###
    title Failsafe -- openSUSE 11.2 - 2.6.31.12-0.2
    root (hd0,11)
    kernel /boot/vmlinuz-2.6.31.12-0.2-default root=/dev/disk/by-id/ata-Hitachi_HTS543225L9A300_090707FB2D00LJCT6UGB-part12 showopts apm=off noresume nosmp maxcpus=0 edd=off powersaved=off nohz=off highres=off processor.max_cstate=1 x11failsafe vga=0x317
    initrd /boot/initrd-2.6.31.12-0.2-default

    ###Don't change this comment - YaST2 identifier: Original name: Ubuntu 9.10, kernel 2.6.31-20-generic (/dev/sda7)###
    title Ubuntu 9.10, kernel 2.6.31-20-generic (/dev/sda7)
    rootnoverify (hd0,6)
    chainloader +1

    ###Don't change this comment - YaST2 identifier: Original name: windows 1###
    title Windows 7_Professional_32-bit
    rootnoverify (hd0,0)
    chainloader +1

    ###Don't change this comment - YaST2 identifier: Original name: windows 2###
    title windows 2
    rootnoverify (hd0,1)
    chainloader +1

    ###Add Fedora Core 11 to the GRUB menu###
    title Fedora Core 11 on /dev/sda10 (root partition sda10)
    configfile (hd0,:cool: /grub/grub.conf

    $fdisk -l gives:

    Device Boot Start End Blocks Id System
    /dev/sda1 1 13 102400 7 HPFS/NTFS
    Partition 1 does not end on cylinder boundary.
    /dev/sda2 13 3200 25600000 7 HPFS/NTFS
    /dev/sda3 * 3201 15332 97450290 5 Extended
    /dev/sda5 3201 6387 25599546 7 HPFS/NTFS
    /dev/sda6 6388 6514 1020096 82 Linux swap / Solaris
    /dev/sda7 6515 7534 8193118+ 83 Linux
    /dev/sda8 7535 8519 7911981 83 Linux
    /dev/sda9 11560 11582 184716 83 Linux
    /dev/sda10 11583 13390 14522728+ 83 Linux
    /dev/sda11 13391 15332 15599083+ 83 Linux
    /dev/sda12 8520 10057 12353953+ 83 Linux
    /dev/sda13 10058 11559 12064783+ 83 Linux

    My problem is that while trying to fix a problem upgrading Ubuntu 9.10 to 10.04 LTS beta1 which I eventually overcame, I misunderstood about grub and thought I would have to (re)install grub to Ubuntu because sudo gedit /etc/boot/grub/menu.lst gives a blank file (I found out much later this is because Ubuntu 10.10 uses grub2 which replaces grub's /etc/boot/grub/menu.lst with /etc/boot/grub/grub.cfg). Following a recent Ubuntuforums tutorial entitled"Grub/XP/Vista Boot Loader", I did the following commands to restore grub to Ubuntu:

    sudo mkdir /media/sda7

    sudo mount /dev/sda7 /media/sda7

    Install grub to /dev/sda as (hd0):

    sudo grub-install --root-directory=/media/sda7 /dev/sda

    Then I only saw Ubuntu's grub menu. In a panick, I tried to reverse the above in order to install grub back to opensuse (sda12) hoping to get back to the way it was before:

    sudo mkdir /media/sda12

    sudo umount /dev/sda7 /media/sda7

    sudo mount /dev/sda12 /media/sda12

    sudo grub-install --root-directory=/media/sda12 /dev/sda12

    Somehow I also messed up Windows' boot file and boot partition table. Now I am still trying to use Windows installation CD to repair Windows but it has taken several hours and am still waiting for screen response. I cannot boot into any Linux distro either.

    I would very much appreciate your help restoring grub so that I can boot into Windows and any Linux distros.
     
  2. Ocky

    Ocky Registered Member

    Joined:
    May 6, 2006
    Posts:
    2,713
    Location:
    George, S.Africa
    Suse uses grub legacy, so to install to sda12 isn't it ..... ?

    sudo grub
    find /boot/grub/stage1
    root (hd?,?)
    setup (hd0)
    quit
    sudo reboot


    sudo grub
    root (hd0,11)
    setup (hd0)
    quit
    sudo reboot
     
  3. taytong888

    taytong888 Registered Member

    Joined:
    Mar 26, 2006
    Posts:
    168
    Thanks for your reply. Yesterday my laptop took 8-10 hours+ to do a startup repair and even when I finally was able to boot into Win 7, I still have to do another system restore and clean up. Windows repair wiped out all my Linuxes so I have to do some partitioning and Linux re-installation!

    Is there a way to set up GRUB/GRUB2 for a multiboot system such that if one system crashes, e.g. either Windows or one Linux OS crashes, I can still boot into the remaining ones?

    Thanks in advance.
     
    Last edited: Apr 4, 2010
  4. Ocky

    Ocky Registered Member

    Joined:
    May 6, 2006
    Posts:
    2,713
    Location:
    George, S.Africa
    Last edited: Apr 4, 2010
  5. mack_guy911

    mack_guy911 Registered Member

    Joined:
    Mar 21, 2007
    Posts:
    2,677
    best way make your windows install 1st and from windows you can use easybcd tool

    2nd if you want to put grub 1st then put it separately what i did is i got 2 disk one from windows second for linux and from linux i make 1st drive of my fedora 1024 mb for boot (grub install) then / and then home all different and other linux with grub in their root so i my root go away i dont need to worry i still boot from grub others only my root wont work

    3rd please backup your menu.lst from grub you can check and add manually changes if anything happen

    and make a backup of your hardisk or clone from software like paragon or clonezilla it make you restore in 5-10 mins you get everyting till backup date dont need to install and tweak every thing in window make a backup atleast once in the month specially for windows at least it save you from lot of pain from installing everything
     
  6. taytong888

    taytong888 Registered Member

    Joined:
    Mar 26, 2006
    Posts:
    168
    Hi mack_guy911,

    Thanks for your reply.

    1. Did try using Easybcd v2beta1 which works with windoz 7 and ubuntu but didn't work well if opensuse was installed later but wants to control grub.

    2. Two hard disks would be ideal but that is for a desktop. I only have one hard disk in my laptop.

    3 & 4. Point taken.

    Thanks a lot.
     
  7. taytong888

    taytong888 Registered Member

    Joined:
    Mar 26, 2006
    Posts:
    168
    Hello Ocky,

    Thanks for giving me the 2 links. Will the procedure in Link#2 work with Grub2?

    Have a nice day!
     
  8. Ocky

    Ocky Registered Member

    Joined:
    May 6, 2006
    Posts:
    2,713
    Location:
    George, S.Africa
    I am not an expert , but I think you can just make chainloader entries for the other OS,s.
     
    Last edited: Apr 4, 2010
  9. mack_guy911

    mack_guy911 Registered Member

    Joined:
    Mar 21, 2007
    Posts:
    2,677
  10. mack_guy911

    mack_guy911 Registered Member

    Joined:
    Mar 21, 2007
    Posts:
    2,677
    sorry i didnt try easybcd v2 beta i use fedora grub i am not an expert but what i did was

    https://www.wilderssecurity.com/showthread.php?p=1645522#post1645522

    please check fedora forums link as well
     
  11. taytong888

    taytong888 Registered Member

    Joined:
    Mar 26, 2006
    Posts:
    168
    Hi again mack_guy911,

    Which open source software do you recommend that can do whole disk & partition image backup and restore on both Windows 7 and Linux operating systems? Can Paragon and Clonezilla do this on multiboot systems?

    Thanks for your help.
     
  12. mack_guy911

    mack_guy911 Registered Member

    Joined:
    Mar 21, 2007
    Posts:
    2,677
    Last edited: Apr 5, 2010
  13. mack_guy911

    mack_guy911 Registered Member

    Joined:
    Mar 21, 2007
    Posts:
    2,677
Thread Status:
Not open for further replies.
  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.