我已经使用 kdump 生成了一个 vmcore 文件,现在应该对其进行分析。
首先是从核心转储中获取 dmesg 日志。这应该通过以下方式完成:
vmcore-dmesg vmcore
然而,这似乎不起作用,因为存在错误:
Missing the log_buf symbol
有人知道如何解决这个错误吗?
任何帮助将非常感激。
答案1
有两种方式获取 dmesg 日志:
- 您可以在保存 vmcore 的同一目录中找到 dmesg 日志。
- 您可以使用 crash 从 vmcore 转储 dmesg 日志(崩溃需要内核的调试符号):
$ sudo crash /usr/lib/debug/boot/vmlinux-5.4.0-99-generic /var/crash/202202110944/dump.202202110944
crash 7.2.8
Copyright (C) 2002-2020 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 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 "x86_64-unknown-linux-gnu"...
WARNING: kernel relocated [688MB]: patching 115324 gdb minimal_symbol values
KERNEL: /usr/lib/debug/boot/vmlinux-5.4.0-99-generic
DUMPFILE: /var/crash/202202110944/dump.202202110944 [PARTIAL DUMP]
CPUS: 4
DATE: Fri Feb 11 09:43:56 2022
UPTIME: 00:05:50
LOAD AVERAGE: 0.08, 0.16, 0.10
TASKS: 566
NODENAME: user-virtual-machine
RELEASE: 5.4.0-99-generic
VERSION: #112-Ubuntu SMP Thu Feb 3 13:50:55 UTC 2022
MACHINE: x86_64 (2808 Mhz)
MEMORY: 8 GB
PANIC: "Kernel panic - not syncing: sysrq triggered crash"
PID: 0
COMMAND: "swapper/2"
TASK: ffff8f13f44a0000 (1 of 4) [THREAD_INFO: ffff8f13f44a0000]
CPU: 2
STATE: TASK_RUNNING (PANIC)
crash> dmesg
[ 0.000000] Linux version 5.4.0-99-generic (buildd@lgw01-amd64-007) (gcc version 9.3.0 (Ubuntu 9.3.0-17ubuntu1~20.04)) #112-Ubuntu SMP Thu Feb 3 13:50:55 UTC 2022 (Ubuntu 5.4.0-99.112-generic 5.4.162)
[ 0.000000] Command line: BOOT_IMAGE=/boot/vmlinuz-5.4.0-99-generic root=/dev/mapper/vgubuntu-root ro quiet splash crashkernel=4096M-:512M vt.handoff=7
[ 0.000000] KERNEL supported cpus:
[ 0.000000] Intel GenuineIntel
[ 0.000000] AMD AuthenticAMD
[ 0.000000] Hygon HygonGenuine
[ 0.000000] Centaur CentaurHauls
[ 0.000000] zhaoxin Shanghai
[ 0.000000] Disabled fast string operations
...