Linux changes the kernel startup sequence
1. Modify the kernel startup sequence of RHEL6/CentOS6
Check the /etc/grub.conf file to determine the system kernel status. According to the document, there are two kernel versions in the system, namely 2.6.32-573.18.1.el6.x86_64 and 2.6.32-431.23.3.el6.x86_64. Kernel versions are listed from top to bottom.
In the grub.conf file, you can decide which kernel version to use when the system starts by adjusting the default parameters. The default value is 0, which means the system will boot the latest kernel version. A value of 0 corresponds to the first kernel version listed in the grub.conf file, and so on. By changing the default value, you can easily switch the kernel version used when the system starts, ensuring that the system can start and run normally. This setting is very useful for system maintenance and troubleshooting, allowing the flexibility to adjust the kernel version as needed to meet the needs of the system. It should be noted that when modifying the grub.conf file
2. Modify the kernel startup sequence of RHEL7/CentOS7
1. Execute the following command to check how many cores there are in the system.
/boot/grub2/grub.cfg #(non-UEFI configurations) Note: Non-UEFI mode execution
/boot/efi/EFI/redhat/grub.cfg #(UEFI configurations)Note: UEFI mode execution
cat /boot/grub2/grub.cfg |grep menuentry
cat /boot/efi/EFI/redhat/grub.cfg |grep menuentry
2. Refer to the following command to configure booting from the default kernel. The kernel name is replaced based on the actual name found within the system. grub2-set-default 0
grub2-set-default “CentOS Linux (3.10.0-123.9.3.el7.x86_64) 7 (Core)”
grub2-set-default ‘Red Hat Enterprise Linux Server (3.10.0-1160.el7.x86_64) 7.9 (Maipo)’
3. Execute the following command to confirm that the configuration is successful.
grub2-editenv list
3. Modify the kernel startup sequence of centos8
1. View the default kernel
grubby –default-kernel
2. View all cores
grubby –info=ALL
3. Modify the default startup kernel
grubby –set-default /boot/vmlinuz-4.18.0-80.11.2.el8_0.x86_64
4. Ubuntu changes the kernel startup sequence
1. Check the startup sequence of the current kernel
cat /boot/grub/grub.cfg |grep menuentry
2. Modify grub file
Assuming that you want to modify the kernel startup to 3.13.0-166, modify the file /etc/default/grub
$
sudo vim /etc/default/grub
GRUB_DEFAULT=0 ##Modify to
GRUB_DEFAULT=”Advanced options for Ubuntu>Ubuntu, with Linux 4.4.0-31-generic”
3. Update the modified grub
update-grub
The above is the detailed content of Modify Linux kernel startup sequence. For more information, please follow other related articles on the PHP Chinese website!