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

Thread: Howto: Easy GRUB Bootloader Repair without external media

  1. #1
    Join Date
    Mar 2006
    Location
    Palo Alto, CA
    Beans
    1,226
    Distro
    Ubuntu 12.04 Precise Pangolin

    Howto: Easy GRUB Bootloader Repair without external media

    Purpose

    Let's say you've just reinstalled Windows, and are up and running fine, only you can't boot your Ubuntu install anymore because Windows has wiped out GRUB, the bootloader needed to boot Ubuntu. If you're a seasoned Linux guru, you'll instantly whip out your collection of recovery disks and hammer out a few commands to restore GRUB; however, if you're simply an average user who hasn't memorized the commands required to restore GRUB, don't have the necessary liveCDs or can't boot them, or simply want to avoid the command line, this guide will help you easily restore GRUB.

    Requirements

    A bootable Windows install; any version from 98 to Vista will work.
    Note: An existing install of a modern Linux distro (Ubuntu, Fedora, etc) will also work (same instructions, just use the deb/rpm/sh package on the download page), though this guide focuses on Windows.

    What this Does (technical details)

    When you run the .exe file, it modifies your Windows bootloader to provide an option to load GRLDR from GRUB4DOS. GRLDR, in turn, loads a floppy image containing the Super Grub Disk bootloader repair utility via Memdisk. This way, it loads the floppy image into RAM and boots from it, allowing you to start up the GRUB recovery tool and repair/restore your GRUB install. Afterwards, upon the next Windows bootup, the utility uninstalls itself and removes the extra menu entry for loading the Super Grub Disk image from Windows, thus leaving you with only a standard dual-boot GRUB configuration between Windows and Ubuntu.

    Instructions

    1. Download the latest Windows (.exe) version of UNetbootin

    2. Run the .exe file, select "Super Grub Disk" in the distribution selector box and press OK, wait as Super Grub Disk is downloaded and installed, then reboot:



    3. Upon the next bootup, you'll see 2 boot menu entries: One for Windows, and below it, one labeled UNetbootin-supergrubdisk.



    Select the UNetbootin-supergrubdisk boot option, press enter, and it will present you with the Super Grub Disk interface.

    4. Select the default options ("Super Grub Disk with Help" and "English Super Grub Disk") on the first 2 prompts, press enter a few times after that to accept the license terms and see the instructions, then you'll get to a page titled "English Super Grub Disk (Help)":



    Select the first option, "GNU/Linux".
    Press enter a few times again to scroll through the instructions, and you'll see a menu titled "GNU/Linux (Help)":



    Select the first option, "Fix Boot of GNU/Linux (GRUB)". Now it will ask you to specify which Ubuntu install's GRUB bootloader to restore. Given that you likely only have 1 install, select the first among the options; it should have an entry under "OS" titled either "Boot" or "Ubuntu":



    5. Now, you'll be presented with a success screen, and can now reboot. Do so, and upon the next reboot, the GRUB menu should now show up and you should again be able to dual-boot between Windows and Ubuntu.

    However, the next time you boot Windows, should you want to remove the second menu entry generated by UNetbootin for loading the Super Grub Disk, simply select yes when prompted "Are you sure you want to remove UNetbootin?" after logging in to remove UNetbootin, and that'll undo the Windows bootloader changes so you're left with only GRUB and a standard dual-boot setup.

    Credits/More

    The Super Grub Disk can also be used for various other purposes; for a description of its more advanced options and functionality see the documentation on the site. UNetbootin, which also supports liveUSB creation and no-CD installations of Ubuntu and various other distros, was created by me, the other tools used (Super Grub Disk, GRUB4DOS, Memdisk) were created by their respective authors. Feel free to post a question if you have issues with the loader (UNetbootin) itself, but if it's a general Super Grub Disk bug, make sure to report it on the Super Grub Disk site.
    Attached Images Attached Images
    • File Type: png 3.png (7.0 KB, 1560 views)
    • File Type: png 4.png (7.3 KB, 1523 views)
    • File Type: png 5.png (6.6 KB, 1519 views)
    • File Type: png 1.png (20.9 KB, 1529 views)
    • File Type: png 2.png (3.4 KB, 1513 views)
    Last edited by tuxcantfly; June 29th, 2008 at 08:09 AM.

  2. #2
    Join Date
    Jan 2006
    Location
    Iberian Peninsula
    Beans
    354

    Re: Howto: Easy GRUB Bootloader Repair without external media

    First of all thank you TuxCantFly for this tool I have written a piece of news on my site about it.

    I also want to say that memdisk in order to load the super grub disk floppy (or another floppy) uses an special BIOS interruption.

    There are some BIOS that do not support this interruption (like the qemu BIOS) so this method will not work always.

    Finally, this is optional, you can make your howto smaller if you say to select:
    Code:
    GRUB => MBR & !LINUX! (1)         AUTO     ;-)))
    if you have only one linux
    This option fixes GRUB without asking anything.
    or
    Code:
    GRUB => MBR & !LINUX! (>2)      MANUAL      |8-)
    if you have more than one linux.
    This option is equivalent to SGD(With Help)->Linux ->Fix Boot of Linux

    Thank you again TuxCantFly.

    adrian15

  3. #3
    Join Date
    Jan 2006
    Location
    Iberian Peninsula
    Beans
    354

    Re: Howto: Easy GRUB Bootloader Repair without external media

    Quote Originally Posted by tuxcantfly View Post
    What this Does (technical details)

    When you run the .exe file, it modifies your Windows bootloader to provide an option to load GRLDR from GRUB4DOS. GRLDR, in turn, loads a floppy image containing the Super Grub Disk bootloader repair utility via Memdisk. This way, it loads the floppy image into RAM and boots from it, allowing you to start up the GRUB recovery tool and repair/restore your GRUB install. Afterwards, upon the next Windows bootup, the utility uninstalls itself and removes the extra menu entry for loading the Super Grub Disk image from Windows, thus leaving you with only a standard dual-boot GRUB configuration between Windows and Ubuntu.
    I download the unetbootin-supergrubdisk exe, save it to my pendrive and I run it in a computer that does not have an internet connection. Will it work?

    Or if you prefer... does unetbootin-SuperGrubDisk need internet connection in order to download the super grub disk floppy image or not?

    I've readLinux.com unebootin article and I have this doubt.

    Thank you.

    adrian15

  4. #4
    Join Date
    Mar 2006
    Location
    Palo Alto, CA
    Beans
    1,226
    Distro
    Ubuntu 12.04 Precise Pangolin

    Re: Howto: Easy GRUB Bootloader Repair without external media

    Quote Originally Posted by adrian15 View Post
    I download the unetbootin-supergrubdisk exe, save it to my pendrive and I run it in a computer that does not have an internet connection. Will it work?

    Or if you prefer... does unetbootin-SuperGrubDisk need internet connection in order to download the super grub disk floppy image or not?

    I've readLinux.com unebootin article and I have this doubt.

    Thank you.

    adrian15
    No, this version doesn't need an internet connection to install; the initrd/kernel (floppy image and memdisk) is bundled in. So yes, it'll work fine without an internet connection.

    Finally, this is optional, you can make your howto smaller if you say to select:
    Code:
    GRUB => MBR & !LINUX! (1)         AUTO     ;-)))
    if you have only one linux
    This option fixes GRUB without asking anything.
    or
    Code:
    GRUB => MBR & !LINUX! (>2)      MANUAL      |8-)
    if you have more than one linux.
    True, though the current howto's screenshots also expose the option to boot directly into Ubuntu first, which some may prefer (so that the official grub-install from Ubuntu is used rather than SGD's grub-install), so I'll leave it as is.
    Last edited by tuxcantfly; February 25th, 2008 at 07:41 AM.

  5. #5
    Join Date
    Sep 2006
    Beans
    39

    Re: Howto: Easy GRUB Bootloader Repair without external media

    tuxcantfly,

    for sure you're aware of easyBCD package of NeoSmart Tech. Basically it is a boot manager that's installed on the vista partition and configures a boot menu that allows booting of vista, xp and ubuntu in my case, via vista BCD.

    I installed it some time back and it's doing what it says. However, at that time there was ONLY gutsy installed on a logical (/ on sda6 and swap on sda7) with grub on sda6. It picked up the bootsector and configured BCD with a new entry on the boot menu called Neo Linux. After just to make sure, I copied the PBR to a file with dd.

    The other day I installed hardy beta to sda8 (/) and /home to sda9. And as usual, I've asked ubuntu to install grub to sda8. But..., after reboot Vista would not boot at all. I had to use vista dvd and the command prompt to recover. For some reason MBR was corrupted which did not happen with the gutsy install. Checking further, I said, fully knowing that in this case there is no more PBR, give it a try and copy with dd the PBR on sda8; indeed the file was 0 bytes no 512.

    My question is, is there a way to get sda8 PBR recovered somehow? and then get it on file with dd under gutsy? this file is mandatory in order to configure BCD with bcdedit in vista and create a new boot option besides the 3 existing ones.

    any help appreciated.
    regards,
    peter b

  6. #6
    Join Date
    Mar 2006
    Location
    Palo Alto, CA
    Beans
    1,226
    Distro
    Ubuntu 12.04 Precise Pangolin

    Re: Howto: Easy GRUB Bootloader Repair without external media

    Quote Originally Posted by peter b View Post
    tuxcantfly,

    for sure you're aware of easyBCD package of NeoSmart Tech. Basically it is a boot manager that's installed on the vista partition and configures a boot menu that allows booting of vista, xp and ubuntu in my case, via vista BCD.

    I installed it some time back and it's doing what it says. However, at that time there was ONLY gutsy installed on a logical (/ on sda6 and swap on sda7) with grub on sda6. It picked up the bootsector and configured BCD with a new entry on the boot menu called Neo Linux. After just to make sure, I copied the PBR to a file with dd.

    The other day I installed hardy beta to sda8 (/) and /home to sda9. And as usual, I've asked ubuntu to install grub to sda8. But..., after reboot Vista would not boot at all. I had to use vista dvd and the command prompt to recover. For some reason MBR was corrupted which did not happen with the gutsy install. Checking further, I said, fully knowing that in this case there is no more PBR, give it a try and copy with dd the PBR on sda8; indeed the file was 0 bytes no 512.

    My question is, is there a way to get sda8 PBR recovered somehow? and then get it on file with dd under gutsy? this file is mandatory in order to configure BCD with bcdedit in vista and create a new boot option besides the 3 existing ones.

    any help appreciated.
    regards,
    peter b
    Boot Gutsy, mount /dev/sda8 somewhere (ex: /media/sda8 ), then run the command:

    Code:
    sudo grub-install /dev/sda8 --root-directory=/media/sda8
    Hopefully that'll install GRUB onto the Hardy partition, thereby allowing you to chainload it via Vista's bootloader.

  7. #7
    Join Date
    Sep 2006
    Beans
    39

    Re: Howto: Easy GRUB Bootloader Repair without external media

    thank you tuxcantfly, I appreciate.

    now, I used the hardy alternate CD and the rescue option --> i got the root shell of sda8 and with

    grub-install /dev/sda8

    I got an output of success --> so at this time I assume that sda8 has the PBR (I did not try copying it yet). Please be so kind and check dd command below that I intend to use via same root shell provided by the rescue option of hardy alternate CD to get the PBR to a file called hardypbr.bin in /media folder of sda8

    dd if=/dev/sda8 of=/media/hardypbr.bin bs=512 count=1

    the only thing I'm not sure is whether /media was mounted so hardypbr.bin can be copied to it or this command

    dd if-/dev/sda9 of=mnt/sda6/home/peter/hardypbr.bin bs-512 count=1

    to get it copied to gutsy /home/peter.

    what's your opinion please?

    tu, peter b

  8. #8
    Join Date
    Sep 2006
    Beans
    39

    Re: Howto: Easy GRUB Bootloader Repair without external media

    sorry for typos

    dd if-/dev/sda9 of=mnt/sda6/home/peter/hardypbr.bin bs-512 count=1

    should be

    dd if=/dev/sda8 of=/mnt/sda6/home/peter/hardypbr.bin bs=512 count=1

    sarry again.

    peter b

  9. #9
    Join Date
    Sep 2006
    Beans
    39

    Re: Howto: Easy GRUB Bootloader Repair without external media

    tuxcantfly,

    all is OK, file created with the first dd command in /media and already copied to C:\ vista for BCDEDIT edit and creation of new boot entry.

    thanks a lot.

    peter b

  10. #10
    Join Date
    Jan 2006
    Location
    Iberian Peninsula
    Beans
    354

    Re: Howto: Easy GRUB Bootloader Repair without external media

    Quote Originally Posted by peter b View Post
    My question is, is there a way to get sda8 PBR recovered somehow? and then get it on file with dd under gutsy?
    If you want to use Super Grub Disk. You can use Super Grub Disk version 0.9701 or later. Super Grub Disk (with Help) -> Windows -> Windows boots grub!.

    This is the equivalent of grub-install /dev/whatever.

    It even works if the linux is found on a second hard disk (usually with normal grub you cannot chainload grub from windows' boot.ini (or vista boot file) if Linux is on second hard disk).

    adrian15

Page 1 of 3 123 LastLast

Bookmarks

Posting Permissions

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