GRUB in text mode
|Stable release||2.00 (GRUB 2) / June 27, 2012|
|Preview release||2.00~rc1 (GRUB 2) / June 23, 2012|
|Written in||Assembly, C|
|Operating system||Linux, Mac OS, Solaris and Windows|
|Platform||IA-32, x86-64, PowerPC|
|Available in||English and others|
GNU GRUB (short for GNU GRand Unified Bootloader) is a boot loader package from the GNU Project. GRUB is the reference implementation of the Free Software Foundation's Multiboot Specification, which provides a user the choice to boot one of multiple operating systems installed on a computer or select a specific kernel configuration available on a particular operating system's partitions.
GNU GRUB was developed from a package called the Grand Unified Bootloader (a play on Grand Unified Theory). It is predominantly used for Unix-like systems. The GNU operating system uses GNU GRUB as its boot loader, as do most Linux distributions. The Solaris operating system has used GRUB as its boot loader on x86 systems, starting with the Solaris 10 1/06 release.
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.
Users can dynamically configure the GRUB sub-system. GRUB 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 on the fly, in addition to the normal menu lists.
GRUB is highly portable. It supports multiple executable formats and is geometry-translation independent. GRUB supports all commonly used Unix file systems, the Windows file systems VFAT and NTFS, and logical block addressing (LBA). 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. A modification of GRUB's text interface can use a serial link so that a remote terminal can have access to the boot loader.
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 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.
GRUB supports operating systems that do not multi-boot, by using chain loading. GRUB uses the same two or three lines of command sequences to boot any DOS, Windows, Linux, BSD or Solaris system, making it very easy to work with it. The chain loaders for the supported Unix-like OSes are built into GRUB.
In addition to the normal menu interface, GRUB can provide a bash-like terminal command-prompt that provides a rich set of commands to allow a user to view or alter any part of the boot process. With these tools one can, without prior knowledge of what is installed on a computer, use GRUB from an external device such as a floppy disk, USB device or a CD-ROM to boot up an installed operating system.
||This article may be confusing or unclear to readers. (January 2011)|
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 the bootstrap code.
There are two versions of GRUB in common use. GRUB version 2 is now used by most distributions. GRUB version 1 is still fairly prevalent in older -- but still supported -- releases, e.g., Ubuntu 10.04, CentOS 5. These are not to be confused with Stage 1 and 2. Stage 1 is an executable program that loads stage 2, a larger executable program. There can be an intermediate Stage 1.5.
GRUB version 1
The MBR usually contains GRUB stage 1, but can contain another bootloader which can chain boot GRUB stage 1 from another boot sector such as a partition's volume boot record. Given the small size of a boot sector, Stage 1 can do little more than load the next stage of GRUB by loading a few disk sectors from a fixed location near the start of the disk (within 1024 cylinders).
Stage 1 can load Stage 2 directly, but it is normally set up to load Stage 1.5. GRUB Stage 1.5 is located in the first 30 kilobytes of hard disk immediately following the MBR and before the first partition. If this space is not available (Unusual partition table, special disk drivers, GPT or LVM disk) the install of Stage 1.5 will fail. The stage 1.5 image contains filesystem specific drivers. This enables stage 1.5 to directly load stage 2 from a known location in the filesystem, for example from /boot/grub. Stage 2 will then load the default configuration file and any other modules needed.
GRUB version 2
This is very similar to GRUB version 1: boot.img is stored in the MBR or volume boot record like Stage 1; however, it can load one sector from any LBA48 address. This loads the first sector of core.img (generated from diskboot.img) which is then used to load the rest of the generated core.img file. The core.img file will normally be stored in the same location as Stage 1.5 with the same problems; however, it can be moved to a file system or bare partition with fewer problems than moving or omitting Stage 1.5.
Once loaded, the core.img file will then load the default configuration file and any other modules needed.
After loading GRUB, but before the operating system starts
Once GRUB has loaded, 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.
Perhaps the most important commands that GRUB accepts in the operating system selection (kernel selection) menu are the following two commands.
- By pressing 'e', it is possible to edit parameters for the selected operating system before the operating system is started. Typically, this is used for changing kernel parameters for a Linux system. The reason for doing this in GRUB (i.e. not editing the parameters in an already booted system) can be an emergency case: the system has failed to boot. Using the kernel parameters line it is possible, among other things, to specify a module to be disabled (blacklisted) for the kernel. This could be needed, if the specific kernel module is broken and thus prevents boot-up. Example for blacklisting a kernel module "nvidia-current": append "modprobe.blacklist=nvidia-current" at the end of the kernel parameters.
- By pressing 'c', the user enters the GRUB command line. This is not a regular Linux shell. It accepts certain GRUB-specific commands.
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 or are not supported directly by GRUB. 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.
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 Linux Loader (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 openSUSE and (for GRUB 1) in Debian GNU/Linux the file is stored in
/boot/grub/menu.lst while Fedora, Gentoo Linux, and (for GRUB 2) Debian use
../grub.cfg. Fedora also provides a symbolic link from
/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 that may not have or cannot boot from a hard disk.
GRUB 1 (also known as "GRUB Legacy") is no longer under development and is being phased out. The GNU 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 GRUB 2 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.
OpenSolaris includes a modified GRUB Legacy that supports BSD disklabels, automatic 64-bit kernel selection, and booting from ZFS (with compression and multiple boot environments). The Syllable project made a modified version of GRUB to load the system from its AtheOS File System.
GRUB configuration tools
The setup tools in use by various distributions often include modules to set up GRUB: for example, YaST2 on SUSE/openSUSE distributions and Anaconda on Fedora/RHEL distributions. StartUp-Manager is a graphical configuration editor for Debian based distributions of GRUB.
||It has been suggested that Boot Repair Disk be merged into this article. (Discuss) Proposed since April 2013.|
GRUB Utilities is a collection of multi-platform utilities for GRUB Legacy, GRUB 2 and GRUB for DOS.
Boot-Repair is a simple graphical tool for recovering from frequent boot-related problems with GRUB and Microsoft Windows bootloader. This application is available under GNU GPL license. Boot-Repair can repair GRUB on multiple Linux distributions including, but not limited to, Debian, Ubuntu, Mint, Fedora, openSUSE, and Arch Linux and will be included in the future versions of Ubuntu.
- Vladimir 'φ-coder/phcoder' Serbinenko (28 Jun 2012). "GRUB 2.00 released". grub-devel mailing list. http://lists.gnu.org/archive/html/grub-devel/2012-06/msg00093.html. Retrieved 1 December, 2012.
- "Ohloh Analysis Summary – GNU GRUB". Ohloh. Retrieved 2010-05-12.
- EnterpriseLinux.com Definitions Definition of GRand Unified Bootloader
- GRUB Manual – 1.2 Grub History. Gnu.org (2012-06-23). Retrieved on 2012-12-01.
- Kernel modules – ArchWiki. Wiki.archlinux.org (2012-11-11). Retrieved on 2012-12-01.
- Gnu Grub – Grub Legacy. Gnu.org. Retrieved on 2012-12-01.
- GNU GRUB – GRUB 2. Hosted on wayback machine.
- Haddon, Tom (26 January 2012). "An Introduction to Ubuntu". WebJunction. Retrieved 21 September 2012.
- Janssen, Cory. "What is Red Hat Enterprise Linux (RHEL)?". Technopedia. Retrieved 21 September 2012.
- Varghese, Sam (2012-09-20). "SUSE chief lists progress since privatisation". Retrieved 21 September 2012.
- "9.10 Karmic GRUB version". Distrowatch.com. Retrieved 8 July 2012.
- GRUB 2. FedoraProject. Retrieved on 2012-12-01.
- openSUSE:Upcoming features – openSUSE. En.opensuse.org. Retrieved on 2012-12-01.
- Larabel, Michael. "GRUB 2.00 Boot-Loader Officially Released". Phoronix.com. Retrieved 28 June 2012.
- x86: Modifying Boot Behavior by Editing the GRUB Menu at Boot Time, Modifying Solaris Boot Behavior on x86 Based Systems (Task Map) – System Administration Guide: Basic Administration
- x86: Supported GRUB Implementations, (System Administration Guide: Basic Administration) – Sun Microsystems
- 2.3 Why does Syllable have its own version of GRUB?, Syllable Documentation
- GRUB2 Bootloader Editor. Kde-apps.org (2012-06-18). Retrieved on 2012-12-01.
- Grub2 KCM Retrieved 2011-01-27
- GRUB Utilities – Summary. Gna.org. Retrieved on 2012-12-01.
- Official Boot-Repair website. Sourceforge.net (2011-08-11). Retrieved on 2012-12-01.
- .Boot-Repair on Ubuntu Community Help Wiki. Help.ubuntu.com (2012-11-15). Retrieved on 2012-12-01.
|Wikimedia Commons has media related to: GNU GRUB|
- 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.
- Official GNU GRUB project
- Documentation for forks: