Updating and applying default GRUB settings in CentOS 7

Revision history
Tags: centos, grub

I wanted to forcefully make systemd-fsck perform fsck on boot.

Make desired changes in /etc/default/grub or /etc/grub.d/40_custom. I appended fsck.mode=force fsck.repair=preen to the GRUB_CMDLINE_LINUX variable:

$ cat /etc/default/grub
GRUB_TIMEOUT=5
GRUB_DISTRIBUTOR="$(sed 's, release .*$,,g' /etc/system-release)"
GRUB_DEFAULT=saved
GRUB_DISABLE_SUBMENU=true
GRUB_TERMINAL_OUTPUT="console"
GRUB_CMDLINE_LINUX="crashkernel=auto rd.lvm.lv=centos_4/root rd.lvm.lv=centos_4/swap rhgb quiet fsck.mode=force fsck.repair=preen"
GRUB_DISABLE_RECOVERY="true"

Depending on your system, apply changes using

Output on my BIOS system:

$ sudo grub2-mkconfig -o /boot/grub2/grub.cfg
Generating grub configuration file ...
Found linux image: /boot/vmlinuz-3.10.0-957.5.1.el7.x86_64
Found initrd image: /boot/initramfs-3.10.0-957.5.1.el7.x86_64.img
Found linux image: /boot/vmlinuz-3.10.0-957.1.3.el7.x86_64
Found initrd image: /boot/initramfs-3.10.0-957.1.3.el7.x86_64.img
Found linux image: /boot/vmlinuz-3.10.0-862.14.4.el7.x86_64
Found initrd image: /boot/initramfs-3.10.0-862.14.4.el7.x86_64.img
Found linux image: /boot/vmlinuz-3.10.0-862.11.6.el7.x86_64
Found initrd image: /boot/initramfs-3.10.0-862.11.6.el7.x86_64.img
Found linux image: /boot/vmlinuz-3.10.0-862.el7.x86_64
Found initrd image: /boot/initramfs-3.10.0-862.el7.x86_64.img
Found linux image: /boot/vmlinuz-0-rescue-d46fbfa672984127815985c826ed7514
Found initrd image: /boot/initramfs-0-rescue-d46fbfa672984127815985c826ed7514.img
done

After a, hopefully, successful reboot, I’d want to remove these settings again.

References

If you have any comments or feedback, please send me an e-mail. (stig at stigok dotcom).

Did you find any typos, incorrect information, or have something to add? Then please propose a change to this post.

Creative Commons License This work is licensed under a Creative Commons Attribution-NonCommercial-ShareAlike 4.0 International License.