Installing Grub

From DSL Wiki

       This Site in other languages: Deutsch, EspaƱol



GRUB (GRand Unified Bootloader) is a multiboot boot loader which is most commonly used to allow dual-booting of two or more operating systems installed on a single computer. It is the first software program that runs when a computer starts.

In technical terms, a multiboot boot loader is one which can load any executable file with a multiboot header present in the first 8KB of the file. Such a header consists of 32 bits of "magic" number, 32 bits of flags, a further 32 bits of magic number, followed by data about the executable image.

GRUB, like other bootloaders, is configured through a configuration file. The default location is /boot/grub/menu.lst. It may also be called Read the man pages for notes on how to edit GRUB's menu.lst file.

Making a boot floppy or CD

The first thing you need is a way to boot your toasted HD install, so grab the GRUB floppy image from my FTP.

If you don't have a floppy drive, you can grab the grub.iso CD image.

Some points to bear in mind:

  • It is about 500kb in size.
  • You have to close the CD. Multisession won't work right.

Make the floppy with the following command.

        cat >/dev/fd0

(Using dd will not work and there are currently no plans to create a version that will, since this method works fine)

Or for the iso, you can use cdrecord, just like for any other iso.

Booting the first time

So, now that you have your boot media, you need to boot the dead computer with the GRUB disk in it, and tell grub how to boot it.

Note: You need to have your BIOS set up to boot from the boot floppy/CD instead of the hard disk. '

Thankfully, GRUB is very simple to do this with. For example, if your DSL hd-install is on hda1, here is what you need to enter.

        title DSL
        root (hd0,0)
        kernel /boot/linux24 root=/dev/hda1

or, for frugal,

        title DSL
        root (hd0,0)
        kernel /boot/isolinux/linux24 root=/dev/hda1
        initrd /boot/isolinux/minirt24.gz

Notice that GRUB does not number disks and partitions like Linux does. Linux starts counting from 1. Grub counts from 0.

So, the first disk is hd0. Then you have hd1, hd2 and so forth.

The same with partitions. The first partition is numbered "0", then 1 for the second, and so on.

The DSL kernel is at /boot/linux24, so dont change that.

For the "root=" entry, put the Linux device path there, like I did. /dev/hda1 or whatever.

Installing GRUB

  • NOTE - DSL 1.3+ automatically installs GRUB as part of the Frugal Install script (Apps -> Tools menu).

After you get your DSL install up, grab the grub.dsl from MyDSL.

Run the following command.

        grub-install /dev/hda

No, I don't mean hda1, or whatever partition.

Yes, we are installing GRUB to the Master Boot Record.

No, this won't kill your windows. We'll get to that in a minute.

The last step is to set up the menu.list for GRUB, unless you like typing in the commands to boot a partition manually. I know I do. ^_^

The extension puts an empty menu.lst in /boot/grub, so you have to set it up manually. But I put decent instructions in comments in it, so it shouldnt be too hard.

Just remember to do chainloader +1 for windows booting.

Something like this, if windows is at hda2.

        title Windows
        root (hd0,1)
        chainloader +1

External Links