centos7 switch boot kernel

1. View the current system kernel

uname -r

3.18.6-2.el7.centos.x86_64

View the list of available kernels

awk -F\' '$1=="menuentry " {print i++ " : " $2}' /etc/grub2.cfg

The result is as follows:

0 : CentOS Linux (3.18.6-2.el7.centos.x86_64) 7 (Core)1 : CentOS Linux (3.10.0-514.el7.x86_64) 7 (Core)2 : CentOS Linux (0-rescue-05653d304ed443db9b60529d6cf7d242) 7 (Core)

2. View the current default kernel startup items

grub2-editenv list

The result is as follows:

saved_entry=0

That is, the kernel loaded by default when the system is currently started is CentOS Linux (3.18.6-2.el7.centos.x86_64) 7 (Core)

3. Change the default startup kernel item

grub2-set-default 1

Check the default kernel boot entry again and find that the saved_entry field has changed to 1

4. Restart the system

reboot

View the current system kernel

uname -r

3.10.0-514.el7.x86_64

You can see that the kernel of the current system has been changed

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=325020586&siteId=291194637