CentOS/Grub: Difference between revisions

From Omnia
Jump to navigation Jump to search
(Created page with " grub2-mkconfig -o /boot/grub2/grub.cfg <pre> # grub2-mkconfig -o /boot/grub2/grub.cfg Generating grub configuration file ... Adding boot menu entry for UEFI Firmware Settings ... done </pre> performance tweaks /etc/default/grub <pre> # 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_pst...")
 
 
(5 intermediate revisions by the same user not shown)
Line 1: Line 1:
= 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
  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: <ref>https://unix.stackexchange.com/questions/152222/what-is-the-equivalent-of-update-grub-for-rhel-fedora-and-centos-systems</ref>
  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 ===
<pre>
# grub2-mkconfig -o /etc/grub2.cfg
Generating grub configuration file ...
Adding boot menu entry for UEFI Firmware Settings ...
done
</pre>
<pre>
# grub2-mkconfig -o /etc/grub2-efi.cfg
Generating grub configuration file ...
Adding boot menu entry for UEFI Firmware Settings ...
done
</pre>


<pre>
<pre>
Line 9: Line 50:
</pre>
</pre>


performance tweaks
<pre>
# grub2-mkconfig -o /etc/grub2-efi.cfg
Generating grub configuration file ...
Found Windows Boot Manager on /dev/sdb1@/efi/Microsoft/Boot/bootmgfw.efi
Found Ubuntu 24.04.1 LTS (24.04) on /dev/sdb5
Adding boot menu entry for UEFI Firmware Settings ...
done
</pre>
 
== Save Default Selection On Boot ==
 
Edit /etc/default/grub
<pre>
GRUB_TIMEOUT=60
GRUB_DEFAULT=saved
GRUB_SAVEDEFAULT=true
</pre>
 
Regenerate the configuration using
grub2-mkconfig -o /boot/grub2/grub.cfg
 
== performance tweaks ==
 
/etc/default/grub
/etc/default/grub
<pre>
<pre>
Line 15: Line 78:
GRUB_TIMEOUT=60
GRUB_TIMEOUT=60
GRUB_DEFAULT=saved
GRUB_DEFAULT=saved
GRUB_SAVEDEFAULT=true
GRUB_DISABLE_SUBMENU=true
GRUB_DISABLE_SUBMENU=true
GRUB_TERMINAL_OUTPUT="console"
GRUB_TERMINAL_OUTPUT="console"
Line 31: Line 95:
GRUB_DISABLE_RECOVERY="true"
GRUB_DISABLE_RECOVERY="true"
</pre>
</pre>
= keywords =

Latest revision as of 02:02, 27 January 2026

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
# grub2-mkconfig -o /etc/grub2-efi.cfg
Generating grub configuration file ...
Found Windows Boot Manager on /dev/sdb1@/efi/Microsoft/Boot/bootmgfw.efi
Found Ubuntu 24.04.1 LTS (24.04) on /dev/sdb5
Adding boot menu entry for UEFI Firmware Settings ...
done

Save Default Selection On Boot

Edit /etc/default/grub

GRUB_TIMEOUT=60
GRUB_DEFAULT=saved
GRUB_SAVEDEFAULT=true

Regenerate the configuration using

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

performance tweaks

/etc/default/grub

# vim grub
GRUB_TIMEOUT=60
GRUB_DEFAULT=saved
GRUB_SAVEDEFAULT=true
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