1. 程式人生 > >crash分析vmcore和vmlinux出現不匹配問題的解決方法

crash分析vmcore和vmlinux出現不匹配問題的解決方法

最近兩天做實驗中,使用sysrq-c觸發系統崩潰後,生成轉儲檔案vmcore。但是使用crash分析的時候卻提示vmcore與vmLinux不匹配

# crash /var/crash/127.0.0.1-2014.07.13-18\:23\:21/vmcore /usr/lib/debug/lib/modules/3.9.5-301.fc19.i686/vmlinux

crash 6.1.4-1.fc19
Copyright (C) 2002-2013  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.3.1
Copyright (C) 2011 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.  Type "show copying"
and "show warranty" for details.
This GDB was configured as "i686-pc-linux-gnu"...

crash: invalid kernel virtual address: c7c0  type: "possible"
WARNING: cannot read cpu_possible_map
crash: invalid kernel virtual address: 364c0cf  type: "present"
WARNING: cannot read cpu_present_map
crash: page excluded: kernel virtual address: d0005405  type: "online"
WARNING: cannot read cpu_online_map
crash: /usr/lib/debug/lib/modules/3.9.5-301.fc19.i686/vmlinux and /var/crash/127.0.0.1-2014.07.13-18:23:21/vmcore do not match!

Usage:

  crash [OPTION]... NAMELIST MEMORY-IMAGE  (dumpfile form)
  crash [OPTION]... [NAMELIST]             (live system form)

Enter "crash -h" for details.

在網上也沒有找到什麼解決辦法,只是說vmlinux與vmcore版本不匹配。

後來仔細觀察,發現系統版本與安裝的軟體版本還是有一點小的區別

# uname -a
Linux localhost.localdomain 3.9.5-301.fc19.i686.PAE #1 SMP Tue Jun 11 19:46:44 UTC 2013 i686 i686 i386 GNU/Linux

重點在PAE三個字,實體地址擴充套件。

原來還是安裝的系統架構不同。粗心了。

在軟體源中尋找,找到這樣的一個軟體包

kernel-PAE-debuginfo-3.9.5-301.fc19.i686.rpm  

於是,安裝之

之後果然發現多出一個目錄,而原來只有一個,即

/usr/lib/debug/lib/modules/3.9.5-301.fc19.i686  

現在多出一個

/usr/lib/debug/lib/modules/3.9.5-301.fc19.i686.PAE

再次crash分析,這次vmlinux需要在後來這個目錄中找

# crash /var/crash/127.0.0.1-2014.07.13-18\:23\:21/vmcore  /usr/lib/debug/lib/modules/3.9.5-301.fc19.i686.PAE/vmlinux
之後果然進去了
crash 6.1.4-1.fc19
Copyright (C) 2002-2013  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.3.1
Copyright (C) 2011 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.  Type "show copying"
and "show warranty" for details.
This GDB was configured as "i686-pc-linux-gnu"...

      KERNEL: /usr/lib/debug/lib/modules/3.9.5-301.fc19.i686.PAE/vmlinux
    DUMPFILE: /var/crash/127.0.0.1-2014.07.13-18:23:21/vmcore  [PARTIAL DUMP]
        CPUS: 2
        DATE: Mon Jul 14 22:22:37 2014
      UPTIME: 07:04:31
LOAD AVERAGE: 0.00, 0.04, 0.08
       TASKS: 92
    NODENAME: localhost.localdomain
     RELEASE: 3.9.5-301.fc19.i686.PAE
     VERSION: #1 SMP Tue Jun 11 19:46:44 UTC 2013
     MACHINE: i686  (2600 Mhz)
      MEMORY: 1 GB
       PANIC: "Oops: 0002 [#1] SMP " (check log for details)
         PID: 1384
     COMMAND: "bash"
        TASK: f47fb300  [THREAD_INFO: f4640000]
         CPU: 0
       STATE: TASK_RUNNING (PANIC)

crash>