Remember a centos 7 kernel upgrade accident

scene##

The company did a wait-for-guarantee 3 evaluation, and found that there were vulnerabilities in the kernel during system vulnerability detection and needed to be upgraded.

Name Version
Kernel before upgrade CentOS Linux (3.10.0-327.el7.x86_64) 7 (Core)
Kernel after upgrade CentOS Linux (3.10.0-957.1.3.el7.x86_64) 7 (Core)

Correct operation process##

Upgrade method###

The upgrade method is very simple. Find the kernel rpm package of the corresponding version, and then directly use yum or rpm to install it. In this process, you may need to deal with some dependencies between packages.

$ yum install -y kernel-3.10.0-957.1.3.el7.x86_64.rpm kernel-headers-3.10.0-957.el7.x86_64.rpm kernel-tools-3.10.0-957.1.3.el7.x86_64.rpm kernel-tools-libs-3.10.0-957.1.3.el7.x86_64.rpm

Effective new version of the kernel###

After installing the new version of the kernel, you must do the following, otherwise you will step on the pit when restarting the server like me.

**The purpose of the next operation is to change the version of the kernel loaded when the server starts up through grub! **

The kernel upgrade is now complete.

accident##

Since there is a correct operation process, sometimes it is often accidental to make some mistakes. Because it was the first time I did a kernel upgrade, I stepped on the hole smoothly. Please look down for the exciting process:

Restart###

After the new version of the kernel is installed, the server needs to be restarted to take effect. The first operation is handled as an ordinary rpm package upgrade. After the installation is complete, init 6 will be executed to restart the server. The result is sad, as shown below:

I stuck here and didn’t move. I didn’t report an error after seeing the prompt. I just press Enter. As a result, the following scene appears:

Cannot find the corresponding version of the kernel! ! !

WTF!!!

Solve the problem###

After careful analysis, the prompt message says that the "3.10.0-327.el7.x86_64" version of the kernel cannot be found. In that case, let Baidu (google)! Keywords "centos 7 kernel upgrade and restart can not find the kernel", find the following articles:

After reading the first and second documents, I probably understand the principle of repair, that is, modify the kernel boot sequence. The reinstallation of the original system kernel in the first article is of little significance to this kernel upgrade, but the second is a reminder I am a core-everything in the linux system is a file!

Since it is possible to change the kernel boot sequence through the grub command line before the server crashes, you can definitely enter the grub modification or other methods through the rescue mode after the crash.

Problem recurrence###

Because it was the first time I encountered this kind of problem, I had a virtual machine on hand, so I reproduced the error scene with the mentality of trying it out, restarted the virtual machine and came to the kernel selection interface:

Tip: "e" edit the currently selected item! Anyway, it is the virtual machine, just do it casually, and enter the editing state decisively:

The kernel information just appeared, and I was so happy, why not try to change the system version information here, and then continue to read:

Just change it all in one go, and the big deal is to reinstall the system (provided that the current server does not deploy particularly important services, otherwise you still have to be more rigorous). Change the information in the red box in the picture above to the new version "3.10.0-957.1.3.el7.x86_64", and then Ctrl-x to enter the system loading interface, instantly feeling relieved.

Wait for the system startup to complete, log in and check the status, everything is normal! ! !

Real knowledge from practice! ! ! (PS: It's okay, don't mess around, you must study hard before doing it!!!)

Post a document with B! ! !

( adsbygoogle = window.adsbygoogle || []).push({});

Recommended Posts

Remember a centos 7 kernel upgrade accident
Centos7 upgrade kernel
CentOS7.5-1804 system kernel upgrade
CentOS6.5 upgrade kernel to 3.10.28
Centos kernel version upgrade
Three methods of Centos kernel upgrade
Linux: Centos7 upgrade the original kernel
CentOS7 upgrade python3
centos6.9 rabbitmq 3.6.8 upgrade 3.8.2
Remember a case of CentOS OOM memory overflow
Centos 6.4 python 2.6 upgrade to 2.7
Centos kernel compilation configuration
A centos initialization script
Centos7 delete useless kernel
Centos delete redundant kernel
Centos default python2.6 upgrade to
CentOS upgrade python2 to pyth
Debug Kernel Panic in Centos
centos6.5: gcc upgrade (5.2.0) process record