GNU GRUB (short for GNU GRand Unified Bootloader) is a boot loader package from the GNU Project. GRUB is the reference implementation of the 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[4]). 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.
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.[5] 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.[5]
Features
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.
Systems administrators can install a GRUB installation for any supported OS from any of the usual Unix-like operating systems, as well as using specific GRUB implementations for DOS and Windows.
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 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.[6]
- 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.
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 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 /boot/grub/grub.conf
or ../grub.cfg
. 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 that may not have or cannot boot from a hard disk.
Development
GRUB 1 (also known as "GRUB Legacy") is no longer under development and is being phased out.[7] The GNU GRUB developers have switched their focus to GRUB 2,[8] 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.
Three of the most widely used[9][10][11] Linux distributions use GRUB 2 as their mainstream boot loader:
Ubuntu adopted GRUB 2 as the default boot loader in its 9.10 version of October 2009.[12]
Fedora has been using GRUB 2 as its default boot loader since Fedora 16 released in November 2011.[13]
openSUSE adopted GRUB 2 as the default boot loader with its 12.2 release of September 2012.[14]
GNU GRUB version 2.00 was officially released on June 26, 2012.[1][15]
Variants
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).[16][17] The Syllable project made a modified version of GRUB to load the system from its AtheOS File System.[18]
Utilities
GRUB configuration tools
StartUp-Manager, a program used to configure GRUB
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.
For GRUB 2 there are KDE Control Modules.[19][20] GRLDR ICE is a tiny tool for modifying the default configuration of grldr file for GRUB4DOS.
Other utilities
GRUB Utilities is a collection of multi-platform utilities for GRUB Legacy, GRUB2 and GRUB for DOS.[21]
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 is developed for Debian-based Linux distributions[22] and will be included in the future versions of Ubuntu.[23]
See also
- Perbandingan -- boot loaders
- NTLDR
References
External links
|
---|
| History | | |
---|
| Licenses | |
---|
| Software | |
---|
| Public speakers | |
---|
| Other topics | |
---|
|