Wizard – Restore Grub with Super Grub2 Disk

Wizards that link to this one

Wizard – Restore Grub

Introduction

This wizard explains step by step how to restore Grub to your machine thanks to Super Grub2 Disk and some extra commands in the command line. You can find more information about what problems you can solve with this wizard and what you get after performing the Wizard steps at: Wizard – Restore Grub .

Wizard steps to perform

Download Super Grub2 Disk

Put Super Grub2 Disk into a media

Boot from media

Super Grub2 Disk – Press return at boot

Booting with CDROM or with USB built with dd

When you boot in Super Grub2 Disk you will get into Super Grub2 Disk menu without the need of doing anything.

Booting USB thanks to YUMI

When you boot thanks to YUMI by default is going to boot into your first hard disk.

YUMI Boot - YUMI boots by default into first hard disk screenshot

You have to select GRUB Bootable ISOs or Windows XP by using down arrow key and then return key.

YUMI Boot - GRUB Bootable ISOs or Windows XP selected screenshot
YUMI Boot – GRUB Bootable ISOs or Windows XP selected

Then you get into GRUB Bootable ISOs or Windows XP screen.

YUMI Boot - Linux Distributions screen screenshot

Use again the down arrow key and then return key to select Super Grub2 Disk entry.

YUMI Boot - Linux Distributions screen - Rescatux selected screenshot

Finally you get into Super Grub2 Disk screen.

Super Grub2 Disk main screen screenshot
Super Grub2 Disk main screen

Detect any Operating System

Select Detect any Operating System option.

Super Grub2 Disk main screen screenshot
Super Grub2 Disk main screen

Select the OS you want to boot

Among the different Operating system and kernels select the one that identifies your system.

Super Grub2 Disk - Detect any Operating System - Linux kernels detected screenshot
Super Grub2 Disk – Detect any Operating System – Linux kernels detected

Find out what your hard disk and root partition devices are

From your installed system you need to run either:

sudo fdisk -lu

(where you will have to write your user password blindly) as a admin user or:

fdisk -lu

as root user from a terminal.

A possible output might be:

Disco /dev/sda: 21.5 GB, 21474836480 bytes
255 cabezas, 63 sectores/pista, 2610 cilindros, 41943040 sectores en total
Unidades = sectores de 1 * 512 = 512 bytes
Tamaño de sector (lógico / físico): 512 bytes / 512 bytes
Tamaño E/S (mínimo/óptimo): 512 bytes / 512 bytes
Identificador del disco: 0x000221dd
Dispositivo Inicio Comienzo Fin Bloques Id Sistema
/dev/sda1 * 2048 41940991 20969472 83 Linux

In most of the cases you will see that you have a Linux system partition sda5, sda4, or whatever sdaX. That means that your hard disk (as it’s seen above) it’s sda.

In any case we recommend to check hard disk size next to Disk /dev/sdX at the output’s beginning so that you make sure that you select the exact hard disk that boots initially in your machine.

Restore grub

Now we are going to install grub back to the MBR, which it is what most people to do.

In the next command you will need to replace sda with your hard disk.

Either you run:

sudo grub-install /dev/sda

(where you might have to write your user password blindly or not) as a admin user or:

grub-install /dev/sda

as root user from a terminal.

The most probable output for the command is:

Installation finished. No error reported.

That means that the installation was successful. When you reboot Grub menu should be alive again.

Update Grub configuration

Although strictly not needed is a good idea at this point to re-create the Grub configuration files. Either because you have added a Windows partition or because your Gnu/Linux partition is in a different partition (That latter case usually needs /etc/fstab to be edited too but that would be another howto.).

There are different ways of updating Grub configuration depending on you using Grub legacy, current Grub (Grub2), Debian based distributions, Fedora based distributions or custom distributions. We will try to cover most of the options. We will start just by the ones we think are the most common ones.

As I said this before this step is strictly not needed so you can skip it. Just go back to this step if after Restoring grub step (and rebooting) you see your former grub but somehow your Grub menu does not work as expected. You know, Gnu/Linux or Windows is not booting as it always happened.

Another alternative is using Rescatux which has an Update Grub option which tries to take care of all the possible situations.

If your distribution does not use sudo please run the command without the initial sudo and as a root user.

Debian or Ubuntu based systems

sudo update-grub

Fedora Grub2 based systems

sudo grub2-mkconfig -o /boot/grub2/grub.cfg

Most Grub2 based systems including Debian based ones

sudo grub-mkconfig -o /boot/grub/grub.cfg

SuSE Grub1 based systems

Although there are some unofficial scripts for this task the official way of changing them is:

  • Yast
  • System
  • Bootloader

24 thoughts on “Wizard – Restore Grub with Super Grub2 Disk

    1. No, it does NOT erase any of the files from your hard disk.

      When you boot Super Grub2 Disk it works with the disk as read-only.
      Then you boot whatever OS you want to and the OS will decide what to do with the hard disk.

      The only erase might happen when you put the Super Grub2 Disk into a usb thanks to dd command instead of the suggested Yumi steps in this page. But that’s not a problem from Super Grub2 Disk but from how you make your Super Grub2 Disk usbs.

  1. Hello everyone, many thanks to the guys on here that have posted the grub-install /dev/sda — i have just rescued my system from the brink of hell and am back up and running in linux mint 🙂 – you don’t get that with Windows or microshaft groups… Linux rules!!! 🙂 🙂 🙂

  2. Hi there, I have thre partitions
    Device Boot Start End Sectors Size Id Type
    /dev/sda1 * 2048 102402040 102399993 48,8G 7 HPFS/NTFS/exFAT
    /dev/sda2 102402048 616959999 514557952 245,4G 83 Linux
    /dev/sda3 616960000 625141743 8181744 3,9G 82 Linux swap / Solaris

    As you can see the windows partition is marked as bootable, eventhough I could make my linux start again I can not get windows to work back, I mean, nor SuperGrub nor the native grub see Windows… What can I do…

    Tnx

    1. I have restarted with SG2 and listed the partitions, at the ntfs partition, the bootable one it says “None Operating System Detected”…… What can I do to recover it, anyway all the files are in there, I’ve lost nothing…

  3. Hi, I would like to re-install GRUB (legacy, which means “not GRUB2”) not on MBR but on root directory (/) of /dev/sda3 . Migration from UBUNTU 10.04 LTS to 14.04 LTS lead UBUNTU to override my GRUB configuration. I have EFI en /dev/sda1, Mac OS X on /dev/sda2, BLAG14000 Spartakus on /dev/sda3 with Grub 0.98 , UBUNTU 14.04 LTS with GRUB2, and then UBUNTU 10.04 en /dev/sda6. For this multiboot config, I’ve always forced GRUB installation on each of partition (root directory) rather than letting the standard installation to install GRUB on MBR. But since the installation of UB 14.04, everything has changed, and using the rEFIT menu after MacBookPro startup phase , I’ve no other choice than launching GRUB2, which brokes the independance of each partition in terms of booting. Moreover, since yesterday, I’ve got GRUB rescue prompt, thus no access to booting whatever Linux distrib I have on the hard disk ! Any tip related to SuperGrub top overcome this situation ? yours sincerely. Eric

  4. Thank you so much guys, you really saved my bacon. ‘Super Grub 2’ fixed in 2 minutes while I spent the last 24hrs. trying to get my SuSE back . Superb. M. N.

  5. grub-install: error: /usr/lib/grub/i386-pc/modinfo.sh doesn’t exist. Please specify –target or –directory.

  6. Great wizard! Just fixed my windows 7 pro system with 3 HDD’s and many partitions. Had a 7pro and ubuntu dualboot, then wiped windows partition by accident one morning. Reinstalled windows 7 pro ok on 128G SSD , but system lost grub and ubuntu install. Just installed mint 17.2 on the 500GB HDD and used your wizard to restore GRUB!! Much thanks! Dont worry about the grub-install /dev/sda command, it wont erase your windows MBR, it just fixes the GRUB bootloader! YAY! HORAY! SUpergrubdisk2!

    1. Technically grub-install /dev/sda does erase your windows MBR. However it keeps the windows boot from a partition in most of the cases (That means 99,99999999%).

  7. What about restoring Grub2 from Grub2?

    Think on this very special case: have no Linux installed on the HDD, but use Grub2 as bootloader.

    I know how to install / repait Grub2 from SystemRescueCD, but that does not help when multi-luks, since version of Grun is 2.02~beta2 not 2.02~beta3

    Problem: the Grub that installs is not the correct version.

    I tried to boot with SuperGrub2 CD (that has grub2 version 2.02~beta3), when i type commands: insmod luks and cryptomount -a it detects all luks and asks for each one password, mount them and i can access files on them.

    But with SystemRescuCd grub version (2.02~beta2) it only asks one password and only do half things, cryptomount -a does not let me access the files, but (crypto0) appears, among i can not do a ls on it.

    Seems like a bug on grub2 version 2.02~beta2, since cryptomount -a command must ask for all luks passwords and only ask for one of them, also more it does not really mount the filesystem so i an not access the files, and it only works once, after that if i try to run the command again it does nothing (i must reboot).

    So, how i upgrade Grub2 version using SuperGrub2 disk? i remember to had read somewhere that Grub2 can be installed on HDD from inside the Grub2 console (but i do not remember where).

    Other option would be use a real Linux LiveCD that cames with such version, but what one? most came with also lower versions, i tried more than 16GiB of downloads, none works and all come with Grub2 version lower than 2.02~beta3.

    It is very frustrating.

    P.D.: (when boot from HDD) I am booting Grub2 from a LUKS partition, and i am trying to chainload to another Grub2 on another partition; i have nothing else installed on HDD… testing under VirtualBOX to get knownledge of how to boot any Bootloader inside a LUKS partition and chainload from one to another (bootloaders only, not Linux distros) … to simplify, now i am not using LVM… i use ext4 over LUKS directly, i had also tested with ext4 under LVM under LUKS, same problem, cryptomount -a does not work well.

  8. Thanks for SuperGrub2 having grub2 version 2.02~beta3.

    It SOLVED: Chainload from Grub2 to Grub2 residing on a LUKS partition.

    I was getting mad because of using grub2 version 2.02~beta2 (it has a big bug on cryptodisk command).

    Finally i got a Grub2 chainload another Grub2 that is inside a LUKS encrypted partition, or better said: i can chainload from SuperGrub2 disk command line to a Grub2 that is inside a LUKS encrypted partition.

    Steps:

    1.-Boot with Super Grub 2 disk
    2.-On main menu, press ‘c’ key to go to console mode
    3.-Type theese commands (cryptomount asks for the password):
    insmod luks
    cryptomount (hd0,6)
    multiboot (crypto0)/grub/i386-pc/core.img
    boot
    4.-Grub2 inside LUKS starts and ask for password
    5.-Retype the pasword
    6.-Menu appear on screen

    Note: If i press ‘c’ on it and then i try such commands it does not work since such other Grub2 is version 2.02~beta2, after cryptomount command it does not mount correctly the LUKS, so it can not access (crypto0)/*

    Since i have no Live CD that has grub-install version 2.02~beta3 i can not test Grub2 version 2.02~beta3 on the HDD, but since Super Grub disk has it, i could test that i was doing things correctly (correct commands) and it is Grub version 2.02~beta2 the one that is not working well.

    Also more, i have seen that the command cryptomount -a do different things is run from Grub2 version 2.02~beta2 versus Grub2 version 2.02~beta3; on beta2 version it only asks for one LUKS passphrase while in beta3 it asks for all LUKS that it finds, on beta2 it does not mount the filesystem (after type correct passphrase) while on beta3 it mounts all the filesystems (crypto0), (crypot1) and so on.

    So again, thanks Super Grub Disk, one headage less for me!

    P.D.: Moderators, please do not delete this post, it can help a lot of people trying the same; or said in other words, trying to chainload from Grub2 to Linux Distro bootloader that has rootfs on a LUKS partition (i allways test with Grub2 to Grub2 prior to install a full distro, less time to do tests).

  9. I found a tricky way to install grub2 version 2.02~beta3 onto the HDD by using two CDs.

    Note: i386-pc version for now, i will try with x86_64-efi version in some days.

    Easy steps from scratch (done inside VirtualBOX):

    1.- Boot from SystemRescueCD (the one that can install grub2 version 2.02~beta2), but with cache all to ram (the disc need to be ejected on a future step).
    2.- Mount Grub2 partition onto /boot
    2.- Install grub2 version 2.02~beta2 on an Ext4 partition as normal with grub2-install.
    3.- Delete all files form /boot/grub/i386-pc/
    4.- Eject the CD (it can also be done before step 2)
    5.- Insert SuperGrub2 CD
    6.- Mount SuperGrub2 cd onto /mnt
    7.- Copy all files from /mnt/boot/grub/i386-pc/ to /boot/grub/i386-pc
    8.- Unmount the CD and Grub2 partition
    9.- Reboot

    And i see grub2 version 2.02~beta3 instead of grub2 version 2.02~beta2.

    P.D.: Now (when i have time) i must re-check cryptomount from the HDD, and then re-check crytomount from the cyphered hdd; in other words, re-check with and without having /boot partition encrypted by LUKS; just to ensure cryptomount failing it is not caused by a faulty boot procedure from inside a LUKS encrypted partition.

  10. Copy files on that way solves part, but not all.

    It solves:
    1.- It now show grub2 version 2.02~beta3 instead of grub2 version 2.02~beta2
    2.- When /boot is not encrypted it allow to access other Grub2 on LUKS encrypted partitions (chainload from non encrypted Grub2 to encrypted Grub2)

    But if /boot is encrypted, the cryptomount bug again appears; i think it is because the very first LUKS open (for /boot encrypted) is still done with code from grub2 version 2.02~beta2, since Grub2 bootloader (MBR and maybe something else) was installed using grub-install from a grub2 version 2.02~beta2.

    If /boot is not encrypted, these steps works perfect (from HDD having grub2 version 2.02~beta3 installed by the trick of copying files from SuperGrub2 CD) just typing on console mode):
    insmod luks
    cryptomount (hd0,6)
    multiboot (crypto0)/grub/i386-pc/core.img
    boot

    So i really need a way to really install grub2 version 2.02~beta3 directly by grub2-install, to be able to have 100% of HDD encrypted (remember such main Grub2 will reside on aUSB stick inside a LUKS encrypted partition and will chainload other Grub2 inside LUKS encrypted partitions that are on the HDD).

    Or said in another way, know how SuperGrub2 disc was done with grub2 version 2.02~beta3.

    Hope all theses tests helps others, and let move main distro to include grub2 version 2.02~beta3 on their LiveCDs.

    Final objetive (very very hard core and too much difficoult): i want to try to have an invisible Linux (need some mount tool that acts different depending on the pasphrase used to avoid triple passphrase… or investigate on USB keyfiles for LUKS), like TrueCrypt and VeraCrypt hidden OS… my idea is somehow like a linux booting from a loop device that uses a BIG file called dummy.dat that is inside a LUKS encrypted partition, and has a 100% encrypted inside it (two passphrase must be typed, and two cascade decryptions must be done… i am afraid of speed loose).. boot would go as this… if boot from HDD, passphrase is asked and a normal linux is booted, you can see such dummy.dat file but not what is inside it; but if boot from a usb stick, passphrase of usb is asked, then Grub2 loads, show menu, select to boot from hidden linux, then asks for passphrase to mount HDD, then mount the loop device dummy.dat file, chainload to that Linux, again re type passphrase of HDD, and after a while a third passphrase for mounting rootfs that is inside such dummy.dat … too much hard to boot and more to configure such kernel and initram (neither know if is it even possible)… all for being able to have main Linux hidden from anyone (so it can not reside on any partition, physical, lvm or Luks… since it must not be seen there is another linux there), it is a really paranoid solution… but first is first… chainload from a LUKS encrypted Grub2 to another LUKS encrypted Grub2.

  11. Debian 8 on sda5.
    GRUB disappeared after Win7 has been installed on sda1.
    Restored Grub with Super Grub2 Disk closely following the procedure prescribed above.
    Now I have a correctly looking GRUB menu with three options:
    Debian GNU/Linux
    Advanced options for Debian GNU/Linux
    Windows 7 (loader) (on dev/sda1)

    The first two options work correctly. The third one – Windows 7 – keeps re-booting the computer like Ctrl+Alt+Del and again displays GRUB menu.
    The set of commands, corresponding to the Windows 7 option reads as follows:
    ———————————-
    setparams ‘Windows 7 (loader) (on /dev/sda1)’
    insmod part_msdos
    insmod ntfs
    set root=’hd0,msdos1′
    if [ x$feature_platform_search_hint = xy ]; then
    search –no-floppy –fs-uuid –set=root –hint-bios=hd0,msdos1 –hint-efi=hd0,msdos1 –hint-baremetal=ahci0,ms\
    dos1 –hint’=hd0,msdos1′ 5E8429688429443D
    else
    search –no-floppy –fs-uuid –set=root 5E8429688429443D
    fi
    parttool ${root} hidden-
    chainloader +1
    ———————————————–
    Should I edit these commands or the problem is elsewhere?

Leave a Reply

Your email address will not be published. Required fields are marked *