How do I install GRUB on Windows

1. Differences between GRUB and LiLo

The Grand Unified Bootloader (GRUB) was actually developed for the GNU / Hurd system. In addition to the GNU / Hurd kernel (will it ever be finished?), It can also be used natively on Linux and via chainloading on the native bootloader of Free, NetBSD, OpenBSD, operating systems (?) Of the Windoze family, OS / 2 and Solaris. In contrast to LiLo, however, it does not require a functioning operating system environment, as it has a "built-in" installation program and also natively the most common file systems, such as

  • FAT16 / FAT32
  • ext2fs
  • jfs
  • minix
  • ufs (Solaris, * BSD)
  • xfs

supported. He can therefore load different kernels completely autonomously from the local hard disks or access their native bootloader.

GRUB has a boot menu that is somewhat reminiscent of the NT loader from Kleinstoft.

In contrast to LiLo, changes in the boot mechanism or compilation of a new kernel do not require reinstallations of the bootloader (/ sbin / lilo) - GRUB simply reads in configuration changes the next time the system is started. In the end, this simply means that when using GRUB you only have the installation trouble once, when using LiLo you have it more often ...

Thanks to its own installation program, GRUB is also an ingenious tool for boot floppy disks.

2. Installation of GRUB

<disclaimer>

Changing the MBR is always a tricky business, where you should always be clear about what you are doing and that in the event of failure you may end up with a system that will no longer boot. A backup is therefore always recommended. This procedure should work like this on every machine, but I refuse to accept any responsibility in the event of failure yadayadayada ...

</disclaimer>

To understand how GRUB names partitions and hard disks, it is important to keep reminding yourself that it starts with "0" and that there are no differences between SCSI and IDE. GRUB names the first partition of the first hard disk as "hd0,0", the second as "hd0,1" yadayadyada ...

The matter is a bit "tricky" due to the fact that GRUB only knows an American keyboard assignment when installing without a 'keymap', i.e. when installing from floppy disk. It is therefore advisable to have an American keyboard table to hand during installation (Hint: is printed in every DOS manual).

The installation goes "quick and dirty" as follows when logged in as superuser:

  • If there is no 'boot / grub' directory after installing GRUB, create this: # mkdir / boot / grub
  • If the files from '/ usr / lib / grub' or '/ usr / local / lib / grub' are not yet in this directory, copy them there: # cp / usr / lib / grub / * / boot / dug

Then you can install GRUB either using a boot floppy disk or using 'grub-install' directly from the hard drive:

2.1 Installation from a boot disk

We simply assume the following requirements:

GRUB is to be installed in the MBR of the first SCSI hard disk. The kernel is located in the "/ boot" directory on the second partition of the first SCSI hard disk (/ dev / sda2), which in turn has a subdirectory called "grub /".

The least risky way to install GRUM IMHO is to use a boot floppy disk. This is created as follows:

Insert an empty floppy disk and copy the files 'stage1' and 'stage2' from the new directory in raw mode:

# cd / boot / grub # dd if = stage1 of = / dev / fd0 count = 512 count = 1 # dd if = stage2 of = / dev / fd0 count = 512 seek = 1

To save yourself a lot of effort, you should create a configuration file for GRUB under '/boot/grub/menu.lst' now. More information on this file can be found under 3. Configuring GRUB.

After booting from the floppy disk you just created, GRUB will receive you at its boot prompt. The boot prompt conveniently has - like bash - a command line completion using the tab key. Now you show Grub what you want to boot with the following commands:

# root (hd0,1)

From this information, GRUB recognizes that you want to boot from the second partition on the first disk (it always starts counting at "0").

# kernel / boot / vmlinuz root = / dev / sda2 mem = 256M

GRUB takes from this information the kernel to be booted (/ boot / vmlinuz) and the parameters to be passed to it.

# boot

This triggers the boot process. No changes have been made to the MBR.

Alternatively, without making any changes to the MBR, you can start a test run with the following syntax:

# root (hd0,1) # install = / boot / grub / stage1 d (hd0) / boot / grub / stage2 0x8000 p /boot/grub/menu.lst

However, this variant requires a functioning 'menu.lst' in the "/ boot / grub" directory, which you can test once on this occasion, if it exists.

The installation of GRUB is carried out with the following commands:

# root (hd0,1) # install = / boot / grub / stage1 d (hd0) / boot / grub / stage2 0x8000 p /boot/grub/menu.lst # makeactive

2.2 Installation from the hard disk

As a superuser, GRUB can be installed from the hard disk using the program '/ sbin / grub-install'. The drive or partition from whose boot sector GRUB is to boot is specified as a parameter. The device can either be specified specifically for the operating system (e.g. '/ dev / sda') or in GRUB's notation (e.g. (hd0)). Some examples:

  • / sbin / grub-install / dev / sda Installs GRUB in the MBR of the first SCSI hard drive
  • / sbin / grub-install / dev / hda Installs GRUB in the MBR of the first IDE hard drive
  • / sbin / grub-install '(hd0)' Installs GRUB in the MBR of the first hard disk
  • / sbin / grub-install / dev / sda1 Installs GRUB in the first primary first partition of the first SCSI hard drive
  • / sbin / grub-install / dev / hda1 Installs GRUB in the first primary partition of the first IDE hard drive
  • / sbin / grub-install '(hd0,0)' Installs GRUB in the first primary partition of the first hard drive

If you have a notebook with a removable floppy disk drive, you should connect it because GRUB will find the floppy controller and want to access the drive in order to enter it in its device map and otherwise react extremely ungraciously with long timeouts.

3. Configuration of GRUB

Grub is configured via the '/boot/grub/menu.lst' file. This could look like this in the above scenario:

# Boot menu configuration file for GRUB # # $ Id $ # --------- Global options ------------- # Boot automatically after 30 secs # timeout 30 # By default, boot the 1st entry (section 0) # default 0 # Fall back on the 4th entry (section 3) # fallback 3 # ---------- Bootable sections --------- # begin section 0 (bootable) # title Gentoo / i386 with Torvalds kernel 2.6.13 (framebuffer) root (hd0,1) kernel /boot/vmlinuz-2.6.13 root = / dev / sda2 video = matrox: vesa: 0x11A # begin section 1 (bootable) # title Gentoo / i386 with Torvalds kernel 2.6.13 (single user, framebuffer) root (hd0,1) kernel /boot/vmlinuz-2.6.13 root = / dev / sda2 single video = matrox: vesa : 0x11A # begin section 2 (bootable) # title Gentoo / i386 with Torvalds kernel 2.6.13 (single user) root (hd0,1) kernel /boot/vmlinuz-2.6.13 root = / dev / sda2 single # begin section 3 (bootable) # title Gentoo / i386 with Torvalds kernel 2.6.13 (backup) root (hd 0,1) kernel /boot/vmlinuz-2.6.13.old root = / dev / sda2 # begin section 4 (bootable) # title NetBSD / i386 2.0.2 (Bootloader) root (hd3,0, a) chainloader +1 boot # begin section 5 (bootable) # title Boot-Diskette root (fd0) chainloader +1 # begin section 6 (possibly destructive, bootable) # title Install GRUB in the MBR (HardDisk / dev / sda) and boot ... pause Press any key to install GRUB in the MBR of / dev / sda or press [ESC] to quit ... root (hd0,1) setup (hd0) root (hd0,1) kernel /boot/vmlinuz-2.6.13 root = / dev / sda2 video = matrox: vesa: 0x11A boot

Further options and possibilities are the really good documentation on GRUB in Texinfo format about the command

# info grub

refer to.

With a patched GRUB, a graphic can be placed behind the boot menu, the command mode or individual boot options can be protected with passwords, ...

4. Left