1. 程式人生 > >記一次Linux核心崩潰:kdump,crash,vmcore

記一次Linux核心崩潰:kdump,crash,vmcore

### 原理 Linux核心傳送崩潰時,kdump會生成一個核心轉儲檔案vmcore。 可以通過分析vmcore分析出核心崩潰的原因。 crash是一個被廣泛應用的核心奔潰轉儲檔案分析工具。使用crash除錯核心轉儲檔案,需要安裝crash工具和核心除錯工具kernel-debuginfo。 ### 安裝需要的軟體 1、檢視系統核心 ```shell [root@qd01-stop-free015 ~]# uname -r 3.10.0-1160.15.2.el7.x86_64 ``` 2、安裝kdump,crash ```shell yum install crash kexec-tools -y ``` 3、安裝kernel-debuginfo 下載連結http://debuginfo.centos.org/7/x86_64/ ```shell rpm -ivh kernel-debuginfo-3.10.0-1160.15.2.el7.x86_64.rpm kernel-debuginfo-common-x86_64-3.10.0-1160.15.2.el7.x86_64.rpm ``` ### crash報告分析 1、使用crash命令載入vmcore檔案 ```shell [root@qd01-stop-free015 kdump]# crash /usr/lib/debug/lib/modules/3.10.0-1160.15.2.el7.x86_64/vmlinux vmcore crash 7.2.3-11.el7_9.1 Copyright (C) 2002-2017 Red Hat, Inc. Copyright (C) 2004, 2005, 2006, 2010 IBM Corporation Copyright (C) 1999-2006 Hewlett-Packard Co Copyright (C) 2005, 2006, 2011, 2012 Fujitsu Limited Copyright (C) 2006, 2007 VA Linux Systems Japan K.K. Copyright (C) 2005, 2011 NEC Corporation Copyright (C) 1999, 2002, 2007 Silicon Graphics, Inc. Copyright (C) 1999, 2000, 2001, 2002 Mission Critical Linux, Inc. This program is free software, covered by the GNU General Public License, and you are welcome to change it and/or distribute copies of it under certain conditions. Enter "help copying" to see the conditions. This program has absolutely no warranty. Enter "help warranty" for details. GNU gdb (GDB) 7.6 Copyright (C) 2013 Free Software Foundation, Inc. License GPLv3+: GNU GPL version 3 o