Debug Kernel Panic in Centos

When you face a new machine and have to compile a kernel yourself for some reason (not to be idle), you will encounter a kernel panic.

Kernel panic is very annoying, panic at startup is even more annoying. Panic without any log is particularly annoying without the hard disk.

Provide several fooling methods to solve the problem: (The following content is for the redhat system, but most of the methods are general)

Determine the link that caused panic####

Briefly describe the startup process:

1 Power On                                 Maybe Err:Worlds Collides
2 BIOS                                     Maybe Err:Worlds Collides
3 Load Grub From MBR                       Maybe Err:See nothing
4 load Grub and show it                    Maybe Err:Grub loads failed
5 Grub reads menu.list                     Maybe Err:Grub loads failed
6 Grub loads kernel image                  Maybe Err:Grub loads failed
7 kernel mounts root filesystem            Maybe Err:PANIC
8 kernel runs init                         Maybe Err:PANIC
9 init runs scripts to start               Maybe Err:PANIC

First of all, you have to confirm which link caused the panic. If your log is relatively complete, you can generally judge the problem caused by the link above based on clues. Generally panic occurs in step7, step8, and step9 links.

The following provides some tricks for step7 and step8 panic

Add debugging switch to the kernel parameter, turn off ACPI, selinux

1234 title CentOS (2.6.32-358.el6.x86_64) root (hd0,0) kernel /vmlinuz-2.6.32-358.el6.x86_64 ro root=/dev/mapper/vg_localhost-lv_root rd_NO_LUKS rd_NO_MD rd_LVM_LV=vg_localhost/lv_swap crashkernel=128M LANG=zh_CN.UTF-8 rd_LVM_LV=vg_localhost/lv_root KEYBOARDTYPE=pc KEYTABLE=us rd_NO_DM debug selinux=0 acpi=0 initrd /initramfs-2.6.32-358.el6.x86_64.img

This is the time to test the character, no matter what the situation is, the most likely problem is eliminated first. In addition, the redhat system will add parameters such as rhgb quiet to the end of the kernel, and remove them all. When booting up, stare at the screen to see if there is any suspicious output. Because the system may output a large number of logs in a short period of time without recording, you need to set the log output rate and pause timing. More detailed parameters can be found here:

https://wiki.archlinux.org/index.php/Boot_debugging

Add the dracut debugging switch to the kernel parameter####

In the later stage of the redhat system, dracut was used to build the initrd image. The manual about dracut is here:

http://people.redhat.com/harald/dracut-rhel6.html#lsinitrd

The debug switch is here:

https://fedoraproject.org/wiki/How_to_debug_Dracut_problems

You can set rdshell, jump into the shell provided by dracut after panic, and type dmesg to see the log information.

In the end, I really don’t know why, and you are very idle, you can consider adding serial device debugging when starting

Some tooltip

http://free-electrons.com/blog/find-root-device/

Other references:

http://www.tuxradar.com/content/how-fix-linux-boot-problems

Recommended Posts

Debug Kernel Panic in Centos
Centos7 upgrade kernel
CentOS7.5-1804 system kernel upgrade
Install MySQL5.7 in centos7
Install php in centos
Centos kernel compilation configuration
CentOS6.5 upgrade kernel to 3.10.28
Centos kernel version upgrade
Build Hadoop in CentOS
KVM virtualization in centos
Centos7 delete useless kernel
Centos delete redundant kernel
Build zabbix monitoring zabbix4.2 in CentOS7.6
Centos network settings in virtualbox
Update gcc to 6.4.0 in centos
Install JDK8 in rpm on CentOS7
Minimal install JDK 1.8 tutorial in CentOS 7
Detailed use of nmcli in CentOS8
Three methods of Centos kernel upgrade
Install MySql with Docker in CentOS7
Install Percona Server database (in CentOS 8)
Install java in yum mode in Centos
Linux: Centos7 upgrade the original kernel
How to install HDP2.6 in Centos7.2
Install Centos7 operating system in Docker
Remember a centos 7 kernel upgrade accident
Install and configure FreeIPA in Centos7
Build Yum private warehouse in Centos7.3
Tomcat configuration JMX in centos 6.5 environment