0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

UbuntuでOSのvmcoreをcrashで開く

Posted at

十数年前にUbuntu(12.04くらいだったか?)を使ったときは、色々調べて設定しても期待通り機能せず、OSにメモリダンプさせられず、困った気がします。

以下の記事にて、Ubuntu 24.04.03のOSを作ってみたので、続けて、メモリダンプできるか、Copilotさんに聞きながら、試してみました。

1. メモリダンプさせる

メモリダンプには、linux-crashdumpのパッケージが必要とのことですが、デフォルトだと入っていませんでした。(えー、Server版なのに…)

root@u24043s-vm1:~# dpkg -l | grep linux-crashdump
root@u24043s-vm1:~#
root@u24043s-vm1:~# dpkg -l | grep dump
ii  apport-core-dump-handler             2.28.1-0ubuntu3.8                       all          Kernel core dump handler for Apport
ii  tcpdump                              4.99.4-3ubuntu4                         amd64        command-line network traffic analyzer
ii  xxd                                  2:9.1.0016-1ubuntu7.8                   amd64        tool to make (or reverse) a hex dump
root@u24043s-vm1:~#

linux-crashdumpを入れます。

root@u24043s-vm1:~# apt install linux-crashdump
Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
The following additional packages will be installed:
  binutils binutils-common binutils-x86-64-linux-gnu crash kdump-tools kexec-tools libbinutils libctf-nobfd0 libctf0
  libgprofng0 libsframe1 libsnappy1v5 makedumpfile
Suggested packages:
  binutils-doc gprofng-gui
The following NEW packages will be installed:
  binutils binutils-common binutils-x86-64-linux-gnu crash kdump-tools kexec-tools libbinutils libctf-nobfd0 libctf0
  libgprofng0 libsframe1 libsnappy1v5 linux-crashdump makedumpfile
0 upgraded, 14 newly installed, 0 to remove and 0 not upgraded.
Need to get 9,131 kB of archives.
After this operation, 33.5 MB of additional disk space will be used.
Do you want to continue? [Y/n] y
Get:1 http://jp.archive.ubuntu.com/ubuntu noble/main amd64 kexec-tools amd64 1:2.0.28-0ubuntu3 [98.6 kB]
Get:2 http://jp.archive.ubuntu.com/ubuntu noble/main amd64 kdump-tools amd64 1:1.10.3ubuntu2 [35.1 kB]
Get:3 http://jp.archive.ubuntu.com/ubuntu noble-updates/main amd64 binutils-common amd64 2.42-4ubuntu2.5 [240 kB]
Get:4 http://jp.archive.ubuntu.com/ubuntu noble-updates/main amd64 libsframe1 amd64 2.42-4ubuntu2.5 [15.5 kB]
Get:5 http://jp.archive.ubuntu.com/ubuntu noble-updates/main amd64 libbinutils amd64 2.42-4ubuntu2.5 [577 kB]
Get:6 http://jp.archive.ubuntu.com/ubuntu noble-updates/main amd64 libctf-nobfd0 amd64 2.42-4ubuntu2.5 [97.7 kB]
Get:7 http://jp.archive.ubuntu.com/ubuntu noble-updates/main amd64 libctf0 amd64 2.42-4ubuntu2.5 [94.5 kB]
Get:8 http://jp.archive.ubuntu.com/ubuntu noble-updates/main amd64 libgprofng0 amd64 2.42-4ubuntu2.5 [849 kB]
Get:9 http://jp.archive.ubuntu.com/ubuntu noble-updates/main amd64 binutils-x86-64-linux-gnu amd64 2.42-4ubuntu2.5 [2,462 kB]
Get:10 http://jp.archive.ubuntu.com/ubuntu noble-updates/main amd64 binutils amd64 2.42-4ubuntu2.5 [18.1 kB]
Get:11 http://jp.archive.ubuntu.com/ubuntu noble/main amd64 libsnappy1v5 amd64 1.1.10-1build1 [28.6 kB]
Get:12 http://jp.archive.ubuntu.com/ubuntu noble/main amd64 crash amd64 8.0.4-1ubuntu2 [4,426 kB]
Get:13 http://jp.archive.ubuntu.com/ubuntu noble-updates/main amd64 linux-crashdump amd64 6.8.0-71.71 [10.9 kB]
Get:14 http://jp.archive.ubuntu.com/ubuntu noble/main amd64 makedumpfile amd64 1:1.7.5-1 [178 kB]
Fetched 9,131 kB in 4s (2,456 kB/s)
Preconfiguring packages ...

途中で確認画面が出ました。
・このまま進めると、kdump-toolsメカニズムが有効化される。
・カーネルパラメータでcrashkernelを有効化するには、OSを再起動する必要がある。
Yesで進めます。

image.png

関連パッケージが入ります。

Selecting previously unselected package kexec-tools.
(Reading database ... 86987 files and directories currently installed.)
Preparing to unpack .../00-kexec-tools_1%3a2.0.28-0ubuntu3_amd64.deb ...
Unpacking kexec-tools (1:2.0.28-0ubuntu3) ...
Fetched 9,131 kB in 4s (2,456 kB/s)
Preconfiguring packages ...
Selecting previously unselected package kexec-tools.
(Reading database ... 86987 files and directories currently installed.)
Preparing to unpack .../00-kexec-tools_1%3a2.0.28-0ubuntu3_amd64.deb ...
Unpacking kexec-tools (1:2.0.28-0ubuntu3) ...
Selecting previously unselected package kdump-tools.
Preparing to unpack .../01-kdump-tools_1%3a1.10.3ubuntu2_amd64.deb ...
Unpacking kdump-tools (1:1.10.3ubuntu2) ...
Selecting previously unselected package binutils-common:amd64.
Preparing to unpack .../02-binutils-common_2.42-4ubuntu2.5_amd64.deb ...
Unpacking binutils-common:amd64 (2.42-4ubuntu2.5) ...
Selecting previously unselected package libsframe1:amd64.
Preparing to unpack .../03-libsframe1_2.42-4ubuntu2.5_amd64.deb ...
Unpacking libsframe1:amd64 (2.42-4ubuntu2.5) ...
Selecting previously unselected package libbinutils:amd64.
Preparing to unpack .../04-libbinutils_2.42-4ubuntu2.5_amd64.deb ...
Unpacking libbinutils:amd64 (2.42-4ubuntu2.5) ...
Selecting previously unselected package libctf-nobfd0:amd64.
Preparing to unpack .../05-libctf-nobfd0_2.42-4ubuntu2.5_amd64.deb ...
Unpacking libctf-nobfd0:amd64 (2.42-4ubuntu2.5) ...
Selecting previously unselected package libctf0:amd64.
Preparing to unpack .../06-libctf0_2.42-4ubuntu2.5_amd64.deb ...
Unpacking libctf0:amd64 (2.42-4ubuntu2.5) ...
Selecting previously unselected package libgprofng0:amd64.
Preparing to unpack .../07-libgprofng0_2.42-4ubuntu2.5_amd64.deb ...
Unpacking libgprofng0:amd64 (2.42-4ubuntu2.5) ...
Selecting previously unselected package binutils-x86-64-linux-gnu.
Preparing to unpack .../08-binutils-x86-64-linux-gnu_2.42-4ubuntu2.5_amd64.deb ...
Unpacking binutils-x86-64-linux-gnu (2.42-4ubuntu2.5) ...
Selecting previously unselected package binutils.
Preparing to unpack .../09-binutils_2.42-4ubuntu2.5_amd64.deb ...
Unpacking binutils (2.42-4ubuntu2.5) ...
Selecting previously unselected package libsnappy1v5:amd64.
Preparing to unpack .../10-libsnappy1v5_1.1.10-1build1_amd64.deb ...
Unpacking libsnappy1v5:amd64 (1.1.10-1build1) ...
Selecting previously unselected package crash.
Preparing to unpack .../11-crash_8.0.4-1ubuntu2_amd64.deb ...
Unpacking crash (8.0.4-1ubuntu2) ...
Selecting previously unselected package linux-crashdump.
Preparing to unpack .../12-linux-crashdump_6.8.0-71.71_amd64.deb ...
Unpacking linux-crashdump (6.8.0-71.71) ...
Selecting previously unselected package makedumpfile.
Preparing to unpack .../13-makedumpfile_1%3a1.7.5-1_amd64.deb ...
Unpacking makedumpfile (1:1.7.5-1) ...
Setting up binutils-common:amd64 (2.42-4ubuntu2.5) ...
Setting up libctf-nobfd0:amd64 (2.42-4ubuntu2.5) ...
Setting up libsframe1:amd64 (2.42-4ubuntu2.5) ...
Setting up libsnappy1v5:amd64 (1.1.10-1build1) ...
Setting up libbinutils:amd64 (2.42-4ubuntu2.5) ...
Setting up makedumpfile (1:1.7.5-1) ...
Setting up kexec-tools (1:2.0.28-0ubuntu3) ...
Generating /etc/default/kexec...
Setting up libctf0:amd64 (2.42-4ubuntu2.5) ...
Setting up kdump-tools (1:1.10.3ubuntu2) ...

Creating config file /etc/default/kdump-tools with new version
Sourcing file `/etc/default/grub'
Sourcing file `/etc/default/grub.d/kdump-tools.cfg'
Generating grub configuration file ...
File descriptor 3 (pipe:[12108]) leaked on vgs invocation. Parent PID 1903: /usr/sbin/grub-probe
File descriptor 3 (pipe:[12108]) leaked on vgs invocation. Parent PID 1903: /usr/sbin/grub-probe
File descriptor 3 (pipe:[12108]) leaked on vgs invocation. Parent PID 1906: /usr/sbin/grub-probe
File descriptor 3 (pipe:[12108]) leaked on vgs invocation. Parent PID 1906: /usr/sbin/grub-probe
File descriptor 3 (pipe:[12108]) leaked on vgs invocation. Parent PID 1909: /usr/sbin/grub-probe
File descriptor 3 (pipe:[12108]) leaked on vgs invocation. Parent PID 1909: /usr/sbin/grub-probe
File descriptor 3 (pipe:[12108]) leaked on vgs invocation. Parent PID 1912: /usr/sbin/grub-probe
File descriptor 3 (pipe:[12108]) leaked on vgs invocation. Parent PID 1912: /usr/sbin/grub-probe
File descriptor 3 (pipe:[12108]) leaked on vgs invocation. Parent PID 1945: /usr/sbin/grub-probe
File descriptor 3 (pipe:[12108]) leaked on vgs invocation. Parent PID 1945: /usr/sbin/grub-probe
Found linux image: /boot/vmlinuz-6.8.0-71-generic
Found initrd image: /boot/initrd.img-6.8.0-71-generic
File descriptor 3 (pipe:[12108]) leaked on vgs invocation. Parent PID 2131: /usr/sbin/grub-probe
File descriptor 3 (pipe:[12108]) leaked on vgs invocation. Parent PID 2131: /usr/sbin/grub-probe
Warning: os-prober will not be executed to detect other bootable partitions.
Systems on them will not be added to the GRUB boot configuration.
Check GRUB_DISABLE_OS_PROBER documentation entry.
Adding boot menu entry for UEFI Firmware Settings ...
done
Created symlink /etc/systemd/system/basic.target.wants/kdump-tools.service → /usr/lib/systemd/system/kdump-tools.service.
kdump-tools-dump.service is a disabled or a static unit, not starting it.
Setting up libgprofng0:amd64 (2.42-4ubuntu2.5) ...
Setting up binutils-x86-64-linux-gnu (2.42-4ubuntu2.5) ...
Setting up linux-crashdump (6.8.0-71.71) ...
Setting up binutils (2.42-4ubuntu2.5) ...
Setting up crash (8.0.4-1ubuntu2) ...
Processing triggers for libc-bin (2.39-0ubuntu8.5) ...
Processing triggers for man-db (2.12.0-4build2) ...
Processing triggers for initramfs-tools (0.142ubuntu25.5) ...
update-initramfs: Generating /boot/initrd.img-6.8.0-71-generic
Scanning processes...
Scanning linux images...

Running kernel seems to be up-to-date.

No services need to be restarted.

No containers need to be restarted.

No user sessions are running outdated binaries.

No VM guests are running outdated hypervisor (qemu) binaries on this host.
root@u24043s-vm1:~#

これで、linux-crashdumpが入りました。

root@u24043s-vm1:~# dpkg -l | grep linux-crashdump
ii  linux-crashdump                      6.8.0-71.71                             amd64        Linux kernel crashdump setup for the latest generic kernel
root@u24043s-vm1:~#

クラッシュ後に10秒待って再起動する設定を、追加してみます。(「KDUMP_SYSCTL="kernel.panic=10"」を追加)

root@u24043s-vm1:~# cat /etc/default/kdump-tools | grep -v "^#" | uniq
USE_KDUMP=1

KDUMP_KERNEL=/var/lib/kdump/vmlinuz
KDUMP_INITRD=/var/lib/kdump/initrd.img

KDUMP_COREDIR="/var/crash"

root@u24043s-vm1:~#
root@u24043s-vm1:~# cat /etc/default/kdump-tools | wc -l
103
root@u24043s-vm1:~#
root@u24043s-vm1:~# vim /etc/default/kdump-tools
root@u24043s-vm1:~#
root@u24043s-vm1:~# cat /etc/default/kdump-tools | grep -v "^#" | uniq
USE_KDUMP=1
KDUMP_SYSCTL="kernel.panic=10"

KDUMP_KERNEL=/var/lib/kdump/vmlinuz
KDUMP_INITRD=/var/lib/kdump/initrd.img

KDUMP_COREDIR="/var/crash"

root@u24043s-vm1:~#

grubの設定を変更し、kdump用にメモリを予約します(panic時に切り替わるセカンドカーネルをロードしておく領域)。「GRUB_CMDLINE_LINUX_DEFAULT="quiet splash crashkernel=512M"」を追加します。

root@u24043s-vm1:~# cat /etc/default/grub | grep -v "^#" | uniq

GRUB_DEFAULT=0
GRUB_TIMEOUT_STYLE=hidden
GRUB_TIMEOUT=0
GRUB_DISTRIBUTOR=`( . /etc/os-release; echo ${NAME:-Ubuntu} ) 2>/dev/null || echo Ubuntu`
GRUB_CMDLINE_LINUX_DEFAULT=""
GRUB_CMDLINE_LINUX=""

root@u24043s-vm1:~#
root@u24043s-vm1:~# vim /etc/default/grub
root@u24043s-vm1:~#
root@u24043s-vm1:~# cat /etc/default/grub | grep -v "^#" | uniq

GRUB_DEFAULT=0
GRUB_TIMEOUT_STYLE=hidden
GRUB_TIMEOUT=0
GRUB_DISTRIBUTOR=`( . /etc/os-release; echo ${NAME:-Ubuntu} ) 2>/dev/null || echo Ubuntu`
GRUB_CMDLINE_LINUX_DEFAULT="quiet splash crashkernel=512M"
GRUB_CMDLINE_LINUX=""

root@u24043s-vm1:~#

grubを更新し、再起動します。

root@u24043s-vm1:~# update-grub
Sourcing file `/etc/default/grub'
Sourcing file `/etc/default/grub.d/kdump-tools.cfg'
Generating grub configuration file ...
Found linux image: /boot/vmlinuz-6.8.0-71-generic
Found initrd image: /boot/initrd.img-6.8.0-71-generic
Warning: os-prober will not be executed to detect other bootable partitions.
Systems on them will not be added to the GRUB boot configuration.
Check GRUB_DISABLE_OS_PROBER documentation entry.
Adding boot menu entry for UEFI Firmware Settings ...
done
root@u24043s-vm1:~#
root@u24043s-vm1:~# reboot

これで、"Linux kernel crashdump"が有効化されたことを確認します。

root@u24043s-vm1:~# systemctl status kdump-tools
● kdump-tools.service - Kernel crash dump capture service
     Loaded: loaded (/usr/lib/systemd/system/kdump-tools.service; enabled; preset: enabled)
     Active: active (exited) since Sun 2025-08-10 09:01:05 JST; 44s ago
    Process: 498 ExecStartPre=/usr/share/kdump-tools/kdump_mem_estimator (code=exited, status=0/SUCCESS)
    Process: 559 ExecStart=/etc/init.d/kdump-tools start (code=exited, status=0/SUCCESS)
   Main PID: 559 (code=exited, status=0/SUCCESS)
        CPU: 3.996s

Aug 10 09:01:00 u24043s-vm1 systemd[1]: Starting kdump-tools.service - Kernel crash dump capture service...
Aug 10 09:01:01 u24043s-vm1 kdump-tools[559]: Starting kdump-tools:
Aug 10 09:01:01 u24043s-vm1 kdump-tools[617]:  * Creating symlink /var/lib/kdump/vmlinuz
Aug 10 09:01:01 u24043s-vm1 kdump-tools[661]: kdump-tools: Generating /var/lib/kdump/initrd.img-6.8.0-71-generic
Aug 10 09:01:04 u24043s-vm1 kdump-tools[617]:  * Creating symlink /var/lib/kdump/initrd.img
Aug 10 09:01:04 u24043s-vm1 kdump-tools[617]:  * loaded kdump kernel
Aug 10 09:01:05 u24043s-vm1 kdump-tools[4378]: loaded kdump kernel
Aug 10 09:01:05 u24043s-vm1 systemd[1]: Finished kdump-tools.service - Kernel crash dump capture service.
root@u24043s-vm1:~#
root@u24043s-vm1:~# cat /proc/cmdline
BOOT_IMAGE=/vmlinuz-6.8.0-71-generic root=/dev/mapper/ubuntu--vg-ubuntu--lv ro quiet splash crashkernel=512M crashkernel=2G-4G:320M,4G-32G:512M,32G-64G:1024M,64G-128G:2048M,128G-:4096M vt.handoff=7
root@u24043s-vm1:~#

メモリダンプさせてみます。
※OSがリセットされ、再起動するのでご注意。

root@u24043s-vm1:~# echo c | tee /proc/sysrq-trigger
c
Read from remote host 192.168.11.201: Connection reset by peer
Connection to 192.168.11.201 closed.
client_loop: send disconnect: Broken pipe
[root@al10micro ~]#

これで、/var/crash/以下を見ると、とれていました。

root@u24043s-vm1:~# ls -l /var/crash/
total 36
drwxr-sr-x 2 root root  4096 Aug 10 09:02 202508100902
-rw-r--r-- 1 root root     0 Aug 10 09:02 kdump_lock
-rw-r--r-- 1 root root   279 Aug 10 09:02 kexec_cmd
-rw-r--r-- 1 root root 27623 Aug 10 09:03 linux-image-6.8.0-71-generic-202508100902.crash
root@u24043s-vm1:~#
root@u24043s-vm1:~# ls -l /var/crash/202508100902/
total 62080
-rw------- 1 root root    83068 Aug 10 09:02 dmesg.202508100902
-rw-r--r-- 1 root root 63477234 Aug 10 09:02 dump.202508100902
root@u24043s-vm1:~#
root@u24043s-vm1:~# date
Sun Aug 10 09:03:28 AM JST 2025
root@u24043s-vm1:~#

2. crashで開く

vmcoreファイル(Ubuntuだと、dumpファイルですね)を調べるには、crashというソフトウェアを使います。これは、gdbのラッパーとのこと。

crashのパッケージは、入っています。(linux-crashdumpを入れたときに入ってます)

root@u24043s-vm1:~# dpkg -l | grep crash
ii  apport                               2.28.1-0ubuntu3.8                       all          automatically generate crash reports for debugging
ii  crash                                8.0.4-1ubuntu2                          amd64        kernel debugging utility, allowing gdb like syntax
ii  kdump-tools                          1:1.10.3ubuntu2                         amd64        scripts and tools for automating kdump (Linux crash dumps)
ii  linux-crashdump                      6.8.0-71.71                             amd64        Linux kernel crashdump setup for the latest generic kernel
ii  python3-apport                       2.28.1-0ubuntu3.8                       all          Python 3 library for Apport crash report handling
root@u24043s-vm1:~#

また、vmcoreファイルは、カーネルのメモリダンプなので、カーネルのデバッグ情報(バイナリのどこが、ソースコードのどこに対応するか、などの情報)が必要です。カーネルのデバッグ情報は、カーネルとは別のパッケージで管理されており、Ubuntu 24.04.3の場合、
 ・カーネルのパッケージ:linux-image-6.8.0-71-generic
 ・カーネルのデバッグ情報: linux-image-unsigned-6.8.0-71-generic-dbgsym
このような関係です。

デフォルトでは、カーネルの方しか入っていません。

root@u24043s-vm1:~# dpkg -l | grep linux-image
ii  linux-image-6.8.0-71-generic         6.8.0-71.71                             amd64        Signed kernel image generic
ii  linux-image-generic                  6.8.0-71.71                             amd64        Generic Linux kernel image
root@u24043s-vm1:~#

Ubuntu公式の、デバッグ情報の説明のページが以下にあります。

ここでは、「Getting -dbgsym.ddeb packages」の説明に従い、ddebファイルを入手してインストールします。

まず、リポジトリサーバのサインキーを入手して、OSに入れます。

root@u24043s-vm1:~# sudo apt install ubuntu-dbgsym-keyring
Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
ubuntu-dbgsym-keyring is already the newest version (2023.11.28.1).
0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.
root@u24043s-vm1:~#

ddebs.listファイルを作ります。複数行のコマンドを、コピペして実行します。

コピペ文
echo "Types: deb
URIs: http://ddebs.ubuntu.com/
Suites: $(lsb_release -cs) $(lsb_release -cs)-updates $(lsb_release -cs)-proposed 
Components: main restricted universe multiverse
Signed-by: /usr/share/keyrings/ubuntu-dbgsym-keyring.gpg" | \
sudo tee -a /etc/apt/sources.list.d/ddebs.sources
root@u24043s-vm1:~# echo "Types: deb
URIs: http://ddebs.ubuntu.com/
Suites: $(lsb_release -cs) $(lsb_release -cs)-updates $(lsb_release -cs)-proposed
Components: main restricted universe multiverse
Signed-by: /usr/share/keyrings/ubuntu-dbgsym-keyring.gpg" | \
sudo tee -a /etc/apt/sources.list.d/ddebs.sources
Types: deb
URIs: http://ddebs.ubuntu.com/
Suites: noble noble-updates noble-proposed
Components: main restricted universe multiverse
Signed-by: /usr/share/keyrings/ubuntu-dbgsym-keyring.gpg
root@u24043s-vm1:~#

作成されたファイルを確認します。

root@u24043s-vm1:~# cat /etc/apt/sources.list.d/ddebs.sources
Types: deb
URIs: http://ddebs.ubuntu.com/
Suites: noble noble-updates noble-proposed
Components: main restricted universe multiverse
Signed-by: /usr/share/keyrings/ubuntu-dbgsym-keyring.gpg
root@u24043s-vm1:~#

パッケージリストを更新します。

root@u24043s-vm1:~# apt-get update
Get:1 http://security.ubuntu.com/ubuntu noble-security InRelease [126 kB]
Get:2 http://security.ubuntu.com/ubuntu noble-security/main amd64 Components [21.6 kB]
Get:3 http://ddebs.ubuntu.com noble InRelease [41.3 kB]
Get:4 http://security.ubuntu.com/ubuntu noble-security/restricted amd64 Components [212 B]
Get:5 http://security.ubuntu.com/ubuntu noble-security/universe amd64 Components [52.3 kB]
Hit:6 http://jp.archive.ubuntu.com/ubuntu noble InRelease
Get:7 http://security.ubuntu.com/ubuntu noble-security/multiverse amd64 Components [208 B]
Get:8 http://jp.archive.ubuntu.com/ubuntu noble-updates InRelease [126 kB]
Get:9 http://ddebs.ubuntu.com noble-updates InRelease [41.3 kB]
Get:10 http://ddebs.ubuntu.com noble-proposed InRelease [41.4 kB]
Get:11 http://ddebs.ubuntu.com noble/main amd64 Packages [569 kB]
Get:12 http://jp.archive.ubuntu.com/ubuntu noble-backports InRelease [126 kB]
Get:13 http://jp.archive.ubuntu.com/ubuntu noble-updates/main amd64 Components [164 kB]
Get:14 http://jp.archive.ubuntu.com/ubuntu noble-updates/restricted amd64 Components [212 B]
Get:15 http://jp.archive.ubuntu.com/ubuntu noble-updates/universe amd64 Components [377 kB]
Get:16 http://ddebs.ubuntu.com noble/restricted amd64 Packages [884 B]
Get:17 http://ddebs.ubuntu.com noble/universe amd64 Packages [5,115 kB]
Get:18 http://jp.archive.ubuntu.com/ubuntu noble-updates/multiverse amd64 Components [940 B]
Get:19 http://jp.archive.ubuntu.com/ubuntu noble-backports/main amd64 Components [7,056 B]
Get:20 http://jp.archive.ubuntu.com/ubuntu noble-backports/restricted amd64 Components [216 B]
Get:21 http://jp.archive.ubuntu.com/ubuntu noble-backports/universe amd64 Components [30.8 kB]
Get:22 http://jp.archive.ubuntu.com/ubuntu noble-backports/multiverse amd64 Components [212 B]
Get:23 http://ddebs.ubuntu.com noble/multiverse amd64 Packages [86.0 kB]
Get:24 http://ddebs.ubuntu.com noble-updates/main amd64 Packages [372 kB]
Get:25 http://ddebs.ubuntu.com noble-updates/restricted amd64 Packages [1,092 B]
Get:26 http://ddebs.ubuntu.com noble-updates/universe amd64 Packages [397 kB]
Get:27 http://ddebs.ubuntu.com noble-updates/multiverse amd64 Packages [3,284 B]
Get:28 http://ddebs.ubuntu.com noble-proposed/main amd64 Packages [52.6 kB]
Get:29 http://ddebs.ubuntu.com noble-proposed/universe amd64 Packages [54.3 kB]
Fetched 7,809 kB in 5s (1,646 kB/s)
Reading package lists... Done
root@u24043s-vm1:~#

これで、

root@u24043s-vm1:~# apt search linux-image | grep 6.8.0-71 | grep dbg

WARNING: apt does not have a stable CLI interface. Use with caution in scripts.

linux-image-6.8.0-71-generic-dbgsym/noble-updates 6.8.0-71.71 amd64
linux-image-unsigned-6.8.0-71-generic-dbgsym/noble-updates,now 6.8.0-71.71 amd64
root@u24043s-vm1:~#

こういうパッケージを入手して入れればよい、とわかります。

上記は、直接的にURLを出してくれているわけでないのですが、リポジトリはddebs.ubuntu.comだとはわかっているので、ブラウザ上で探すことができます。

沢山置いてあります。

image.png

「6.8.0-71-generic-dbgsym」で検索すると、このあたりが引っかかりました。

image.png

apt searchでは2種類表示されていましたが、このリポジトリには、unsignedの方だけが提供されているようでした。amd64のを入手すればよい、とわかります。URLとしては以下です。

curlで入手します。1.6GBあり、かなり時間はかかります(AMにやると130Kbpsくらいで3hくらいかかりました。PMに再確認すると5Mbpsくらい出ました)。

[root@al10micro ~]# curl -O http://ddebs.ubuntu.com/pool/main/l/linux/linux-image-unsigned-6.8.0-71-generic-dbgsym_6.8.0-71.71_
amd64.ddeb
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
  1 1657M    1 25.1M    0     0  4530k      0  0:06:14  0:00:05  0:06:09 5154k

~(100%になるまで待つ)

[root@al10micro ~]#

入れます。
(チェックサムの確認をしたかったのですが、見つけられませんでした。)

root@u24043s-vm1:~# dpkg -i linux-image-unsigned-6.8.0-71-generic-dbgsym_6.8.0-71.71_amd64.ddeb
Selecting previously unselected package linux-image-unsigned-6.8.0-71-generic-dbgsym.
(Reading database ... 87328 files and directories currently installed.)
Preparing to unpack linux-image-unsigned-6.8.0-71-generic-dbgsym_6.8.0-71.71_amd64.ddeb ...
Unpacking linux-image-unsigned-6.8.0-71-generic-dbgsym (6.8.0-71.71) ...
Setting up linux-image-unsigned-6.8.0-71-generic-dbgsym (6.8.0-71.71) ...
root@u24043s-vm1:~#

これで、以下にvmlinuxファイル(=カーネルのデバッグ情報)が入りました。

root@u24043s-vm1:~# ls /usr/lib/debug/boot/vmlinux-6.8.0-71-generic
/usr/lib/debug/boot/vmlinux-6.8.0-71-generic
root@u24043s-vm1:~#

crashコマンドで、vmlinuxと、dumpを指定することで、メモリダンプを開けました。

root@u24043s-vm1:~# crash /usr/lib/debug/boot/vmlinux-$(uname -r) /var/crash/202508100902/dump.202508100902

crash 8.0.4
Copyright (C) 2002-2022  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, 2020-2022  NEC Corporation
Copyright (C) 1999, 2002, 2007  Silicon Graphics, Inc.
Copyright (C) 1999, 2000, 2001, 2002  Mission Critical Linux, Inc.
Copyright (C) 2015, 2021  VMware, 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) 10.2
Copyright (C) 2021 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-pc-linux-gnu".
Type "show configuration" for configuration details.
Find the GDB manual and other documentation resources online at:
    <http://www.gnu.org/software/gdb/documentation/>.

For help, type "help".
Type "apropos word" to search for commands related to "word"...

      KERNEL: /usr/lib/debug/boot/vmlinux-6.8.0-71-generic
    DUMPFILE: /var/crash/202508100902/dump.202508100902  [PARTIAL DUMP]
        CPUS: 2
        DATE: Sun Aug 10 09:02:44 JST 2025
      UPTIME: 00:01:47
LOAD AVERAGE: 0.07, 0.02, 0.00
       TASKS: 166
    NODENAME: u24043s-vm1
     RELEASE: 6.8.0-71-generic
     VERSION: #71-Ubuntu SMP PREEMPT_DYNAMIC Tue Jul 22 16:52:38 UTC 2025
     MACHINE: x86_64  (2111 Mhz)
      MEMORY: 4 GB
       PANIC: "Kernel panic - not syncing: sysrq triggered crash"
         PID: 4702
     COMMAND: "tee"
        TASK: ffff9409493d0000  [THREAD_INFO: ffff9409493d0000]
         CPU: 1
       STATE: TASK_RUNNING (PANIC)

crash>

お試しの、バックトレースです。

crash> bt
PID: 4702     TASK: ffff9409493d0000  CPU: 1    COMMAND: "tee"
 #0 [ffffaf21810a79c8] machine_kexec at ffffffffa1eb9dbf
 #1 [ffffaf21810a7a30] __crash_kexec at ffffffffa2032be3
 #2 [ffffaf21810a7af8] panic at ffffffffa1f05ff4
 #3 [ffffaf21810a7b78] sysrq_handle_crash at ffffffffa291046a
 #4 [ffffaf21810a7b88] __handle_sysrq at ffffffffa2910c40
 #5 [ffffaf21810a7bd0] write_sysrq_trigger at ffffffffa29114c2
 #6 [ffffaf21810a7c00] proc_reg_write at ffffffffa23b3519
 #7 [ffffaf21810a7c20] vfs_write at ffffffffa22f1eed
 #8 [ffffaf21810a7cb8] ksys_write at ffffffffa22f2633
 #9 [ffffaf21810a7cf8] __x64_sys_write at ffffffffa22f26e9
#10 [ffffaf21810a7d08] x64_sys_call at ffffffffa1e0593e
#11 [ffffaf21810a7d18] do_syscall_64 at ffffffffa3040ddf
#12 [ffffaf21810a7f50] entry_SYSCALL_64_after_hwframe at ffffffffa3200130
    RIP: 00007ce6e391c574  RSP: 00007ffc5cb64b48  RFLAGS: 00000202
    RAX: ffffffffffffffda  RBX: 0000000000000002  RCX: 00007ce6e391c574
    RDX: 0000000000000002  RSI: 00007ffc5cb64ca0  RDI: 0000000000000003
    RBP: 00007ffc5cb64b70   R8: 0000000000000002   R9: 0000000000000001
    R10: 00000000000001b6  R11: 0000000000000202  R12: 0000000000000002
    R13: 00007ffc5cb64ca0  R14: 000063a78b6e3470  R15: 0000000000000002
    ORIG_RAX: 0000000000000001  CS: 0033  SS: 002b
crash>

まとめ

Ubuntu 24.04のOSでメモリダンプをとり、crashで開けることを確認しました。

0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?