Phenomenon:
CentOS7 boot screen displays multiple kernel options
Reason:
Under normal circumstances, there are two startup items, one is "Normal startup" and the other is "Rescue mode Startup" (rescue).
If there are more than 2 startup items, the old kernel of the current system is not removed. The reason is that the old kernel is not automatically deleted after the CentOS update.
It starts with the new kernel by default, can be selected temporarily in the startup options, or you can modify the configuration permanent designation.
Example: Modifying the default boot kernel
[[email protected]~]# Uname-r# View current kernel version3.10.0-693.5.2.el7.x86_64[[email protected]~]# [[email protected]~]# cat/boot/grub2/grub.cfg|grep "Menuentry" # View all available kernelsMenuentry ' CentOS Linux (3.10.0-693.5.2.el7.x86_64) 7 (Core) '--class CentOS--class gnu-linux--class GNU--class os--unrestricted$menuentry _id_option ' Gnulinux-3.10.0-327.el7.x86_64-advanced-88ae7d3d-ffaf-4402-9d44-56b6845789e4 '{Menuentry ' CentOS Linux (3.10.0-327.el7.x86_64) 7 (Core) '--class CentOS--class gnu-linux--class GNU--class os--unrestricted$menuentry _id_option ' Gnulinux-3.10.0-327.el7.x86_64-advanced-88ae7d3d-ffaf-4402-9d44-56b6845789e4 '{Menuentry ' CentOS Linux (0-RESCUE-8405CDA22C0B421DB40478EDCF9C1FB2) 7 (Core) '--class CentOS--class gnu-linux--class GNU--class os--unrestricted$menuentry _id_option ' Gnulinux-0-rescue-8405cda22c0b421db40478edcf9c1fb2-advanced-88ae7d3d-ffaf-4402-9d44-56b6845789e4 '{[[email protected]~]# [[email protected]~]# Grub2-set-default' CentOS Linux (3.10.0-327.el7.x86_64) 7 (Core) '[[email protected]~]# [[email protected]~]# grub2-editenv List# View Kernel modification resultssaved_entry=CentosLinux(3.10.0-327.el7.x86_64)7(Core) [[email protected]~]#
Example: Removing a useless kernel
[[email protected]~]# Uname-r# View current kernel version3.10.0-693.5.2.el7.x86_64[[email protected]~]# [[email protected]~]# Rpm-qa|grepKERNEL-[0-9]# View all kernel packskernel-3.10.0-693.5.2.el7.x86_64kernel-3.10.0-327.el7.x86_64[[email protected]~]# [[email protected]~]# Yum Remove kernel-3.10.0-327.el7.x86_64# Delete The specified useless kernelLoadedPlugins:fastestmirror, LangPacksResolvingDependencies -Running transaction Check--->Package kernel.x86_64 0:3.10.0-327.el7 'll be erased -Finished Dependency ResolutionDependenciesresolved======================================================================================================= ====================================================== PackageArch Version Repository size= =============================================================================================================== =============================================removing:Kernelx86_64 3.10.0-327.EL7 @anaconda 136 MTransactionsummary======================================================================================================== =====================================================Remove1 packageinstalledsize:136 M isThis OK [y/n]: YDownloadingPackagesRunningTransaction checkRunningTransaction testTransactionTest succeededRunningTransactionErasing: kernel-3.10.0-327.el7.x86_64 1/1Verifying: kernel-3.10.0-327.el7.x86_64 1/1removed:kernel.x86_640:3.10.0-327.el7 Complete! [[email protected]~]# [[email protected]~]# Rpm-qa|grepKERNEL-[0-9]# View all kernel packskernel-3.10.0-693.5.2.el7.x86_64[[email protected]~]# [[email protected]~]# cat/boot/grub2/grub.cfg|grep "Menuentry"Menuentry ' CentOS Linux (3.10.0-693.5.2.el7.x86_64) 7 (Core) '--class CentOS--class gnu-linux--class GNU--class os--unrestricted$menuentry _id_option ' Gnulinux-3.10.0-327.el7.x86_64-advanced-88ae7d3d-ffaf-4402-9d44-56b6845789e4 '{Menuentry ' CentOS Linux (0-RESCUE-8405CDA22C0B421DB40478EDCF9C1FB2) 7 (Core) '--class CentOS--class gnu-linux--class GNU--class os--unrestricted$menuentry _id_option ' Gnulinux-0-rescue-8405cda22c0b421db40478edcf9c1fb2-advanced-88ae7d3d-ffaf-4402-9d44-56b6845789e4 '{[[email protected]~]#
Linux-Modify kernel boot order and delete useless kernel