GRUB - The structure of configuration file

The configuration file of GRUB

Introduction

The GRUB configuration file is located in /boot/grub/grubonf ou /boot/grub/menu.lst

Example of a standard configuration

In general the structure of /boot/grub/grubonf or /boot/grub/menu.lst is as follows (Don't take into account the existing comments).

default N timeout sec color color1 color2 # Configuration for the OS on which Grub is installed title The OS label root (hd,) kernel /boot/vmlinuz-2.x.x.xx root=/dev/hdLN options initrd /boot/initrd.img-2.x.x.xx # From here to edit for other OS # For GNU/Linux # For each OS added in Grub add it to write the next block title The additional OS label root (hd,) kernel /boot/vmlinuz-2.x.x.xx root=/dev/hdLN options initrd /boot/initrd.img-2.x.x.xx rootnoverify (hd,) #For Windows title The OS label root (hd,) chainloader +1

Defaults Parameters

default N - is the system that starts by default with the bootloader dual boot system

- is the system that starts by default with the bootloader dual boot system sec timeout - the timeout in seconds before the automatic startup

- the timeout in seconds before the automatic startup color color1 color2 - The background color

1. Addressing

and and are numbered from zero, so there is no hda, hda1, etc. ..

Example:

1st partition of 1st disk (hd0, 0)

2nd partition of 1st disk (hd0, 1)

First partition 2nd disk (hd1, 0)

2. Title

title - is a label that is displayed in the GRUB boot

Ex: Debian GNU/Linux, kernel 2.6.17.7

3. Root

root (hd,)

Activating a partition as boot partition.

4. Kernel

kernel /boot/vmlinuz-2.x.x.xx root=/dev/hdLN options

Loading the kernel:

- If the partition contains activated at startup contains / boot (thus a dedicated partition), use:

kernel /vmlinuz-2.x.x.xx root=/dev/hdLN options

the root=/dev/hdLN argument means the root system

L is a letter representing the disc (a for the first disk, b for second, etc. .., and N is the partition number)

Optional:

ro for read-only

mem = 'size'

Here is a link : ldrg/HOWTO/BootPrompt-HOWTO.html

5. Initrd

initrd /boot/initrd.img-2.x.x.xx

The kernel mounts a temporary root system using a compressed image

- If the partition activated at startup contains / boot (thus a dedicated partition), use:

initrd /initrd.img-2.x.x.xx

6. Rootnoverify

rootnoverify (hd,)

Activation of the boot partition but without mounting it

Use it for the OS for which we must add the configuration file.

7. Chainloader

chainloader +1

Loading a file or blocks that act as secondary loader

Used to activate Windows.

Important notes

When partitioning the drive, note on a piece of paper all the manipulation performed. It can be used to edit the Grub configuration file later.

Some systems use vmlinuz to refer to the kernel. In fact it is a symbolic link to the kernel.

Similarly initrd will be a symbolic linkfor initrd.img-2.xxxx.

To know which version of the OS kernel :

uname -r

To see which kernel points to vmlinuz

ls -l /boot/vmlinuz

Grub also has a small shell that can be used to test the commands you want to put in the configuration file.

Hunter Jones

Hunter Jones

Next Post

Leave a Reply

Your email address will not be published. Required fields are marked *