All Topics  
GNU GRUB

 

   Email Print
   Bookmark   Link






 

GNU GRUB



 
 
GNU GRUB ("GRUB" for short) is a boot loader package from the GNU Project
GNU Project

The GNU Project is a free software, mass collaboration project, announced on September 27 1983 by Richard Stallman. It initiated the GNU operating system, software development for which began in January 1984....
. GRUB is the reference implementation of the Multiboot Specification
Multiboot Specification

The Multiboot Specification is an open standard originally created in 1995 and developed by the Free Software Foundation. The specification describes a method of loading various multiboot Kernel using a single compliant boot loader....
, which allows a user to have several different operating system
Operating system

An operating system is an interface between hardware and applications; it is responsible for the management and coordination of activities and the sharing of the limited resources of the computer....
s 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).






Discussion
Ask a question about 'GNU GRUB'
Start a new discussion about 'GNU GRUB'
Answer questions from other users
Full Discussion Forum



Encyclopedia


GNU GRUB ("GRUB" for short) is a boot loader package from the GNU Project
GNU Project

The GNU Project is a free software, mass collaboration project, announced on September 27 1983 by Richard Stallman. It initiated the GNU operating system, software development for which began in January 1984....
. GRUB is the reference implementation of the Multiboot Specification
Multiboot Specification

The Multiboot Specification is an open standard originally created in 1995 and developed by the Free Software Foundation. The specification describes a method of loading various multiboot Kernel using a single compliant boot loader....
, which allows a user to have several different operating system
Operating system

An operating system is an interface between hardware and applications; it is responsible for the management and coordination of activities and the sharing of the limited resources of the computer....
s 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
Unix-like

A Unix-like operating system is one that behaves in a manner similar to a Unix system, while not necessarily conforming to or being certified to any version of the Single UNIX Specification....
 systems; the GNU operating system uses GNU GRUB as its boot loader, as do most general-purpose Linux distribution
Linux distribution

A Linux distribution is a member of the family of Unix-like software distributions built on top of the Linux kernel. Such distributions consist of a large collection of software applications such as word processors, spreadsheets, media players and database applications....
s. Solaris
Solaris Operating System

Solaris is a Unix-based operating system introduced by Sun Microsystems in 1992 as the successor to SunOS.Solaris is known for its scalability, especially on SPARC systems, and for originating many innovative features such as DTrace and ZFS....
 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
Initrd

The initial ramdisk, or initrd is a temporary file system commonly used in the boot process of the Linux kernel. It is typically used for making preparations before the real root directory file system can be mount ed....
. To this end, GRUB provides a simple, bash
Bash

Bash is a free software Unix shell written for the GNU Project. Its name is an acronym which stands for Bourne-again shell. The name is a pun on the name of the Bourne shell , an early and important Unix shell written by Stephen Bourne and distributed with Version 7 Unix circa 1978, and the concept of being "Born again Christianity"....
-like, command line interface
Command line interface

A command-line interface is a mechanism for interacting with a computer operating system or software by typing commands to perform specific tasks....
 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
Microsoft Windows

Microsoft Windows is a series of software operating systems and graphical user interfaces produced by Microsoft. Microsoft first introduced an operating environment named Windows in November 1985 as an add-on to MS-DOS in response to the growing interest in graphical user interfaces ....
 and OS/2
OS/2

OS/2 is a computer operating system, initially created by Microsoft and IBM, then later developed by IBM exclusively. The name stands for "Operating System/2," because it was introduced as part of the same generation change release as IBM's "IBM Personal System/2 " line of second-generation personal computers....
 via a chain loading
Chain loading

Chain loading is a method used by computer programs to replace the currently executing program with a new program, using a common data area to pass information from the current program to the new program....
 function. GRUB supports all commonly used Unix file systems as well as VFAT
File Allocation Table

File Allocation Table or FAT is a computer file system architecture now widely used on most computer systems and most memory cards, such as those used with digital cameras....
 and NTFS
NTFS

NTFS is the standard file system of Windows NT, including its later versions Windows 2000, Windows XP, Windows Server 2003, Windows Server 2008, Windows Vista, and Windows 7....
 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 interface
User interface

The user interface is the aggregate of means by which people—the User s—Interaction with the system—a particular machine, device, computer program or other complex tools....
s. 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
Serial port

In computing, a serial port is a serial communication physical interface through which information transfers in or out one bit at a time ....
 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 (which is controlled by the configuration file "menu.lst" (or "grub.conf": see below)) by pressing the "c" key. A GRUB prompt (similar to bash
Bash

Bash is a free software Unix shell written for the GNU Project. Its name is an acronym which stands for Bourne-again shell. The name is a pun on the name of the Bourne shell , an early and important Unix shell written by Stephen Bourne and distributed with Version 7 Unix circa 1978, and the concept of being "Born again Christianity"....
) can also be obtained by booting 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 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
Floppy disk

A floppy disk is a data storage medium that is composed of a disk of thin, flexible magnetic storage medium encased in a square or rectangle plastic shell....
, USB device or a CD-ROM
CD-ROM

CD-ROM is a pre-pressed Compact Disc that contains Computer data storage accessible to, but not writable by, a computer. While the Compact Disc format was originally designed for music storage and playback, the 1985 Yellow Book standard developed by Sony and Philips adapted the format to hold any form of Binary file....
 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
DOS

DOS, short for "Disk Operating System", is a shorthand term for several closely related operating systems that dominated the IBM PC compatible market between 1981 and 1995, or until about 2000 if one includes the partially DOS-based Microsoft Windows versions Windows 95, Windows 98, and Windows Me....
, Windows
Microsoft Windows

Microsoft Windows is a series of software operating systems and graphical user interfaces produced by Microsoft. Microsoft first introduced an operating environment named Windows in November 1985 as an add-on to MS-DOS in response to the growing interest in graphical user interfaces ....
, Linux
Linux

Linux is a generic term referring to Unix-like computer operating systems based on the Linux kernel. Their development is one of the most prominent examples of free and open source software collaboration; typically all the underlying source code can be used, freely modified, and redistributed by anyone under the terms of the GNU GPL license...
, BSD or Solaris system, making it very easy to work with.

Although GNU GRUB can be pre-packaged or retro-built into Unix-like
Unix-like

A Unix-like operating system is one that behaves in a manner similar to a Unix system, while not necessarily conforming to or being certified to any version of the Single UNIX Specification....
 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
BIOS

In computing, the Basic Input/Output System , also known as the System BIOS, is a de facto standard defining a firmware interface for IBM PC Compatible computers....
 finds the primary bootable device (usually the computer's hard disk) and loads the initial bootstrap
Bootstrapping (computing)

In computing, bootstrapping is a technique by which a simple computer program activates a more complicated system of programs. In the start up process of a computer system, a small program such as BIOS, initializes and tests that computer hardware, peripherals and external memory devices are connected, then loads a program from one of them a...
 program from the master boot record
Master boot record

A master boot record , or partition sector, is the 512-byte boot sector that is the first disk sector of a Disk partitioning data storage device such as a hard disk....
 (MBR), the first 512 bytes of the hard disk, and 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 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, which then continues to start itself. At this stage GRUB can also pass control of the boot process to another loader, using chain loading, for 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 may be yet 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" existing Windows systems, allowing the user to retain 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 a method known as chain loading
Chain loading

Chain loading is a method used by computer programs to replace the currently executing program with a new program, using a common data area to pass information from the current program to the new program....
.

Unlike LILO
LILO (boot loader)

LILO is a generic boot loader for Linux....
, 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
Command line interface

A command-line interface is a mechanism for interacting with a computer operating system or software by typing commands to perform specific tasks....
.

The name and disk location of the GRUB configuration file varies from system to system; for example, in Debian GNU/Linux and openSUSE
OpenSUSE

openSUSE, , is a general purpose operating system developed by the openSUSE Project. After acquiring SUSE Linux in January 2004, Novell decided to release the SUSE Linux Professional product as a 100% open source project, involving the community in the development process....
 the file is stored in /boot/grub/menu.lst while Fedora
Fedora (operating system)

Fedora is an RPM Package Manager-based, general purpose operating system built on top of the Linux kernel, developed by the community-supported Fedora Project and sponsored by Red Hat....
 and Gentoo Linux
Gentoo Linux

Gentoo is a computer operating system built on top of the Linux Kernel and based on the Portage package management system. It is distributed as Free software....
 uses /boot/grub/grub.conf. Fedora also provides a symbolic link
Symbolic link

In computing, a symbolic link is a special type of computer file that contains a reference to another file or directory in the form of an absolute or relative path and that affects pathname resolution....
 from /etc/grub.conf to /boot/grub/grub.conf for FHS
Filesystem Hierarchy Standard

The Filesystem Hierarchy Standard defines the main directories and their contents in most software systems using UNIX and Unix-like operating systems....
 compatibility reasons.

Instead of being installed on the system's hard disk, GRUB can be installed on removable media
Removable media

In computer storage, removable media refers to storage media which can be removed from its reader device, conferring portability on the data it carries....
 such as an optical drive (bios access, and el-torito
El Torito (CD-ROM standard)

The El Torito Bootable CD Specification is an extension to the ISO 9660 CD-ROM specification. It is designed to allow a computer to booting from a CD-ROM....
), floppy disk
Floppy disk

A floppy disk is a data storage medium that is composed of a disk of thin, flexible magnetic storage medium encased in a square or rectangle plastic shell....
 or USB flash drive
USB flash drive

A USB flash drive consists of a Flash memory#NAND memories-type flash memory data storage device integrated with a USB interface. USB flash drives are typically removable and rewritable, much smaller than a floppy disk , and most USB flash drives weigh less than an ounce ....
 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
Rewrite (programming)

A rewrite in computer programming is the act or result of re-implementing a large portion of existing functionality without re-use of its source code....
 whose goals include making 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 January 2009, 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
Platform (computing)

In computing, a platform describes some sort of hardware architecture or software framework , that allows Computer software to run. Typical platforms include a computer's Computer architecture, operating system, programming languages and related runtime libraries or graphical user interface....
, internationalization/localization
Localization

Localization or localisation may refer to:* GSM localization, a technique for determining the location of a user of a cell phone or wireless transceiver...
, non-ASCII characters, dynamic modules, memory management
Memory management

Memory management is the act of managing computer memory. In its simpler forms, this involves providing ways to allocate portions of memory to programs at their request, and freeing it for reuse when no longer needed....
, 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
Fork (software development)

In software engineering, a project fork happens when developers take a copy of source code from one Computer software and start independent development on it, creating a distinct piece of software....
) to the GRUB Legacy code in the meantime. These include (new commands include "setgrubdevice" and "usbshift") and [https://gna.org/projects/grub4dos/ GRUB for DOS] ( were enhanced, including "find --set-root", "map --hook", and "cdrom").

Syllable OS project made a modified version of GRUB to load the system from its AFS
AtheOS File System

The AtheOS file system was originally used in the AtheOS operating system, and is now a part of the Syllable operating system. AFS started with exactly the same data structures as the Be File System, BFS, and extended its feature set in many ways....
 filesystem

GRUB editors


StartUp-Manager
StartUp-Manager

StartUp-Manager is a program to configure GRUB, Splash and Splashy.It was originally an Ubuntu project, but was later adapted to Debian.It is already included in the Ubuntu repositories....
 is a program that can edit many GRUB options.

KGRUBEditor is a system GUI
Gui

Gui or guee is a generic term to refer to grillinged dishes in Korean cuisine. These most commonly have meat or fish as their primary ingredient, but may in some cases also comprise grilled vegetables or other vegetarian ingredients....
 tool to view and edit the GRUB boot loader, written in the KDE
KDE

KDE is a free software project based around its flagship product, a desktop environment for Unix-like systems. The goal of the project is to provide basic desktop functions and applications for daily needs as well as tools and documentation for developers to write stand-alone applications for the system....
4 libraries.

Grub Conf is a GNOME
Gnome

A gnome is a mythical creature characterized by its extremely small size and wiktionary:subterranean lifestyle. The word gnome is derived from the New Latin gnomus....
2 based GRUB configuration editor.

grub-choose-default controls the default entry in menu.lst, through a Python
Python (programming language)

Python is a general-purpose high-level programming language. Its design philosophy emphasizes code readability. Python's core syntax and semantics are Minimalism , while the standard library is large and comprehensive....
 GUI. Under Windows if you are running ext2
Ext2

The ext2 or second extended filesystem is a file system for the Linux kernel . It was initially designed by R?my Card as a replacement for the extended file system ....
/3
Ext3

The ext3 or third extended filesystem is a journaling file system that is commonly used by the Linux operating system. It is the default file system for many popular Linux distributions....
, then you can use Ext2IFS

GrubEd is a script
Script

dablink|For computer scripts that can be used with Wikipedia, see...
 which gives users a nice GUI to alter their grub settings at the touch of (a few) buttons.

Utilities

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

See also

  • Comparison of boot loaders
    Comparison of boot loaders

    The following tables compare general and technical information for a number of available bootloaders....
  • bootman
    Bootman

    bootman is the BeOS boot loader on x86 systems. It resides solely in the master boot record and does not require installing BeOS, although it must be installed from BeOS....
  • Das U-Boot
    Das U-Boot

    Das U-Boot is a Booting#Boot loader for a number of different computer architectures, including PowerPC, ARM architecture, AVR32, MIPS architecture, x86 architecture, 68k, Nios embedded processor, and MicroBlaze....
     Universal Bootloader
  • EasyBCD
    EasyBCD

    EasyBCD is a free program developed by the non-profit NeoSmart Technologies used to configure and tweak the new Windows Vista Bootloader. EasyBCD can be used to set up dual-boots between Windows Vista and previous versions of Windows, along with Linux, BSD, and Mac OS X....
  • elilo
    Elilo

    elilo is the standard Linux boot loader for Extensible Firmware Interface PC hardware. It was originally developed for IA-64 systems made by Hewlett Packard, but also works on standard Intel IA-32 hardware with EFI support....
  • GRLDR
  • LILO
    LILO (boot loader)

    LILO is a generic boot loader for Linux....
  • Ncurses
    Ncurses

    ncurses is a programming library providing an application programming interface, allowing the programmer to write text user interfaces in a terminal-independent manner....
     and Ncurses package for Windows in GnuWin32
    GnuWin32

    The GnuWin32 project provides native Porting in the form of runnable computer programs, patches, and source code for various GNU and open source tools and software, much of it modified to run on the 32-bit Microsoft Windows platform....
  • NTLDR
    NTLDR

    NTLDR is the Booting for all releases of Microsoft's Windows NT operating system up to and including Windows XP and Windows Server 2003. NTLDR is typically run from the primary hard disk drive, but it can also run from portable storage devices such as a CD-ROM, USB flash drive, or floppy disk....
  • SILO
    SILO (boot loader)

    The SPARC Improved bootLOader is the bootloader used by the SPARC port of the Linux operating system; it can also be used for Solaris as a replacement for the standard Solaris boot loader....
  • BCD
    Windows Vista Startup Process

    The startup process of Microsoft's Windows Vista and Windows Server 2008 operating systems is slightly different from previous versions....
  • xOSL
    XOSL

    xOSL is the name of a bootloader, which is a program product class that launches operating systems from a bootable device such as a hard disk or floppy drive....
     Extended Operating System Loader


External links

  • Documentation for forks:
    • , , , and
  • .
  • , Linux Journal
    Linux Journal

    Linux Journal is a monthly technology magazine published by Belltown Media, Inc. of Houston, Texas. The magazine focuses specifically on Linux, allowing the content to be a highly specialized source of information for open source enthusiasts....
     - A good tutorial