GNU GRUB facts for kids
![]() GNU GRUB logo
|
|
![]() GRUB v2 running in text mode
|
|
Original author(s) | Erich Boleyn |
---|---|
Developer(s) | GNU Project |
Initial release | 1995 |
Stable release | |
Preview release | |
Written in | Assembly, C |
Operating system | Linux, GNU/Hurd, macOS, BSD, (Solaris/ illumos (x86 port)), and Windows (through chainloading) |
Platform | IA-32, x86-64, IA-64, ARM, PowerPC, s390x, MIPS, RISC-V and SPARC |
Available in | English and others |
Type | Bootloader |
License | 2007: GPL-3.0-or-later 1999: GPL-2.0-or-later |
GNU GRUB (which stands for GNU GRand Unified Bootloader) is a special program that helps your computer start up. Think of it as a traffic controller for your computer's operating systems. It lets you choose which operating system you want to use if you have more than one installed. For example, you might have Windows and Linux on the same computer. GRUB helps you pick one when you turn on your machine.
GRUB was created by the GNU Project. It's mostly used with Unix-like systems, which include many versions of Linux.
Contents
How GRUB Works: Starting Your Computer
When you press the power button on your computer, a lot happens very quickly. First, your computer's BIOS (Basic Input/Output System) or UEFI (Unified Extensible Firmware Interface) wakes up. This is like the computer's brain turning on. It then looks for the main place to start, usually your hard drive.
The BIOS/UEFI then finds a tiny program called a boot loader on the hard drive. This boot loader is usually GRUB. Its job is to find your operating system and get it ready to run.
Understanding Boot Loaders
Boot loaders are special programs that help your computer start up. They are often split into smaller parts, or "stages," because the very first part needs to be tiny. This tiny part fits into a special area on your hard drive called the master boot record (MBR).
The MBR is like the very first page of a book. It's small, so it can only hold a few instructions. These instructions tell the computer where to find the next part of the boot loader.
GRUB is smart because it understands different file systems. This means it can find your operating system files by their names, just like you find files in folders on your computer. This makes it easier to update your system without breaking the boot process.
GRUB Versions: Legacy vs. GRUB 2
There are two main versions of GRUB:
- GRUB Legacy (version 0): This is an older version.
- GRUB 2: This is a completely new version, rewritten from scratch. Most modern Linux systems use GRUB 2.
How GRUB 2 Starts Up on Older Computers (BIOS)
1. A tiny part of GRUB 2, called `boot.img`, is stored in the MBR of your hard drive. 2. This `boot.img` then finds and loads the next part, `core.img`. 3. `core.img` is usually stored in a small empty space on the hard drive. 4. Finally, `core.img` loads the main GRUB program, which finds your operating systems and shows you a menu.
How GRUB 2 Starts Up on Newer Computers (UEFI)
Newer computers use UEFI instead of BIOS. For these systems, GRUB 2 works a bit differently: 1. A special GRUB file (`grubx64.efi`) is placed in a dedicated area called the EFI system partition. 2. The UEFI firmware directly starts this file. 3. This file then loads the rest of GRUB 2, which finds your operating systems and shows you the menu.
Choosing Your Operating System
After GRUB starts, it usually shows you a menu. This menu lists all the operating systems it found on your computer. You can use your keyboard to choose which one you want to start.
- Automatic Start: If you don't choose, GRUB can be set to automatically start a specific operating system after a few seconds.
- Editing Options: If you press the e key, you can change some settings for the selected operating system before it starts. This is useful if something is wrong and your system won't boot normally.
- Command Line: If you press the c key, you can go to a special GRUB command line. This is for advanced users to type commands directly to GRUB.
Once you've made your choice, GRUB loads the operating system into your computer's memory and hands over control.
Finding Partitions: Using UUIDs
Computers can have many hard drives or parts of hard drives (called partitions). It can be tricky for GRUB to always know which partition is which, especially if you move hard drives around.
To solve this, GRUB can use something called a Universally Unique Identifier (UUID). Think of a UUID as a unique serial number for each part of your hard drive. When a partition is formatted, it gets a UUID. This way, GRUB can always find the correct partition, no matter where it is connected.
GRUB uses a special file called `grub.cfg` to know how to start up. This file contains all the instructions for the menu and how to load different operating systems.
GRUB's Journey: A Brief History
GRUB was first created by Erich Boleyn in 1995. He was working on a new operating system called GNU Hurd. Later, in 1999, it became an official part of the GNU Project.
Over the years, GRUB has grown and improved. The developers decided to completely rewrite it, creating GRUB 2. This new version aimed to be cleaner, stronger, and work on more types of computers. GRUB 2 was officially released in 2012.
Many popular Linux systems, like Ubuntu, Fedora, and OpenSUSE, now use GRUB 2 as their main boot loader. Even the PlayStation 4 uses GRUB 2!
Different Kinds of GRUB (Variants)
Because GRUB is free software, people can change and adapt it. Here are a few interesting versions:
- OpenSolaris GRUB: A version of GRUB Legacy that works with the OpenSolaris operating system, including special features like booting from ZFS file systems.
- TrustedGRUB: This version adds extra security features. It helps make sure your computer's startup process hasn't been tampered with.
- GRUB4DOS: This is a version of GRUB that works well with DOS and Microsoft Windows. It makes it easier to install GRUB on these systems.
Helpful Tools for GRUB
There are many tools that make working with GRUB easier:
GRUB Configuration Tools
These programs help you change GRUB's settings without needing to type complex commands. Some popular ones include:
- StartUp-Manager: An older graphical tool for Debian-based systems.
- GRUB Customizer: A popular graphical tool for Debian and Arch-based systems that lets you easily change GRUB's menu, colors, and other settings.
Boot Repair Tools
Sometimes, your computer might have trouble starting up. Boot-Repair is a simple tool that can fix common problems with GRUB and Windows boot loaders. It's free to use and works with many Linux systems.
GRUB Installer for Windows
Grub2Win is a free program for Windows. It lets you install GRUB 2 on your Windows computer. You can then use a simple Windows program to set up your GRUB menu, choose themes, and even boot multiple operating systems like Windows and Linux.
Other Ways to Start Your Computer
While GRUB is very popular because it works with many different computer types and operating systems, there are other boot managers too:
- rEFInd: This is a graphical boot manager that looks a bit like the startup screen on a Macintosh computer. It only works on newer computers that use UEFI.
- systemd-boot: This is a simple, text-based boot manager that is very fast. It also only works on UEFI-based computers.
See also
In Spanish: GNU GRUB para niños