Open Source

Edit boot stanzas in GRUB

Learn to use the GRUB boot manager to manipulate boot commands.

Delivered each Tuesday, TechRepublic's free Linux NetNote provides tips, articles, and other resources to help you hone your Linux skills. Automatically sign up today!

GRUB is a boot loader for Linux and other operating systems that's growing increasingly popular. It's even becoming the standard for numerous distributions.

Unlike LILO, the other popular boot loader, GRUB is extremely flexible. GRUB allows you to manipulate boot commands during the booting process, which can be quite a help during troubleshooting.

When you start the computer and the GRUB boot manager appears, you can halt the loading of the default boot stanza by pressing [Esc]. Then highlight any stanza, and enter E to edit it.

GRUB will offer a list of options for the specific stanza, taken straight from the /boot/grub/menu.lst file. For example, you may see something like the following:

root (hd0,0)
kernel /vmlinuz ro root=/dev/hdc5 vga=788 noapic acpi=ht
initrd /initrd.img

Use the cursor to highlight each line, and enter E to edit the line.

The advantages are obvious: If you install a kernel that hangs, you can edit the file and provide the name of an alternate kernel, or alternate options for the kernel, without first rebooting and modifying a configuration file, which you would have to do if using LILO.

Once you've edited the file to suit your needs, enter B to boot the entry. If you change your mind about editing a particular entry, press [Esc] to return to the main menu.

About Vincent Danen

Vincent Danen works on the Red Hat Security Response Team and lives in Canada. He has been writing about and developing on Linux for over 10 years and is a veteran Mac user.

Editor's Picks

Free Newsletters, In your Inbox