GRUB - Grand Unified Boot Loader
GRUB's responsibility in the boot process
GRUB2 Installation
There may come a time where you need to install or reinstall GRUB2 on a system. Depending on whether your system is booting via BIOS or UEFI, you'll need to use a slightly different method;
-
BIOS
The below command can be used to install GRUB2 on a BIOS system (using MBR disks format)
grub2-install [options] /dev/sdXOption Function --modules modulenames Reload specified kernel modules
--install-modules modulenamess Install only the specified modules and dependencies. - UEFI
GRUBGRUB2 Configuration Options
There are 2 directories to note when talking about GRUB;GRUB2;
/etc/grub - This directory stores configuration scripts that define boot entries for GRUB2.
/boot/grub - This directory stores the actual GRUB2 configuration files used during boot.
There are also 2 commands to note for GRUB configuration:
grubby
-
Function:
grubbyis a command-line tool that allows you to directly manipulate individual GRUB2 menu entries on your system. It provides functionalities for:- Setting the default boot entry
- Adding, removing, or modifying existing entries
- Changing boot order
- Viewing information about current entries
-
Focus:
grubbyoperates on individual boot entries within the existing GRUB2 configuration.
grub2-mkconfig
- Function:
grub2-mkconfig(or sometimes shortened toupdate-grubon some systems) is a utility used to regenerate the GRUB2 configuration file (grub.cfg) located in/boot/grub. It reads configuration scripts from the/etc/grub.ddirectory. - Focus:
grub2-mkconfigfocuses on rebuilding the entire GRUB2 configuration file based on the defined scripts. This ensures thegrub.cfgfile reflects any changes made to the configuration scripts in/etc/grub.d.