• Re-install Grub2 from DVD Rescue

    Boot the Rescue from the DVD. This should be the same Arch as the installation: ie; 32 bit or 64 bit..


    Once the DVD rescue gets to 'login', type: root
    from there I run fdisk -l to confirm my HD partitition order.
    We need to mount root (for me that's sda3)

    Now mount / (sda3) with:
    Code: [View]
    mount /dev/sda3 /mnt
    To mount the other devices
    Next do:
    Code: [View]
    mount --bind /dev /mnt/dev
    Then chroot:
    Code: [View]
    chroot /mnt
    Code: [View]
    mount /proc
    Code: [View]
    mount /sys
    Your prompt changes to: Rescue:/>
    Here type:
    Code: [View]
    grub2-mkconfig -o /boot/grub2/grub.cfg
    Code: [View]
    grub2-install /dev/sda
    You can see it all here: https://dl.dropbox.com/u/10573557/Gr...ect/rescue.jpg

    'exit'
    # reboot

    If you use LVM please check this post: https://forums.opensuse.org/vbcms-comments/478290-article-re-install-grub2-dvd-rescue-3.html#post2519005

    N.B: This method should also work from a live cd
    This should be the same Arch as the installation: ie; 32 bit or 64 bit..USE LIVE CD TO RESCUE
    Comments 83 Comments
    1. caf4926's Avatar
      caf4926 -
      Quote Originally Posted by HRGargi View Post
      Same for me! I just tried it on a VM in case of a real breakdown of my bootloader. These steps are working without any problems. Thanks for that article!
      Great.
    1. pier_andreit's Avatar
      pier_andreit -
      Thank you verymuch, on my opensuse 12.2 with boot failure it worked like a charm:-)))
    1. caf4926's Avatar
      caf4926 -
      Quote Originally Posted by pier_andreit View Post
      Thank you verymuch, on my opensuse 12.2 with boot failure it worked like a charm:-)))
      Pleased to hear it
    1. MikeTm's Avatar
      MikeTm -
      In my case, after the grub2-install /dev/sda command, it just says
      bash: grub2-install: command not found

      All commands preceding the grub2-install result in the same way as caf4926 has described. Up to this step everything resembles the jpeg caf4926 published on dropbox, apart from the order of my partitions of course.
      Just the last step is different in my case.

      I split my openSuSE installation like this:
      My root-partition in on sdb6
      opt on sdb7
      usr sdb8
      var sdb9
      home sdb10

      After mounting sdb6 with chroot, I can change to directories boot, grub2, and bin. Therefore I feel certain, that sdb6 is the correct partition to mount.

      Has anyone a hint as to the solution in my case, please?
      mike
    1. caf4926's Avatar
      caf4926 -
      Quote Originally Posted by MikeTm View Post
      In my case, after the grub2-install /dev/sda command, it just says
      bash: grub2-install: command not found

      All commands preceding the grub2-install result in the same way as caf4926 has described. Up to this step everything resembles the jpeg caf4926 published on dropbox, apart from the order of my partitions of course.
      Just the last step is different in my case.

      I split my openSuSE installation like this:
      My root-partition in on sdb6
      opt on sdb7
      usr sdb8
      var sdb9
      home sdb10

      After mounting sdb6 with chroot, I can change to directories boot, grub2, and bin. Therefore I feel certain, that sdb6 is the correct partition to mount.

      Has anyone a hint as to the solution in my case, please?
      mike
      Are you using 12.2
      If yes, was it a clean install or upgrade
      An upgrade would mean you probably have grub legacy
    1. MikeTm's Avatar
      MikeTm -
      Quote Originally Posted by caf4926 View Post
      Are you using 12.2
      If yes, was it a clean install or upgrade
      An upgrade would mean you probably have grub legacy
      Thanks for answering that soon.

      I made a clean install of 12.2 about 3 weeks ago, and as a result the dual boot of Win XP (on sda) and openSuSE 12.2 (on sdb) worked fine. At boot-up during these 3 weeks, it said something like 'Welcome to grub 2'.

      mike
    1. caf4926's Avatar
      caf4926 -
      This is very odd

      I split my openSuSE installation like this:
      My root-partition in on sdb6
      opt on sdb7
      usr sdb8
      var sdb9

      home sdb10
    1. eheman's Avatar
      eheman -
      Like some others that have commented, yesterday my OpenSuSE 12.2 system displayed the "GRUB_" text prompt on a black screen after having installed a grub2-related patch. This article was very useful, but lacked an important step that I had to figure out and add for my dual-boot and LVM based setup.

      My partition and LVM setup is:
      Code:
         Device Boot      Start         End      Blocks   Id  System
      /dev/sda1          206848   314572799   157182976    7  HPFS/NTFS/exFAT
      /dev/sda2   *   314572800  3906228223  1795827712    f  W95 Ext'd (LBA)
      /dev/sda5       314574848   314890239      157696   83  Linux
      /dev/sda6       314892288   315291647      199680   83  Linux
      /dev/sda7       315293696  3901593599  1793149952   8e  Linux LVM

      /dev/sda1 is a windows 7 system
      /dev/sda2 is an extended partition where grub2 resides (the bootable partition).
      /dev/sda5 is the small /boot partition for the opensuse 12.2 x86_64 system
      /dev/sda6 is empty (for some planned future use)
      /dev/sda7 is an LVM volume group partition

      The root, swap, and home mounts are defined as LVM logical volumes, not partitions for my OpenSuse 12.2 system..

      I had to modify the steps in the original post in the article to accommodate the logical volume use. After booting the rescue system from the install DVD and logging in as root, the steps for me were:

      Activate the LVM volume group

      Code:
      vgchange -ay <my.volume.group.name>

      Mount my root logical volume at /mnt

      Code:
      mount /dev/mapper/<my.volume.group.name>-<my.root.logical.volume.name>  /mnt
      Mount the /boot partition under /mnt. Failure to to do this step yields a failure in the grub2 install step if it is omitted.
      Code:
      mount /dev/sda5 /mnt/boot
      Now mount the other devices

      Code:
      mount --bind /dev /mnt/dev
      Then chroot
      Code:
      chroot /mnt

      Your prompt changes to: Rescue:/>
      Here type:
      Code:
      grub2-install  /dev/sda
      After these steps, I was able to reboot successfully. Hope this helps someone that uses LVM extensively like I do.
    1. amarildojr's Avatar
      amarildojr -
      I can't give the command "mount -- bind /dev /mnt/dev" it says file or directory does not exist. I'm stuck with that
    1. caf4926's Avatar
      caf4926 -
      Quote Originally Posted by amarildojr View Post
      I can't give the command "mount -- bind /dev /mnt/dev" it says file or directory does not exist. I'm stuck with that
      I don't know how literal or exact your comment is but typologically it is incorrect

      you quote
      Code:
      mount -- bind /dev /mnt/dev
      where it is actually
      Code:
      mount --bind /dev /mnt/dev
      The error in your code is at the space you added between -- and bind
    1. amarildojr's Avatar
      amarildojr -
      I typed wrong here. I'll give what you said on my thread a try.
    1. ranr01's Avatar
      ranr01 -
      Quote Originally Posted by eheman View Post
      After these steps, I was able to reboot successfully. Hope this helps someone that uses LVM extensively like I do.
      I had a slightly different problem.
      I could not boot and got the following error:
      Code:
      VFS: can not open root device "mapper/system-root" ...
      followed by a kernel panic...

      To solve this I followed your suggestions above but needed to add:
      Code:
      mkinitrd
      before the
      Code:
      grub2-install /dev/sda
      command.

      The mkinitrd command gave a few warnings (I guess that to do it right one needs to actually log into the system with a rescue disk or something) however it still worked and I have my beloved computer back...

      Thanks everyone (especially eheman and caf4926) for posting all the info. Took me only one and a half hours (It usually take all night :-) )
    1. dmera's Avatar
      dmera -
      I'm having I think a similar issue that eheman encountered and I would like to get some details which are not clear to me.
      I tried to install 12.2 gnome 64 bit and got to the GRUB screen and the server has a physical LVM.
      Booted via LiveCD and trying to understand what to fill for these values(please ignore start/end and Blocks values as they are not correct just a copy/paste):
      Code:
         Device Boot      Start         End      Blocks   Id  System 
      /dev/sdb1          206848   314572799   157182976   de  Dell Utility 
      /dev/sdb2       314572800  3906228223  1795827712   8e  Linux LVM 
      /dev/sdb3    *      33333     3333333     3333333    f  W95 Ext'd (LBA)      
      /dev/sdb5       314574848   314890239      157696   83  Linux swap / Solaris 
      /dev/sdb6       314892288   315291647      199680   83  Linux 
      /dev/sdb7       315293696  3901593599  1793149952   8e  Linux
      after reading the man for vgchange and try to get more info about my system
      #vgchange -ay
      /dev/sda : open failed:No medium found
      No volume groups found

      I don't know why is looking in sda instead of sdb?

      then I'm not sure what is my.volume.group.name in this command:

      vgchange -ay <my.volume.group.name>
      in this directory(/dev/mapper/) i have only one file <control>

      mount /dev/mapper/<my.volume.group.name>-<my.root.logical.volume.name> /mnt
      should i use that? Sorry but i have a basic understanding of how things are working and I need help/guidance. Thank you.
      I noticed after posting that this is not in the forum and is just an article. Still the clarifications would still be required for the article to be more informative I think. If you think it is not the place for my clarification then please remove my posting and excuse my intrusion.
    1. nrickert's Avatar
      nrickert -
      Quote Originally Posted by dmera View Post
      #vgchange -ay
      /dev/sda : open failed:No medium found
      No volume groups found
      I have not tried with two or more disks.

      I usually do:
      Code:
      # vgscan
      which tells me the name of the volume group. I follow that with
      Code:
      vgchange -a y volume-group-name
      where the volume-group-name used is what was found from the prior command.
    1. rhinka's Avatar
      rhinka -
      Hi,

      i have problems with GRUB i.e. cannot boot after regular update of Opensuse 12.3. and dual boot system. However the command vgscan returns: No volume groups found. The command fdisk -| from the article https://forums.opensuse.org/content/...vd-rescue.html returns only > symbol. So I don't really know how to proceed.
    1. caf4926's Avatar
      caf4926 -
      Quote Originally Posted by rhinka View Post
      Hi,

      i have problems with GRUB i.e. cannot boot after regular update of Opensuse 12.3. and dual boot system. However the command vgscan returns: No volume groups found. The command fdisk -| from the article https://forums.opensuse.org/content/...vd-rescue.html returns only > symbol. So I don't really know how to proceed.
      It's

      fdisk -l

      That's a space after fdisk then a - and a letter L lower case
    1. rhinka's Avatar
      rhinka -
      Hi,

      sorry, I did not read the command correctly.

      Could you please look at my disk system and advise me how to proceed with with grub2 installation?



      https://www.dropbox.com/s/47vl0llwfh1dcdf/DSC00937.JPG
    1. caf4926's Avatar
      caf4926 -
      Quote Originally Posted by rhinka View Post
      Hi,

      sorry, I did not read the command correctly.

      Could you please look at my disk system and advise me how to proceed with with grub2 installation?



      https://www.dropbox.com/s/47vl0llwfh1dcdf/DSC00937.JPG
      I'll have to look at this later
      Unless some else helps in the mean time...
      sorry
    1. rhinka's Avatar
      rhinka -
      Hi,

      I mounted sda7 instead of sda3 and I works.
      Thanks for your support!
    1. Dexter1979's Avatar
      Dexter1979 -
      Nice article, Carl. Would it be worth while mentioning that the live-cd needs to be of the same architecture as the system you are trying to take over with Chroot? I.e. if you are taking over a 64bit system you need to use a 64bit live-cd or you will get this or similar error when using chroot:

      Code:
      chroot: cannot run command '/bin/bash': Exec format error