What does GRUB2 do and where is its configuration?
BeginnerConceptBoot Process & Kernel
Answer
In one line: GRUB2 is the bootloader — the program that shows the boot menu and loads the Linux kernel into memory.
What GRUB does:
- Shows a menu, so you can pick which kernel to boot (useful when a new kernel breaks and you need the old one).
- Loads the kernel and initramfs into memory.
- Passes kernel parameters (settings) to the kernel, such as
quietorconsole=ttyS0.
Where its configuration lives:
- Edit this file:
/etc/default/grub— simple settings like the timeout and kernel parameters. - Don't edit this file by hand:
/boot/grub2/grub.cfg(or/boot/grub/grub.cfg). It is generated automatically, and your changes would be overwritten.
Example — add a kernel parameter and apply it:
sudo vi /etc/default/grub
# change: GRUB_CMDLINE_LINUX="... quiet"
sudo update-grub # Ubuntu/Debian
sudo grub2-mkconfig -o /boot/grub2/grub.cfg # RHEL/CentOS/Rocky
Remember: edit /etc/default/grub, then regenerate the config. Changes apply on the next reboot.
More on Boot Process & Kernel
Walk through the Linux boot process from power-on to login prompt.BeginnerWhat is the difference between BIOS and UEFI booting?IntermediateWhat is the initramfs and why is it needed?AdvancedHow do you view and change kernel command-line parameters?IntermediateWhat is systemd and why did it replace SysV init?BeginnerWhat are systemd targets, and how do they map to old runlevels?Beginner