CentOS/Grub

From Omnia
Jump to navigation Jump to search

CentOS 9

Generate Grub Config

grub2-mkconfig -o /etc/grub2.cfg
# OR
grub2-mkconfig -o /etc/grub2-efi.cfg
# OR
grub2-mkconfig -o /boot/grub2/grub.cfg
# OR
grub2-mkconfig -o "$(readlink -e /etc/grub2.cfg)"
# ls -la /etc/grub2.cfg
lrwxrwxrwx. 1 root root 22 Nov  4 07:47 /etc/grub2.cfg -> ../boot/grub2/grub.cfg
# ls -la /etc/grub2-efi.cfg
lrwxrwxrwx. 1 root root 22 Nov  4 07:47 /etc/grub2-efi.cfg -> ../boot/grub2/grub.cfg
# It is automatically generated by grub2-mkconfig using templates
# from /etc/grub.d and settings from /etc/default/grub

-

Note, I like this version: [1]

 grub2-mkconfig -o "$(readlink -e /etc/grub2.conf)"

better than this, because if the file doesn't exist, it will dump it to the screen, instead of creating a file

 grub2-mkconfig -o $(readlink -f /etc/grub2.conf)

Example

# grub2-mkconfig -o /etc/grub2.cfg
Generating grub configuration file ...
Adding boot menu entry for UEFI Firmware Settings ...
done
# grub2-mkconfig -o /etc/grub2-efi.cfg
Generating grub configuration file ...
Adding boot menu entry for UEFI Firmware Settings ...
done
# grub2-mkconfig -o /boot/grub2/grub.cfg
Generating grub configuration file ...
Adding boot menu entry for UEFI Firmware Settings ...
done

performance tweaks

/etc/default/grub

# vim grub
GRUB_TIMEOUT=60
GRUB_DEFAULT=saved
GRUB_DISABLE_SUBMENU=true
GRUB_TERMINAL_OUTPUT="console"

#GRUB_CMDLINE_LINUX="crashkernel=auto rhgb quiet splash selinux=0"

#GRUB_CMDLINE_LINUX="crashkernel=auto rhgb quiet splash intel_pstate=disable pcie_aspm.policy=performance pci=pcie_b
us_perf noibrs noibpb nopti nospectre_v2 nospectre_v1 l1tf=off nospec_store_bypass_disable no_stf_barrier mds=off mi
tigations=off intel_idle.max_cstate=0 idle=poll transparent_hugepage=never audit=0 selinux=0 nmi_watchdog=0 nohz=on
clocksource=tsc nosoftlockup mce=ignore_ce cpuidle.off=1 skew_tick=1 processor.max_cstate=0 acpi_irq_nobalance"

GRUB_CMDLINE_LINUX="crashkernel=auto rhgb quiet splash intel_pstate=disable pcie_aspm.policy=performance pci=pcie_bu
s_perf noibrs noibpb nopti nospectre_v2 nospectre_v1 l1tf=off nospec_store_bypass_disable no_stf_barrier mds=off mit
igations=off intel_idle.max_cstate=0 idle=poll transparent_hugepage=never audit=0 selinux=0"

GRUB_DISABLE_RECOVERY="true"

keywords