GNU GRUB (short for GNU GRand Unified Bootloader ) is a boot loader package from the GNU Project. GRUB (shortened form of GNU GRUB ) is the reference implementation of the Multiboot Specification, which enables a user to have multiple operating systems on their computer, and choose which one to run when the computer starts. GRUB can be used to select from different kernel images available on a particular operating system's partitions, as well as pass boot-time parameters to such kernels.

GNU GRUB was developed from a package called the Grand Unified Bootloader (a play on grand unified theory). It is predominantly used on Unix-like systems. The GNU operating system uses GNU GRUB as its boot loader, as do most Linux distributions. Solaris has used GRUB as its boot loader on x86 systems starting with the Solaris 10 1/06 release.

History

GRUB was initially developed by Erich Boleyn as part of work on booting the operating system GNU Hurd developed by the Free Software Foundation. In 1999, Gordon Matzigkeit and Yoshinori K. Okuji made GRUB an official software package of the GNU project and opened the development process to the public.

Features

GRUB is dynamically configurable. It loads its configuration at startup, allowing boot-time changes such as selecting different kernels or initial RAM disks. To this end, GRUB provides a simple, bash-like, command line interface which lets users write new boot sequences.

GRUB is highly portable. It supports multiple executable formats, and is geometry translation independent. Although Multiboot compliant, GRUB supports non-multiboot operating systems such as Microsoft Windows and OS/2 via chain loading. GRUB supports all commonly used Unix file systems, VFAT and NTFS used by Windows, as well as Logical Block Address (LBA) mode. GRUB allows users to view the contents of files on any supported file system.

GRUB can be used with a variety of different user interfaces. Most Linux distributions take advantage of GRUB's support for a graphical interface to provide a customized boot menu with a background image, and occasionally mouse support. GRUB's text interface can be set to use a serial link to provide a remote terminal boot loader access.

GRUB can download operating system images from a network, and thus can support diskless systems. GRUB supports automatic decompression of OS images prior to booting from them.

GRUB differs from other boot loaders by being able to communicate with a user directly via a GRUB prompt. A GRUB prompt is the stage before GRUB loads an operating system and can be triggered at a text-mode GRUB booting screen (which is controlled by the configuration file "menu.lst" (or "grub.cfg": see below)) by pressing the "c" key. A prompt (similar to bash) can also be obtained by booting GRUB without an operating system attached, or in a GRUB installation with an operating system where the file "menu.lst" is absent. From the GRUB prompt a user can manually select and control booting from any installed operating system by using bash-like commands. To boot an operating system automatically, the appropriate commands are placed in a configuration file named "menu.lst" in a designated subdirectory.

GRUB has a rich set of terminal commands that allow a user at the GRUB prompt to view the hard disk partition details, alter partition settings, temporarily re-map the disk order, boot any user-defined configuration file and view the configuration of other boot loaders in file formats GRUB supports. Thus, without prior knowledge of what is installed on a computer, one can use GRUB from an external device such as a floppy disk, USB device or a CD-ROM to boot up an installed operating system.

GRUB uses a scrollable screen for operating system boot selection. This means 150 or more boot choices can be easily controlled by GRUB by adding them to the "menu.lst" configuration file. The arrow keys are used to select which operating system to boot.

One boot loader can run another boot loader by chainloading . GRUB uses the same two to three lines of command sequences to boot any DOS, Windows, Linux, BSD or Solaris system, making it very easy to work with.

Although GNU GRUB can be pre-packaged or retro-built into Unix-like operating systems, there are also specific GRUB implementations for DOS and Windows. GRUB can also be installed stand alone, unattached to any operating system. Its implementation requires one file for booting from a CD and two files for booting from a floppy, hard disk or USB device. These files are available from any Linux Live CD that supports GRUB, making it easily and freely obtainable.

Boot process

When a computer is turned on, the computer's BIOS finds the primary bootable device (usually the computer's hard disk) and loads the initial bootstrap program from the master boot record (MBR), the first 512 bytes of the hard disk, then transfers control to this code.

The MBR contains GRUB stage 1. Given the small size of the MBR, Stage 1 does little more than load the next stage of GRUB (which may reside physically elsewhere on the disk). Stage 1 can load Stage 2 directly, or it can load stage 1.5. GRUB Stage 1.5 is located in the first 30 kilobytes of hard disk immediately following the MBR. Stage 1.5 loads Stage 2.

When GRUB Stage 2 receives control, it presents an interface where the user can select which operating system to boot. This normally takes the form of a graphical menu. If this is not available, or the user wishes direct control, GRUB has its own command prompt. The user can then manually specify the boot parameters. GRUB can be set to automatically load a specified kernel after a user defined timeout.

Once boot options have been selected, GRUB loads the selected kernel into memory and passes control to the kernel. Alternatively, GRUB can pass control of the boot process to another loader, using chain loading . This is the method used to load operating systems such as Windows, that do not support the Multiboot standard. In this case, copies of the other system's boot programs have been saved by GRUB. Instead of a kernel, the other system is loaded as though it had been started from the MBR. This could be another boot manager, such as the Microsoft boot menu, allowing further selection of non-Multiboot operating systems. (This behavior is often automatic when modern Linux distributions are installed "on top of" an existing Windows installation. This enables retention of the original operating system without modification, including systems that contain multiple versions of Windows.)

Installation

A key feature of GRUB is that it can be installed without being attached to an operating system. However, it needs a copy of a Linux image for such an installation. Working as a stand alone system it is virtually a mini system in its own right and able to boot all the installed major operating systems by chain loading, as described above.

Unlike LILO, there is no need to reinstall GRUB to the MBR or a partition after changes to the configuration file.

In Linux, the "grub-install" command is used to install stage1 to either the MBR or a partition. GRUB's configuration file, stage2 (usually), and other files must be in a usable partition. If these files or the partition become unavailable, stage1 will drop the user to the command line interface.

The name and disk location of the GRUB configuration file varies from system to system. For example, in Debian GNU/Linux and openSUSE the file is stored in /boot/grub/menu.lst while Fedora and Gentoo Linux uses /boot/grub/grub.conf . Fedora also provides a symbolic link from /etc/grub.conf to /boot/grub/grub.conf for FHS compatibility reasons.

GRUB can be installed on removable media such as an optical drive (bios access, and el-torito), floppy disk or USB flash drive in order to bring up a system which may not have or cannot boot from a hard disk.

Development

The most commonly used version of GRUB is referred to as "GRUB Legacy". This version is still receiving bug fixes, but no new features are being added. Ubuntu uses GRUB 2 by default for new installations. The GRUB developers have switched their focus to GRUB 2 , a complete rewrite with goals including making GNU GRUB cleaner, more robust, more portable and more powerful. GRUB 2 started under the name PUPA . PUPA was supported by the Information-technology Promotion Agency (IPA) in Japan. PUPA was integrated into GRUB 2 development around 2002, when GRUB version 0.9x was renamed GRUB Legacy.

Some of the goals of the project include support for non-x86 platforms, internationalization/localization, non-ASCII characters, dynamic modules, memory management, a scripting mini-language, migrating platform specific (x86) code to platform specific modules, and an object-oriented framework.

Variants

Since GRUB Legacy is still the most widely used version among end users, but official development is being done on a different version, several other projects maintain their own enhancements (forks) to the GRUB Legacy code. These include Super Grub Disk (new commands include "setgrubdevice" and "usbshift") and GRUB for DOS (several commands were enhanced, including "find --set-root", "map --hook", and "cdrom").

OpenSolaris includes a modified GRUB Legacy which supports disklabels, automatic 64-bit kernel selection, and booting from ZFS (with compression and multiple boot environments). Syllable OS project made a modified version of GRUB to load the system fr

Linux+Win9x+Grub HOWTO

A Linux Help site providing categorized and searchable Linux Help files, Linux Howtos, Linux Man pages and Linux Forums for the Linux community.

...

Procedure

Linux+Win9x+Grub HOWTO; Prev ... You can see that GRUB has a funny numbering system, 0-3 for primary partitions and 4+ for ...

...

Linux+Win9x+Grub HOWTO

This HOWTO will tell you how to use the GRUB bootloader to turn your computer into a Windows + Linux dual boot machine, without affecting your current Linux installation.

...

GRUB-HOWTO: GNU Free Documentation License

2. GNU Free Documentation License. GNU Free Documentation License Version 1.1, March 2000 Copyright (C) 2000 Free Software Foundation, Inc. 59 Temple Place, Suite 330, Boston, MA ...

...

HOWTO: Grub splash images. - Ubuntu Forums

HOWTO: Grub splash images. Tutorials & Tips ... Introduction This guide will tell you how to get a nice background image while in Grub.

...

GRUB HOWTO and troubleshooter - LinuxQuestions.org

GRUB HOWTO and troubleshooter LinuxQuestions.org Member Success Stories

...

Re: Software Raid and Grub Howto

From: Chris Ricker To: fedora-test-list redhat com; Subject: Re: Software Raid and Grub Howto; Date: Tue, 21 Oct 2003 13:40:47 -0400 (EDT)

...

Linux Online - Linux+Win9x+Grub HOWTO

List of Linux HOWTO documents and other sources of help.

...

GNU GRUB - Wikihowto: a howto site anyone can edit

Object: GNU GRUB ... Wikianswers is a Q&A wiki where answers are improved, wiki-style.

...

Linux+Win9x+Grub-HOWTO

Linux+Win9x+Grub HOWTO Joel Rosen Revision History Revision v1.0 Initial release. 2002−01−10 Revised by: jr This HOWTO will tell you how to use the GRUB bootloader to ...

...