Import source
# rpm -import https://www.elrepo.org/RPM-GPG-KEY-elrepo.org
# RPM - Uvh http://www.elrepo.org/elrepo-release-7.0-2.el7.elrepo.noarch.rpm
Check out the KerNRL version
# yum --disablerepo="*" --enablerepo="elrepo-kernel" list availableLoaded plugins: fastestmirror, langpacks Loading mirror speeds from cached hostfile * elrepo-kernel: Syd.mirror.rackspace.com Available Packages elrepo-release.noarch 7.0-5.el7.elrepo elrepo-kernel kernel-lt.x86_64 4.4.241-1.el7.elrepo elrepo-kernel kernel-lt-devel.x86_64 4.4.241-1.el7.elrepo elrepo-kernel kernel-lt-doc.noarch 4.4.241-1.el7.elrepo elrebo-kernel kernel-lt-headers. X86_64 4.4.241-1.el7.elrepo elrebo-kernel kernel-lt-tools.x86_64 4.4.241-1.el7.elrepo elrepo-kernel kernel-lt-tools-libs.x86_64 4.4.241-1.el7.elrepo elrepo-kernel Kernel-lt-tools-libs-devel.x86_64 4.4.241-1.el7.elrepo elrepo-kernel kernel-ml-doc. Noarch 5.9.6-1.el7.elrepo Elrepo elrepo-kernel kernel-ml-tools.x86_64 5.9.6-1.el7.elrepo elrepo-kernel kernel-ml-tools.x86_64 5.9.6-1.el7.elrepo Elrepo elrepo-kernel kernel-ml-tools-libs-devel.x86_64 5.9.6-1.el7.elrepo elrepo-kernel kernel-ml-tools-libs-devel.x86_64 Elrepo elrepo-kernel perf.x86_64 5.9.6-1.el7.elrepo elrepo-kernel python-perf.x86_64 5.9.6-1.el7.elrepo elrepo-kernelCopy the code
Install the kernel
Lt (longterm) : 5.9.6 mainline (MAINline) lt(Longterm) : 5.9.6 Mainline (MAINline) LT (Longterm
# yum -y --enablerepo=elrepo-kernel install kernel-ml.x86_64 kernel-ml-devel.x86_64
The kernel has been installed successfully
[root@qd01-stop-k8s-node004 ~]# rpm -qa|grep kernelKernel headers - 3.10.0-957. El7. X86_64 kernel - tools - libs - 3.10.0-957. El7. X86_64 kernel - ml - devel - 5.9.6-1. El7. Elrepo. X86_64 The kernel - 3.10.0-957. El7. X86_64 abrt addon - kerneloops - 2.1.11-52. El7. Centos. X86_64 kernel - devel - 3.10.0-957. El7. X86_64 The kernel - tools - 3.10.0-957. El7. X86_64 kernel - ml - 5.9.6-1. El7. Elrepo. X86_64 Libreport - plugin - kerneloops - 2.1.11-42. El7. Centos. X86_64Copy the code
View and modify the boot order of GRUB
Change GRUB_DEFAULT=0
cat /etc/default/grub
GRUB_TIMEOUT=5
GRUB_DISTRIBUTOR="$(sed 's, release .*$,,g' /etc/system-release)"
GRUB_DEFAULT=0
GRUB_DISABLE_SUBMENU=true
GRUB_TERMINAL_OUTPUT="console"
GRUB_CMDLINE_LINUX="ipv6.disable=1 crashkernel=auto biosdevname=0 net.ifnames=0 rhgb quiet"
GRUB_DISABLE_RECOVERY="true"
Copy the code
Grub is generated to recreate the kernel configuration and reboot
# grub2-mkconfig -o /boot/grub2/grub.cfg
# reboot
Copy the code
Restart to confirm the kernel version
If you find that the system is not up after the restart.Congratulations on yourEnter the troubleshooting link here through the management network card, check the error as shown in the figure below
CentOS 7.6 cannot be restarted after being upgraded from kernel 3.10.0 to 5.x. The reason is that after Linux kernel 4.4.x, initramfs generated from dracut does not automatically load the MPt3SAS driver module by default. Because there is no corresponding driver, the system disk cannot be recognized, causing the kernel VMlinuz to fail to load its rootfs
Problem solving
1. Query the initramfs driver
# 3.10.0 lsinitrd - k - 957. El7. X86_64 | grep MPT [23] sasDRWXR xr - x 2 root root 0 Nov 2 20:22 usr/lib/modules / 3.10.0-957. The el7. X86_64 / kernel/drivers/SCSI/mpt3sas - rw - r - r - 1 root Root 92972 Nov 9 2018 usr/lib/modules / 3.10.0-957. The el7. X86_64 / kernel/drivers/SCSI/mpt3sas/mpt2sas ko. Xz# ls/usr/lib/modules / 5.9.6-1. El7. Elrepo. X86_64 / kernel/drivers/SCSI/mpt3sas/mpt3sas ko/ usr/lib/modules / 5.9.6-1. El7. Elrepo. X86_64 / kernel/drivers/SCSI/mpt3sas/mpt3sas ko As you can see in kernel 3.10, mpT2SAS was the driver. As you can see in kernel 5.x, the new kernel has upgraded mpT2SAS to MPt3SASCopy the code
2. Solution 1
A. Modify the /etc/dracut.conf file sed -i'/#add_drivers+=""/aadd_drivers+="mpt3sas"'Conf b. Generate initramfs again# cd /boot
# dracut -f /boot/initramfs-5.9.6-1.el7.elrepo.x86_64.img 5.9.6-1.el7.elrepo.x86_64C, check5.9.6 # lsinitrd - k - 1. El7. Elrepo. X86_64 | grep MPT [23] sasDRWXR xr - x 2 root root 0 Nov 9 length to usr/lib/modules / 5.9.6-1. El7. Elrepo. X86_64 / kernel/drivers/SCSI/mpt3sas - RWXR - r - 1 Root root 481320 Nov 9 length to usr/lib/modules / 5.9.6-1. El7. Elrepo. X86_64 / kernel/drivers/SCSI/mpt3sas/mpt3sas ko d, restart# reboot
Copy the code
3. Solution 2
Force load driver# dracut --force --add-drivers mpt3sas --kver=5.9.6
# reboot
Copy the code