SuperGRUB2Disk

From Super Grub Disk Wiki
Jump to navigationJump to search

Purpose

The primary purpose of Super GRUB2 Disk is to help you boot into an OS whose bootloader is broken. Second, and almost as important, is to be a tool to learn more about GRUB2 and the booting process.

Difference between Super GRUB Disk and Super GRUB2 Disk

GRUB2 is a complete rewrite of GRUB, and Super GRUB2 Disk is a complete rewrite as well. As Super GRUB2 Disk uses GRUB2, the differences between GRUB Legacy and GRUB2 also apply to the different versions of Super GRUB Disk: http://www.gnu.org/software/grub/manual/html_node/Changes-from-GRUB-Legacy.html#Changes-from-GRUB-Legacy

Perhaps the most notable difference between Super GRUB Disk based on grub legacy and Super GRUB2 Disk is that Super GRUB2 Disk does not write to the disk at all, and so cannot rewrite the MBR. Super GRUB2 Disk can only be used to boot a broken system, it cannot fix it directly. Though once a system is booted, re-installing grub is usually just a matter of running "grub-install /dev/sda".

While there are some features of Super GRUB Disk based on GRUB legacy that will never be included in Super GRUB2 Disk, the opposite is also true. For instance, Super GRUB2 Disk supports booting OSX, loop booting from iso files, booting an OS from USB without USB support in the BIOS, and other features that are not possible with GRUB legacy.

Creating a Bootable Super GRUB2 Disk

To create a bootable Super GRUB2 Disk CD, simpy burn it as a disk image to a blank CD or DVD as you would any other bootable iso. Detailed instructions for burning an iso file in various operating systems can be found at https://help.ubuntu.com/community/BurningIsoHowto

The Super GRUB2 Disk image is a hybrid image and can also be dd'd directly to a drive to make a bootable drive. Using dd can be dangerous and I plan to make installation to a flash drive easier so I will not document the details here currently.

The image can also be used as a bootable floppy image.

Menu / Features

When Super GRUB2 Disk boots it will present a menu like this:

SG2D 1.98s1 main menu.png

Each option in this menu is explained below.

Detect any OS

This option will search all partitions on all drives for operating systems, and create a menu to choose among the OSs it finds. If you would like to look at or correct a menu entry you can press 'e' to edit the menu entry and ctrl+x to execute your edited entry. Currently supported OSs are GNU/Linux (though support for separate /boot partitions has not yet been implemented), FreeBSD, Mac OSX/Darwin, and all versions of Microsoft Windows.

Detect any GRUB2 configuration file (grub.cfg)

This option will search all partitions for a grub.cfg file and create a menu to choose among the grub.cfg files that it finds, this can be useful if your GRUB2 installation is somehow damaged but the configuration file is correct. Loading a grub.cfg file will load your distribution's grub2 menu within Super GRUB2 Disk.

Detect any GRUB2 installation (even if mbr is overwritten)

This option will search all partitions for grub2 installations (specifically for grub2 core.img files) and create a menu to choose among those that it finds. This can be useful if your mbr has been overwritten by Windows but your GRUB2 installation is otherwise working. While loading your grub.cfg directly (as with the previous option) will also usually allow you to boot, there may be issues loading the config file if it uses features from a newer version of GRUB2 than the one used in Super GRUB2 Disk. Loading a grub2 core.img via this option will load GRUB2 from your distribution as if the mbr were intact and you had booted normally.

Detect loop bootable isos (in /boot-isos or /boot/boot-isos/)

Many GNU/Linux liveCD distributions support loop booting from an iso file, that is you can boot from the iso file without needing to burn it to a CD. This option will search all partitions for either a directory /boot-isos/ or /boot/boot-isos/. It will then find all of the .iso files within those directories and create a menu to choose among them. Not all iso files can be loop booted, as the live distribution itself needs to support this. Each live distribution has its own quirks when it comes to loop booting and needs to be treated specially (unless they ship a Loopback.cfg).

Currently supported Distributions:

  • Grml
  • Parted Magic
  • Sidux
  • Slax Tinycore
  • Ubuntu
  • SystemRescueCd
  • Any distribution that ships with a Loopback.cfg

Enable GRUB2's LVM support

This option enables GRUB2's LVM support with "insmod lvm", if your /boot is on LVM then you will need to choose this option before any of the above "Detect..." options will work. If you do not know what LVM is then this does not apply to you, and you may simply ignore this option.

Enable GRUB2's RAID support

This option enables GRUB2's RAID support, if your /boot is on RAID then you will need to choose this option before any of the above "Detect..." options will work. If you do not know what RAID is then this does not apply to you, and you may simply ignore this option.

With RAID1 GRUB will often be able to read individual members of the array even without the RAID modules loaded, but it doesn't hurt to enable real RAID support as well even with RAID1.

Enable GRUB2's PATA support (to work around BIOS bugs/limitations)

Many computers have buggy BIOSs that do not work properly with large drives, which usually translates to "out of disk" errors from GRUB when you try to boot from large drives without using a separate small /boot partition at the beginning of the drive. GRUB2 has native drivers for accessing drives directly, bypassing the BIOS entirely. Since it's bypassing the BIOS, limitations of your BIOS do not apply and you can access any part of any sized drive.

If you are having problems booting because of an "out of disk" error then selecting this option will likely allow you to boot. To install grub2 with ata support to fix this permanently use "grub-install --disk-module=ata".

Currently GRUB2 only supports the older PATA (also know as ATAPI or IDE) drives. If you have a newer SATA drive then this option will not work for you, but it's also less likely that you will encounter these limitations with newer BIOSs that support SATA. For more information on the limitations of buggy BIOSs with large disks see: http://tldp.org/HOWTO/Large-Disk-HOWTO-4.html .

Enable GRUB2's USB support *experimental*

Many BIOSs do not support booting from USB, with this option you can use Super GRUB2 Disk (booted from a floppy, CD, or other media that your BIOS does support booting from) to boot an operating system from a USB drive despite your BIOSs limitation, using GRUB2's native USB drivers. This option will only allow you boot Free Operating Systems like GNU/Linux or FreeBSD, chainloading will not work with this option and so it cannot be used to boot Windows from a USB drive. This option, as stated, is still experimental.

Enable serial terminal

This option enables GRUB2's serial console support, using the default parameters. This can often be useful for debugging as you can log error messages. If the defaults don't work for your serial hardware you'll need to configure it manually using the "serial" command as documented here: http://www.gnu.org/software/grub/manual/grub.html#serial .

If you don't know what a serial console is then you may simply ignore this option.

List devices/partitions

This option will list all of the devices and partitions that GRUB2 is able to read, with information about them like what filesystem each has. As GRUB2 uses the same module, ext2.mod, to support ext{2,3,4} any extN filesystem will be listed here as being "ext2".

Development

Chroot

Although not strictly need you are encouraged to use a chroot for Super Grub2 Disk build. We will use a Debian Sid chroot.

Please check: Super Grub2 Disk Sid Chroot in order to learn how to setup your Super Grub2 Disk sid chroot.

Grub2 build and installation

Super Grub2 Disk Sid Chroot Grub2 Installation (Not actually used)

Super Grub2 Disk Sid Chroot Grub2 Build And Installation (Deprecated)

Super Grub2 Disk build

Super Grub2 Disk Sid Chroot Build

Super Grub2 Disk test in virtual machine