grub2 and grubby on TencentOS Server to manage kernel boot entries, including viewing the current boot configuration, modifying the default boot kernel, and adjusting kernel boot parameters.Tool | Applicable Versions | Description |
grubby | TencentOS Server 3 / 4 | fedora community tool, recommended for use |
grub2-* | TencentOS Server 2 | Native GRUB 2 command |
grubby for kernel boot configuration.grubby --default-kernel
/boot/vmlinuz-5.4.241-24.0017.41.3
grubby --info=ALL
index=0kernel="/boot/vmlinuz-5.4.241-24.0017.28"args="ro quiet elevator=noop console=ttyS0,115200 console=tty0 vconsole.keymap=us crashkernel=3G-16G:256M,16G-64G:384M,64G-128G:512M,128G-486G:768M,486G-972G:1024M,972G-:2048M vconsole.font=latarcyrheb-sun16 net.ifnames=0 biosdevname=0 intel_idle.max_cstate=1 intel_pstate=disable iommu=pt amd_iommu=on nopvspin"root="UUID=1cdbeeff-b545-47c3-8442-9038c7ad903b"initrd="/boot/initramfs-5.4.241-24.0017.28.img"title="TencentOS Server (5.4.241-24.0017.28) 3.3 (Final)"id="30e472194cb8417c88b24ec0b1915e7f-5.4.241-24.0017.28"
grubby --info=/boot/vmlinuz-\\<version> #Example version: 5.4.241-24.0017.28
grubby --info=$(grubby --default-kernel)
grubby --set-default /boot/vmlinuz-\\<version> #Example version: 5.4.241-24.0017.28
5.4.241-24.0017.28 as the default kernel as an example:grubby --set-default /boot/vmlinuz-5.4.241-24.0017.28
The default is /boot/loader/entries/30e472194cb8417c88b24ec0b1915e7f-5.4.241-24.0017.28.conf with index 0 and kernel /boot/vmlinuz-5.4.241-24.0017.28
grubby --update-kernel=$(grubby --default-kernel) --args="\\<parameter>"
grubby --update-kernel=$(grubby --default-kernel) --args="debug"
grubby --update-kernel=ALL --args="\\<parameter>"
grubby --update-kernel=$(grubby --default-kernel) --remove-args="\\<parameter>"
grubby --update-kernel=$(grubby --default-kernel) --remove-args="quiet"
grub2-editenv list
saved_entry=TencentOS Server (5.4.119-19.0009.67.1) 2.4
awk -F\\' '$1=="menuentry " {print i++ " : " $2}' /boot/grub2/grub.cfg
0 : TencentOS Server (5.4.119-19.0009.67.1) 2.41 : TencentOS Server (5.4.120-19.0009.67.1) 2.4 #This version does not exist and is for demonstration only.
grub2-set-default <index>
grub2-editenv list
grubby --default-kernel
uname -r
grub2-set-default was used, but the GRUB configuration file was not updated.grubgrub2-mkconfig -o /boot/grub2/grub.cfg
grubby --default-kernel
grub2-reboot to specify the kernel for the next boot:grub2-reboot \\<kernel title or index>
grubby --info=ALL | grep index
Esc or Shift key).e to enter edit mode.linux and manually delete the incorrect parameters.Ctrl+X to boot the system.grubby --update-kernel to repair the configuration.フィードバック