Jump to content

GNU GRUB: Difference between revisions

From Wikipedia, the free encyclopedia
Content deleted Content added
Mac (talk | contribs)
it has now references
Installation: /boot/grub/grub.conf exists on Gentoo too!
Line 55: Line 55:
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]].
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 <code>/boot/grub/menu.lst</code> while [[Fedora (Linux distribution)|Fedora]] uses <code>/boot/grub/grub.conf</code>. Fedora also provides a [[symbolic link]] from <code>/etc/grub.conf</code> to <code>/boot/grub/grub.conf<code> for [[Filesystem Hierarchy Standard|FHS]] compatibility reasons.
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 <code>/boot/grub/menu.lst</code> while [[Fedora (Linux distribution)|Fedora]] and [[Gentoo]] uses <code>/boot/grub/grub.conf</code>. Fedora also provides a [[symbolic link]] from <code>/etc/grub.conf</code> to <code>/boot/grub/grub.conf<code> for [[Filesystem Hierarchy Standard|FHS]] compatibility reasons.


Instead of being installed on the system's hard disk, GRUB can be installed on [[removable media]] such as an optical drive (bios access, and [[El Torito (CD-ROM standard)|el-torito]]), [[floppy disk]] or [[USB flash drive]] in order to bring up a system which may not have or cannot boot from its own disk.
Instead of being installed on the system's hard disk, GRUB can be installed on [[removable media]] such as an optical drive (bios access, and [[El Torito (CD-ROM standard)|el-torito]]), [[floppy disk]] or [[USB flash drive]] in order to bring up a system which may not have or cannot boot from its own disk.

Revision as of 20:36, 18 March 2008

GNU GRUB
Developer(s)GNU Project
Stable release
Repository
TypeBootloader
LicenseGNU General Public License
Websitehttp://www.gnu.org/software/grub/

GNU GRUB ("GRUB" for short) is a boot loader package from the GNU Project. GRUB is the reference implementation of the Multiboot Specification, which allows a user to have several different operating systems on their computer at once, and to 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 to pass boot-time parameters to such kernels.

GNU GRUB developed from a previous 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 general-purpose Linux distributions. Solaris has used GRUB as its bootloader on x86 systems since the Solaris 10 1/06 release.

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; while Multiboot compliant, it supports non-multiboot operating systems such as Microsoft Windows and OS/2 via a chain loading function. GRUB supports all commonly used Unix file systems as well as VFAT and NTFS as used by Windows, and supports 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.[citation needed] 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 can thus support disk-free 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—that controlled by the configuration file "menu.lst"—by pressing the "c" key. A GRUB prompt (similar to bash) can also be obtained from booting up GRUB as a stand alone system without an operating system attached or in any GRUB installation with an operating system when the "menu.lst" file 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 called "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 partition details of the hard disks, alter a partition setting, re-map the disk order temporarily, boot any user-defined configuration file and to view booting configuration of other boot loaders in filing 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 scrolling screen for selection of operating systems to boot. This means 150 or more booting choices can be controlled by GRUB with ease by adding each to the "menu.lst" configuration file, and selecting one at boot time using the arrow keys.

One boot loader can boot 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 as a stand alone system 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 a USB device. These files are available from any Linux Live CD that supports GRUB, making it easily and freely obtainable by computer users.

Boot process

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

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 either 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 to the user in order to select which operating system to boot. This normally takes the form of a graphical menu, although if this is not available or the user wishes further control, GRUB has its own command prompt, where the user can manually specify the boot parameters. GRUB can also be set to automatically load a particular kernel after a timeout period.

Once boot options have been selected, GRUB loads the selected kernel into memory and passes control on to the kernel. At this stage GRUB can pass control of the boot process to another loader using chain loading if required by the operating system.

Installation

GRUB in non-graphical mode

A key feature of GRUB is that it can be installed without being attached to an operating system, although 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 a method known as Chain loading.

Unlike LILO, there is no need to reinstall GRUB to the MBR or a partition after a change 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 uses /boot/grub/grub.conf. Fedora also provides a symbolic link from /etc/grub.conf to /boot/grub/grub.conf for FHS compatibility reasons.

Instead of being installed on the system's hard disk, 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 its own disk.

Development

The most used version of GRUB is referred to as "GRUB Legacy". This version is still receiving bug fixes but no new features are being added. The GRUB developers have switched their focus to GRUB 2, a complete rewrite whose most important goal is to make GNU GRUB cleaner, safer, 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 the GRUB version 0.9x was renamed GRUB Legacy. When GRUB 2 is released it will bear the name GNU GRUB. As of February 2008, GRUB 2 is still in development, is not ready for production use, and is not documented.

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.

Frontends

KGRUBEditor is a system GUI tool to view and edit the GRUB boot loader, written in the KDE4 libraries. [1]

Grub Conf is a GNOME2 based GRUB configuration editor. [2]

grub-choose-default controls Grub Default through a GUI. [3] [4]

GrubEd is a script which gives users a nice GUI to alter their grub settings at the touch of (a few) buttons. [5]

There is a MS-Dos frontend: GRUB for DOS [6]

Utilities

GRUB Utilities is a collection of multi platform utilities for GRUB Legacy, GRUB2 and GRUB for DOS. [7]

Remove

You can use fdisk to remove GRUB. [8]

References

  • Brady, Pádraig. "Details of GRUB on the PC". pixelbeat.org. Retrieved 2006-11-22.
  • Okuji, Yoshinori. "GNU GRUB". gnu.org. Retrieved 2007-11-29.

Notes

See also