menu.lst and chainload Windows.
Table of Contents
- Overview
- Installing from a Running System
- Reinstalling via the GRUB Shell
- Editing
/boot/grub/menu.lst - Chainloading Windows
- Command Reference
- Links and References
Overview
GRUB Legacy (version 0.9x) remains a popular choice for legacy hardware or minimal setups. You’ll install its core files to/boot/grub and write stage1 into the Master Boot Record (MBR).
Always double-check your target device (e.g.,
/dev/sda) before running grub-install or setup. Installing to the wrong disk can overwrite critical data.Installing from a Running System
Use thegrub-install utility to deploy GRUB Legacy without rebooting:
/dev/sda):
/boot/grub. To change this directory, pass:
The
--boot-directory option is helpful if you’re using a custom EFI or boot partition layout.Reinstalling via the GRUB Shell
When your system fails to boot, use a GRUB Legacy rescue disk:-
Boot from the rescue media and press
cto open thegrub>prompt. -
Identify and mount your boot partition (where
/boot/grubresides): -
If unsure, locate
stage1withfind: -
Write GRUB’s stage1 into the MBR of the first disk:
- Reboot—the GRUB menu should appear.
Editing /boot/grub/menu.lst
The GRUB Legacy configuration file is a simple plain-text list of menu entries. Open it with your favorite editor:
# and blank lines are ignored.
Basic Linux Entry
| Directive | Description | Example |
|---|---|---|
title | Label shown in the GRUB menu | My Linux Distribution |
root | GRUB device containing kernel & modules (disks/partitions start at 0) | (hd0,0) |
kernel | Path to kernel (relative to root) plus boot parameters | /vmlinuz root=/dev/sda1 ro quiet |
initrd | Initial RAM disk (if required) | /initrd.img |
module | GRUB module to load (e.g., filesystem support, framebuffer) | /boot/grub/i386-pc/915resolution.mod |
Omitting the root Directive
You can embed the device specifier within the kernel path:
Chainloading Windows
To boot Windows or another OS via chainloading:- root (hd0,1): Second partition of the first disk.
- makeactive: Marks this partition as active (necessary for DOS/Windows).
- chainload +1: Loads its first sector.
- boot: Handoffs control to the loaded bootloader.
Command Reference
| Command | Purpose |
|---|---|
grub-install <device> | Install GRUB from a running Linux system |
--boot-directory=<path> | Specify custom location for GRUB files |
root (hdX,Y) | Set the GRUB root device in rescue shell |
find /boot/grub/stage1 | Search for the stage1 file to identify correct partition |
setup (hdX) | Write stage1 into the MBR |
title / kernel / initrd / module | Define menu entries in menu.lst |
makeactive / chainload | Chainload another bootloader (e.g., Windows) |