- What exactly is GRUB?
- 3 Answers 3
- What is GRUB in Linux?
- GRUB Features
- GRUB Installation Process
- GRUB Boot Process
- GRUB Interfaces
- Menu Interface
- Menu Entry Editor Interface
- Command Line Interface
- What Is a Boot Loader?
- Most Popular Linux Boot Loaders
- GRUB (GRand Unified Bootloader)
- LILO (Linux Loader)
- SYSLINUX
- Conclusion
- About the author
- David Morelo
What exactly is GRUB?
Can anyone explain me with fairly simple words and not too technical concepts what exactly is GRUB, what is its primary usage and how to use it efficiently for a dual boot Windows/Ubuntu installation? I have already read a couple of resources but I am still confused.
Welcome to askubuntu. I feel your question is too broad. I suggest you start here — en.wikipedia.org/wiki/Linux_startup_process . At the final step Ubuntu uses upstart , which is discussed here — en.wikipedia.org/wiki/Upstart . After reading those overviews, if you have a more specific question about UBUNTU then come back here. If it is about booting in general, the kernel, or general linux you will be referred to alternate sites such as stackexchange.
3 Answers 3
Basically, GRUB bootloader is the software that loads the Linux kernel. (It has other uses as well). It is the first software that starts at a system boot.
When the computer starts, BIOS first run a Power-on self-test (POST) to check hardware like memory, disk drives and that it works properly.
Then BIOS checks the Master Boot Record (MBR), which is a 512 byte section located first on the Hard Drive. It looks for a bootloader (like GRUB). The hard drive’s partition tables are also located here.
Then you’ll be prompted by the GRUB menu which can contain a list of the operating systems installed (in the case of dual boot), or perhaps the different kernels installed in a Linux distro.
When you choose which distro or kernel you want to use, GRUB loads the selected kernel. The kernel starts init (or systemd ), which is the first process to start in Linux. init then starts other processes like network services and other that you might have configured to start at boot time.
The boot process contains alot of defined expressions and terms, way to much to add in a simple answer like this. Google is your friend!
Remember that this is a very basic explanation of the boot process and GRUB’s role in it.
This youtube video provides a pretty nice introduction to the linux boot process, including basic information on the GRUB Bootloader:
What is GRUB in Linux?
The GRUB (Grand Unified Bootloader) is a bootloader available from the GNU project. A bootloader is very important as it is impossible to start an operating system without it. It is the first program which starts when the program is switched on. The bootloader transfers the control to the operating system kernel.
GRUB Features
GRUB is the default bootloader for many of the Linux distributions. This is because it is better than many of the previous versions of the bootloaders. Some of its features are:
- GRUB supports LBA (Logical Block Addressing Mode) which puts the addressing conversion used to find files into the firmware of the hard drive
- GRUB provides maximum flexibility in loading the operating systems with required options using a command based, pre-operating system environment.
- The booting options such as kernel parameters can be modified using the GRUB command line.
- There is no need to specify the physical location of the Linux kernel for GRUB. It only required the hard disk number, the partition number and file name of the kernel.
- GRUB can boot almost any operating system using the direct and chain loading boot methods.
GRUB Installation Process
GRUB automatically becomes the default loader after it is installed. The following steps are followed to install GRUB:
- It is important to use the latest GRUB package available to install GRUB. Or the GRUB package from the installation CD-ROM is used.
- The root shell prompt is opened and the command /sbin/grub-install is run after the GRUB package is installed. The in the command is the location where the GRUB stage 1 boot loader should be installed.
- After all this is done, the GRUB graphical boot loader menu appears before the kernel loads into memory when the system boots.
GRUB Boot Process
The boot process using GRUB requires the GRUB to load itself into memory. This is done in the following steps:
- The stage 1 boot loader is loaded into the memory by the BIOS. This boot loader is also known as the primary boot loader. It exists on 512 bytes or less of disk space within the master boot record. The primary boot loader can load the stage 1.5 or stage 2 boot loader if required.
- The stage 1.5 boot loader is loaded into the memory by the stage 1 boot loader if required. This may be necessary in some cases as some hardware require a middle step before moving on to the stage 2 loader.
- The secondary boot loader is also known as the stage 2 boot loader and it can be loaded into the memory by the primary boot loader. Display of the GRUB menu and command environment are functions performed by the secondary boot loader. This allows the user to look at system parameters and select the operating system to boot.
- The operating system or kernel is loaded into the memory by the secondary boot loader. After that, the control of the machine is transferred to the operating system.
GRUB Interfaces
There are three interfaces in GRUB which all provide different levels of functionality. The Linux kernel can be booted by the users with the help of these interfaces. Details about the interfaces are:
Menu Interface
The GRUB is configured by the installation program in the menu interface. It is the default interface available. It contains a list of the operating systems or kernels which is ordered by name. A specific operating system or kernel can be selected using the arrow keys and it can be booted using the enter key.
Menu Entry Editor Interface
The e key in the boot loader menu is used to access the menu entry editor. All the GRUB commands for the particular menu entry are displayed there and these commands may be altered before loading the operating system.
Command Line Interface
This interface is the most basic GRUB interface but it grants the most control to the user. Using the command line interface, any command can be executed by typing it and then pressing enter. This interface also features some advanced shell features.
What Is a Boot Loader?
Although boot loaders tend to be very small and relatively simple, they play a critical role in the boot process. Visit just about any Linux-related forum and the chances that you’ll come across at least a few people asking how to fix a problem with a boot loader are high. To avoid problems with boot loaders, it’s paramount to understand what role they play in the boot process and what the most popular Linux boot loaders are.
A boot loader is a program responsible for loading the Linux kernel with optional kernel parameters and the Linux initial RAM disk, known as initrd. Linux kernel is the core of the Linux operating system, and it starts the init (short for initialization) process, or an init replacement such as systemd, immediately after being loaded. The Linux initial RAM disk provides a temporary storage space for loading critical files into memory before the real root file system can be mounted.
On older computers with BIOS (Basic Input/Output System), a boot loader resides in the MBR (Master Boot Record), which occupies the first 512 bytes on a disk, but newer computers with UEFI (Unified Extensible Firmware Interface) store it in a special partition called EFI System Partition.
A boot loader is loaded by BIOS or UEFI after a successful POST (Power-On Self-Test), which is a self-test process performed immediately after a computer or other digital electronic device is powered on.
Most Popular Linux Boot Loaders
There are several boot loaders from which Linux users can choose.
GRUB (GRand Unified Bootloader)
GRUB is the most popular and the most feature-packed boot loader for the Linux operating system. It is based on the now obsolete GRUB Legacy, which was created in 1995 by Erich Boleyn for the operating system GNU/Hurd. GRUB supports both BIOS and UEFI, and it can handle all popular Linux file systems, including Btrfs, ext4, ReiserFS v3, VFAT, and XFS. Compared to GRUB Legacy, modern GRUB is cleaner, more powerful, and safer.
LILO (Linux Loader)
LILO once used to be the most popular Linux boot loader, but it has gradually fallen from grace because it lacked support for multi-boot environments. The development of LILO was stopped in December 2015, and the limited support for modern file systems and non-existing support for UEFI both reflect this reality.
SYSLINUX
SYSLINUX is a collection of several lightweight boot loaders that support most major file systems, including FAT for MS-DOS, and ext2, ext3, ext4 for Linux. SYSLINUX can also handle Btrfs and XFS but only with some restrictions. SYSLINUX is commonly used for booting live distributions of the Linux operating system. The original SYSLINUX can boot from floppy disks and USB drives, and ISOLINUX, which is part of the SYSLINUX Project, can boot from CD-ROM ISO 9660 filesystems.
Conclusion
A boot loader is a critical piece of software that’s responsible for loading the Linux kernel and the Linux initial RAM disk. Linux users can choose from several different boot loaders, each with its own strengths and weaknesses.
About the author
David Morelo
David Morelo is a professional content writer in the technology niche, covering everything from consumer products to emerging technologies and their cross-industry application