grub2 on CentOS 7

Do not attempt to manually edit /etc/grub2.cfg because it is automatically created from files within the /boot/ directory tree.

To change the grub menu, edit the /etc/default/grub file that defines the general settings and the /etc/grub.d/40_custom file to add specific custom entries.


# cat /etc/default/grub
GRUB_CMDLINE_LINUX="crashkernel=auto rhgb quiet"

After editing, run grub2-mkconfig

# grub2-mkconfig -o /boot/grub2/grub.cfg

On UEFI-based systems, the command will be:

# grub2-mkconfig -o /boot/efi/EFI/centos/grub.cfg

The menu entries are in:

To list all the menu entries:

# grep "^menuentry" /boot/grub2/grub.cfg | cut -d "'" -f2

To show the default:

# grub2-editenv list

The default entry is defined by the GRUB_DEFAULT
located in: /etc/default/grub

If the GRUB_DEFAULT line is set as saved, the parameter is stored in:

The /boot/grub2/grubenv file cannot be manually edited.
Use grub2-set-default to change the default.

# grub2-set-default 2

Reboot the system to boot to the new default.

To limit the list of Installed Kernels Permanent
Edit /etc/yum.conf
and change the entry in:


Published by

Ferdy Mañago

Portland, Oregon