CompTIA Linux+ (XK0-006)System ManagementEasy
A technician edited /etc/default/grub on a BIOS-based server to add a new kernel parameter. Which command must be run next to regenerate the actual boot loader configuration file so the change takes effect?
- Aupdate-initramfs -u
- Bgrub2-install /dev/sda
- Cgrub2-mkconfig -o /boot/grub2/grub.cfg
- Dsystemctl restart grub2
Show answer & explanationAnswer & explanation
Correct answer: C. grub2-mkconfig -o /boot/grub2/grub.cfg
Editing /etc/default/grub only changes the template used to build the real configuration. grub2-mkconfig reads that template plus /etc/grub.d/ scripts and writes the final grub.cfg that GRUB actually reads at boot.
Why the other options are wrong
- A. This rebuilds the initial RAM disk, not the GRUB configuration.
- B. This reinstalls the boot loader code to the MBR/disk, not needed for parameter changes.
- D. GRUB is not a systemd service that can be restarted this way.
GRUB2 Configuration Regeneration
/etc/default/grub holds user-editable settings that must be compiled into /boot/grub2/grub.cfg using grub2-mkconfig (or update-grub on Debian systems) before changes take effect.
- /etc/default/grub is the template file
- grub2-mkconfig -o writes the final grub.cfg
- Debian-based systems use update-grub as a wrapper
Memory trick: 'Default is just a draft, mkconfig makes it craft.'