Kdump是在系統崩潰、死鎖或死機時(shí)用來(lái)轉儲內存運行參數的一個(gè)工具和服務(wù),是一種新的crash dump捕獲機制,用來(lái)捕獲kernel crash(內核崩潰)的時(shí)候產(chǎn)生的crash dump。
Kdump 使用兩個(gè)內核:生產(chǎn)內核和捕獲內核。生產(chǎn)內核是一個(gè)普通內核,它使用特殊的 kdump 特定標志啟動(dòng)。我們需要告訴生產(chǎn)內核保留一些物理內存,用于加載捕獲內核。我們需要提前加載捕獲內核,因為在崩潰發(fā)生的那一刻,由于內核損壞,無(wú)法從磁盤(pán)讀取任何數據。
生產(chǎn)內核是捕獲內核服務(wù)的對像。捕獲內核會(huì )在生產(chǎn)內核崩潰時(shí)啟動(dòng)起來(lái),與相應的ramdisk一起組建一個(gè)微環(huán)境,用以對生產(chǎn)內核下的內存進(jìn)行收集和轉存。
第一個(gè)內核保留了內存的一部分給第二內核啟動(dòng)用。由于kdump利用kexec啟動(dòng)捕獲內核,繞過(guò)了 BIOS,所以第一個(gè)內核的內存得以保留。這是內核崩潰轉儲的本質(zhì)。
為了在生產(chǎn)內核崩潰時(shí)能順利啟動(dòng)捕獲內核,捕獲內核以及它的ramdisk是事先放到生產(chǎn)內核的內存中的。
生產(chǎn)內核的內存是通過(guò)/proc/vmcore這個(gè)文件交給捕獲內核的。為了生成它,用戶(hù)工具在生產(chǎn)內核中分析出內存的使用和分布等情況,然后把這些信息綜合起來(lái)生成一個(gè)ELF頭文件保存起來(lái)。
捕獲內核被引導時(shí)會(huì )被同時(shí)傳遞這個(gè)ELF文件頭的地址,通過(guò)分析它,捕獲內核就可以生成出/proc/vmcore。有了/proc/vmcore這個(gè)文件,捕獲內核的ramdisk中的腳本就可以通過(guò)通常的文件讀寫(xiě)和網(wǎng)絡(luò )來(lái)實(shí)現各種策略了。
注意,在啟動(dòng)時(shí),kdump保留了一定數量的重要的內存,為了計算系統需要的真正最小內存,加上kdump使用的內存數量,以決定真正的最小內存的需求。

x86,x86_64,arm,arm64,ppc,s390,sh
Kexec是基于kexec機制工作的,因此先了解一下Kexec。
kexec是一個(gè)快速啟動(dòng)機制,允許通過(guò)已經(jīng)運行的內核的上下文啟動(dòng)一個(gè)Linux內核,不需要經(jīng)過(guò)BIOS。(BIOS可能會(huì )消耗很多時(shí)間,特別是帶有眾多數量的外設的大型服務(wù)器。這種辦法可以為經(jīng)常啟動(dòng)機器的開(kāi)發(fā)者節省很多時(shí)間。)
Kexec的實(shí)現包括2個(gè)組成部分:
** 一是內核空間的系統調用:kexec_load() **,負責在生產(chǎn)內核(production kernel 或 first kernel)啟動(dòng)時(shí)將捕獲內核(capture kernel或sencond kernel)加載到指定地址。
** 二是用戶(hù)空間的工具kexec-tools **,他將捕獲內核的地址傳遞給生產(chǎn)內核,從而在系統崩潰的時(shí)候能夠找到捕獲內核的地址并運行。沒(méi)有kexec就沒(méi)有kdump。先有kexec實(shí)現了在一個(gè)內核中可以啟動(dòng)另一個(gè)內核,才讓kdump有了用武之地。
kexec 在 kernel 里以一個(gè)系統調用kexec_load()的形式提供給用戶(hù)。這個(gè)系統調用主要用來(lái)把另一個(gè)內核和其 ramdisk 加載到當前內核中。在 kdump中,捕獲內核只能使用事先預留的一小段內存。
生產(chǎn)內核的內存鏡像會(huì )被以/proc/vmcore的形式提供給用戶(hù)。這是一個(gè) ELF格式的方件,它的頭是由用戶(hù)空間工具 kexec 生成并傳遞來(lái)的。在系統崩潰時(shí),系統最后會(huì )調用machine_kexec()。這通常是一個(gè)硬件相關(guān)的函數。它會(huì )引導捕獲內核,從而完成 kdump 的過(guò)程。
kdump 的很大一部分工作都是在用戶(hù)空間內完成的。與 kexec相關(guān)的集中在一個(gè)叫kexec-tools的工具中的kexec程序中。
該程序主要是為調用kexec_load()收集各種信息,然后調用之。這些信息主要包括 purgatory 的入口地址,還有一組由struct kexec_segment描述的信息。

最后,附上一張圖,看下kdump和kexec整個(gè)的工作流程。

修改內核中以下的配置宏,可在.config文件中修改,或者通過(guò)make menuconfig修改
CONFIG_KEXEC=y
CONFIG_CRASH_DUMP=y
CONFIG_PROC_VMCORE=y
CONFIG_PROC_KCORE=y
CONFIG_SYSFS=y
CONFIG_DEBUG_INFO=y
確認修改成功
root@firefly:/sys/kernel# ls /sys/kernel/ | grep kexec
kexec_crash_loaded
kexec_crash_size
kexec_loaded
root@firefly:~# ls /proc/ | grep kcore
kcore
如果出現proc/kcore,kexec相關(guān)節點(diǎn)說(shuō)明配置生效了。
預留內存的設置一般有4種形式:
crashkernel=size[KMG][@offset[KMG]]
crashkernel=range1:size1[,range2:size,...][@offset]
舉例
crashkernel=512M-2G:64M,2G-6G:256M,6G-8G:512M,8G-:768M
參數含義如下:
如果RAM大小小于512M,則不預留內存。
如果RAM大小為512M - 2G,則預留 64M。
如果RAM大小為2 - 6G,則預留 256M。
如果RAM大小大于8G,則預留768 M。
crashkernel=size[KMG],hign
crashkernel=size[KMG],low
在X86-64主機上一般是修改/etc/default/grup
中的參數來(lái)配置及檢查, 但是在嵌入式設備上因為是裁剪的系統,并沒(méi)有g(shù)rup這個(gè)文件。
但我們可以知道,配置grup文件的目的就是更改cmdline中的內容,那我們如何去更改cmdline的內容呢?提供以下幾個(gè)思路:
這里我們選擇在dts中修改。
vim kernel/arch/arm64/boot/dts/rockchip/rk3399-linux.dtsi
當前使用的設備RAM已經(jīng)是4G,所以預留的是256M
root@firefly:~# free -m
total used free shared buff/cache available
Mem: 3583 194 3154 8 234 3351
Swap: 0 0 0

重新編譯燒寫(xiě)內核,看到設備啟動(dòng)時(shí),已經(jīng)加入了啟動(dòng)參數。

查看啟動(dòng)參數是否生效
root@firefly:~# cat /proc/iomem | grep Crash
e5e00000-f5dfffff : Crash kernel
確認分配內存大小
root@firefly:~# cat /sys/kernel/kexec_crash_size
268435456
在某些情況下,我們需要正確評估預留內存的大小,主要從以下2個(gè)方面考慮。
/proc/iomem表示的是系統的物理內存布局, System RAM entry表示當前系統可用的預留內存。例如,我當前設備的內存為3.8G,預留800M內存也是足夠的。
root@firefly:~# cat /proc/iomem | grep System
00200000-083fffff : System RAM
0a200000-f7ffffff : System RAM
http://kernel.org/pub/linux/utils/kernel/kexec/kexec-tools.tar.gz
tar xvpzf kexec-tools-2.0.26.tar.gz
LDFLAGS=-static ./configure ARCH=arm64 --build=x86_64-linux-gnu --host=aarch64-linux-gnu --target=aarch64-linux-gnu --without-xen
這里使用靜態(tài)編譯。
make
root@firefly:~/kexec/sbin# kexec -v
kexec-tools 2.0.26
查看kexec參數。
root@firefly:~# kexec -h
kexec-tools 2.0.26
Usage: kexec [OPTION]... [kernel]
Directly reboot into a new kernel
-h, Print this help.
-v, --version Print the version of kexec.
-f, --force Force an immediate kexec,
don't call shutdown.
-i, --no-checks Fast reboot, no memory integrity checks.
-x, --no-ifdown Don't bring down network interfaces.
-y, --no-sync Don't sync filesystems before kexec.
-l, --load Load the new kernel into the
current kernel.
-p, --load-panic Load the new kernel for use on panic.
-u, --unload Unload the current kexec target kernel.
If capture kernel is being unloaded
specify -p with -u.
-e, --exec Execute a currently loaded kernel.
--exec-live-update Execute a currently loaded xen image after
storing the state required to live update.
-t, --type=TYPE Specify the new kernel is of this type.
--mem-min=<addr> Specify the lowest memory address to
load code into.
--mem-max=<addr> Specify the highest memory address to
load code into.
--reuseinitrd Reuse initrd from first boot.
--print-ckr-size Print crash kernel region size.
--load-preserve-context Load the new kernel and preserve
context of current kernel during kexec.
--load-jump-back-helper Load a helper image to jump back
to original kernel.
--load-live-update Load the new kernel to overwrite the
running kernel.
--entry=<addr> Specify jump back address.
(0 means it's not jump back or
preserve context)
to original kernel.
-s, --kexec-file-syscall Use file based syscall for kexec operation
-c, --kexec-syscall Use the kexec_load syscall for for compatibility
with systems that don't support -s (default)
-a, --kexec-syscall-auto Use file based syscall for kexec and fall
back to the compatibility syscall when file based
syscall is not supported or the kernel did not
understand the image
-d, --debug Enable debugging to help spot a failure.
-S, --status Return 1 if the type (by default crash) is loaded,
0 if not.
Supported kernel file types and options:
vmlinux
An ARM64 ELF image, big or little endian.
Typically vmlinux or a stripped version of vmlinux.
Image
An ARM64 binary image, uncompressed, big or little endian.
Typically an Image file.
uImage
An ARM64 U-boot uImage file, compressed or not, big or little endian.
zImage
An ARM64 zImage, compressed, big or little endian.
Typically an Image.gz or Image.lzma file.
Architecture options:
--append=STRING Set the kernel command line to STRING.
--command-line=STRING Set the kernel command line to STRING.
--dtb=FILE Use FILE as the device tree blob.
--initrd=FILE Use FILE as the kernel initial ramdisk.
--serial=STRING Name of console used for purgatory printing. (e.g. ttyAMA0)
--ramdisk=FILE Use FILE as the kernel initial ramdisk.
--reuse-cmdline Use kernel command line from running system.
注意以下幾個(gè)參數
-d: 執行kexec指令時(shí)會(huì )打印調試信息
-p: 將內核加載到預留內存中,panic時(shí)自動(dòng)啟動(dòng)capture內核。
-l: 將內核加載到預留內存中
--append : capture內核的command line的內容
--t: 內核的類(lèi)型,比如vmlinux,Image,uImage,zImage
--intrd:指定initrd
--reuseinitrd:復用第一個(gè)內核的initrd
--dtb:指定設備樹(shù)
vmlinux,Image,uImage,zImage區別參考:secure boot (一)FIT Image
嘗試手動(dòng)配置kexec
kexec --t vmlinux -p /root/var/vmlinux --ramdisk /root/var/ramdisk.img --append='storagemedia=emmc androidboot.storagemedia=emmc androidboot.mode=normal storagenode=sdhci@fe330000 androidboot.slot_suffix= androidboot.serialno=3fdce35e50641399 ro rootwait earlycon=uart8250,mmio32,0xff1a0000 swiotlb=1 console=ttyFIQ0 root=PARTLABEL=rootfs rootfstype=ext4 overlayroot=device:dev=PARTLABEL=userdata,fstype=ext4,mkfs=1 coherent_pool=1m systemd.gpt_auto=0 cgroup_enable=memory swapaccount=1 crashkernel=256M'
command line 可以通過(guò)cat /proc/cmdline 查看。
ramdisk.img 也可以叫做initrd.img, 它是一個(gè)小文件系統,麻雀雖小五臟俱全,它介于kernel 和 文件系統之間。kernel 啟動(dòng)后會(huì )先執行ramdisk.img 里面的init, 掛載這里的小型文件系統,接著(zhù)開(kāi)始完成一些必要的操作,最后在交給文件系統/sbin/init進(jìn)行執行。
查看捕獲內核的加載狀態(tài) 0:未加載,1:已加載
root@firefly:~# cat /sys/kernel/kexec_crash_loaded
1
查看捕獲內核的大小
root@firefly:~# cat /sys/kernel/kexec_crash_size
268435456
確認kexec_load_disabled的狀態(tài)
root@firefly:~# cat /proc/sys/kernel/kexec_load_disabled
0
kexec_load_disabled:表示kexec_load系統調用是否被禁止,此系統調用用于kdump。當發(fā)生了一次kexec_load后,此值會(huì )自動(dòng)設置為1。
在前面的準備工作完成后,如果觸發(fā)系統崩潰,系統將重新引導到轉儲-捕獲內核,觸發(fā)點(diǎn)位于panic()、die()、die_nmi()和sysrq處理程序中。接下來(lái)我將通過(guò) 魔術(shù)鍵來(lái)觸發(fā)系統panic。
開(kāi)啟sysrq
echo 1 > /proc/sys/kernel/sysrq
觸發(fā)sysrq
echo c > /proc/sysrq-trigger
觸發(fā)sysrq后,系統重啟,串口打印出標志性 log:Bye!Starting crashdump kernel...。
[06:48:37]root@firefly:~# echo c > /proc/sysrq-trigger
[06:48:37][ 28.817657] sysrq: SysRq : Trigger a crash
[06:48:37][ 28.818172] Unable to handle kernel NULL pointer dereference at virtual address 00000000
[06:48:37][ 28.818894] pgd = ffffffc0deb9d000
[06:48:37][ 28.819326] [00000000] *pgd=0000000000000000, *pud=0000000000000000
....................
[06:48:37][ 28.950698] [<ffffff80085abe98>] sysrq_handle_crash+0x24/0x30
[06:48:37][ 28.951218] [<ffffff80085ac968>] __handle_sysrq+0xa0/0x14c
[06:48:37][ 28.951713] [<ffffff80085acd94>] write_sysrq_trigger+0x5c/0x74
[06:48:37][ 28.952246] [<ffffff8008244928>] proc_reg_write+0xa8/0xcc
[06:48:37][ 28.952744] [<ffffff80081e86bc>] __vfs_write+0x48/0xe8
[06:48:37][ 28.953214] [<ffffff80081e8fa8>] vfs_write+0xa8/0x15c
[06:48:37][ 28.953674] [<ffffff80081e9948>] SyS_write+0x5c/0xb0
[06:48:37][ 28.954123] [<ffffff8008082f70>] el0_svc_naked+0x24/0x28
[06:48:37][ 28.954609] Code: 52800020 b90a1c20 d5033e9f d2800001 (39000020)
[06:48:37][ 28.955167] SMP: stopping secondary CPUs
[06:48:37][ 28.955899] Starting crashdump kernel...
[06:48:37][ 28.956264] Bye!
[06:48:51][ 0.000000] Booting Linux on physical CPU 0x101
[06:48:51][ 0.000000] Initializing cgroup subsys cp 0.000000] Initializing cgrouys cpu
[06:48:51][ 0.000000] Initializys cpuacct
[06:48:51][ 0.000000] Linux version 4.4.194+ (zhongyi@ubunty: b1730021dd51a88c333473088af3a402491b4c23) (gcc version 6.3.1 20170404 (Linaro GCC 6.3-2017.05SMP Fri Mar 3 07:48:00 CST 2023
[06:48:51][ 0.000000] Boot CPU: AArch64 Processor [410fd082]
[06:48:51][ 0.000000] earlycon: Early serial console at MMIO32 0xff1a0000 (opti '')
[06:48:51][ 0.000000] bootconsole [uart0] enabled
[06:48:51][ 0.000000] cannot allocate crashkernel (size:0x10000000)
[06:48:51][ 0.000000] Reserving 1KB of memory at 0xf5dff000 for elfcorehdr
[06:48:51][ 0.000000] psci: probing for conduit method from DT.
[06:48:51][ 0.000000] psci: PSCIv1.0 detected in firmware.
[06:48:51][ 0.000000] psci: Using standard PSCI v0.2 function IDs
[06:48:52][ 0.000000] psci: Trusted OS migration not required
[06:48:52][ 0.000000] PERCPU: Embedded 21 pages/cpu @ffffffc035cf1000 s46440 r8192 d31384 u86016
[06:48:52][ 0.000000] Detected PIPT I-cache on CPU0
[06:48:52][ 0.000000] Built 1 zonelists in Zone order, mobility grouping on. Total pages: 64512
[06:48:52][ 0.000000] Kernel command line: storagemedia=emmc androidboot.storagemedia=emmc androidboot.mode=normal storagenode=sdhci@fe330000 androidboot.slot_suffix= androidboot.serialno=3fdce35e50641399 ro rootwait earlycon=uart8250,mmio32,0xff1a0000 swiotlb=1 console=ttyFIQ0 root=PARTLABEL=rootfs rootfstype=ext4 overlayroot=device:dev=PARTLABEL=userdata,fstype=ext4,mkfs=1 coherent_pool=1m systemd.gpt_auto=0 cgroup_enable=memory swapaccount=1 crashkernel=256M
[06:48:52][ 0.000000] PID hash table entries: 1024 (order: 1, 8192 bytes)
[06:48:52][ 0.000000] Dentry cache hash table entries: 32768 (order: 6, 262144 bytes)
[06:48:52][ 0.000000] Inode-cache hash table entries: 16384 (order: 5, 131072 bytes)
[06:48:52][ 0.000000] software IO TLB: mapped [mem 0xf5c51000-0xf5c91000] (0MB)
[06:48:52][ 0.000000] Memory: 208908K/262144K available (14782K kernel code, 2146K rwdata, 6988K rodata, 1216K init, 780K bss, 53236K reserved, 0K cma-reserved)
[06:48:52][ 0.000000] Virtual kernel memory layout:
[06:48:52][ 0.000000] modules : 0xffffff8000000000 - 0xffffff8008000000 ( 128 MB)
[06:48:52][ 0.000000] vmalloc : 0xffffff8008000000 - 0xffffffbdbfff0000 ( 246 GB)
[06:48:52][ 0.000000] .init : 0xffffff80095d0000 - 0xffffff8009700000 ( 1216 KB)
[06:48:52][ 0.000000] .text : 0xffffff8008080000 - 0xffffff8008ef0000 ( 14784 KB)
[06:48:52][ 0.000000] .rodata : 0xffffff8008ef0000 - 0xffffff80095d0000 ( 7040 KB)
[06:48:52][ 0.000000] .data : 0xffffff8009700000 - 0xffffff8009918808 ( 2147 KB)
[06:48:52][ 0.000000] vmemmap : 0xffffffbdc0000000 - 0xffffffbfc0000000 ( 8 GB maximum)
[06:48:52][ 0.000000] 0xffffffbdc0978000 - 0xffffffbdc0d78000 ( 4 MB actual)
[06:48:52][ 0.000000] fixed : 0xffffffbffe7fb000 - 0xffffffbffec00000 ( 4116 KB)
[06:48:52][ 0.000000] PCI I/O : 0xffffffbffee00000 - 0xffffffbfffe00000 ( 16 MB)
[06:48:52][ 0.000000] memory : 0xffffffc025e00000 - 0xffffffc035e00000 ( 256 MB)
[06:48:52][ 0.000000] SLUB: HWalign=64, Order=0-3, MinObjects=0, CPUs=6, Nodes=1
.........................................
[06:48:54][ 2.313003] rockchip-drm display-subsystem: bound ff940000.hdmi (ops dw_hdmi_rockchip_ops)
[06:48:54][ 2.314207] i2c i2c-10: of_i2c: modalias failure on /dp@fec00000/ports
[06:48:54][ 2.315077] rockchip-drm display-subsystem: bound fec00000.dp (ops cdn_dp_component_ops)
[06:48:54][ 2.315815] [drm] Supports vblank timestamp caching Rev 2 (21.10.2013).
[06:48:54][ 2.316404] [drm] No driver support for vblank timestamp query.
[06:48:54][ 2.317133] rockchip-drm display-subsystem: connector[HDMI-A-1] can't found any modes
.................................................
[06:48:58][ 6.180434] [dhd] dhd_conf_set_path_params : Final conf_path=/vendor/etc/firmware/config.txt
[06:48:58][ 6.313492] [dhd] dhd_conf_set_txglom_params : txglom_mode=multi-desc
[06:48:58][ 6.314159] [dhd] dhd_conf_set_txglom_params : txglomsize=36, deferred_tx_len=0
[06:48:58][ 6.314868] [dhd] dhd_conf_set_txglom_params : txinrx_thres=128d_txminmax=-1
[06:48:58][ 6.315529] [ddhd_conf_set_txglom_params : tx__offset=0, txctl_tmo_fix=300
[06:48:58][ 6.316245] [dhd] dhd_conf_get_disable_proptx : fw_proptx=1, disable_proptx=-1
[06:48:58][ 6.380768] [dhd] dhd_conf_map_country_list : CN/38
[06:48:58][ 6.381222] [dhd] dhd_conf_set_country : set country CN, revision 38
[06:48:58][ 6.385992] [dhd] dhd_conf_set_country : Country code: CN (CN/38)
[06:48:58][ OK ] Started Network Manager.
[06:48:58][ OK ] Reached target Network.
[06:48:58] Starting Permit User Sessions...
[06:48:58] Starting OpenBSD Secure Shell server...
[06:48:58][ OK ] Started Permit User Sessions.
[06:48:58] Starting Hold until boot process finishes up...
[06:48:58][ OK ] Started Hold until boot process finishes up.
[06:48:58][ OK ] Started Serial Getty on ttyFIQ0.
[06:48:58] Starting Set console scheme...
[06:48:58][ OK ] Started Set console scheme.
[06:48:58][ OK ] Created slice system-getty.slice.
[06:48:58][ OK ] Started Getty on tty1.
[06:48:58][ OK ] Reached target Login Prompts.
[06:48:58][ OK ] Started OpenBSD Secure Shell server.
[06:48:58][ OK ] Started Adbd for linux.
[06:48:58][ OK ] Started Setup rockchip platform environment.
[06:48:58] Starting Light Display Manager...
[06:48:58][ OK ] Reached target Multi-User System.
[06:48:59][ OK ] Started Light Display Manager.
[06:48:59][ OK ] Reached target Graphical Interface.
[06:48:59] Starting Update UTMP about System Runlevel Changes...
[06:48:59][ OK ] Started Update UTMP about System Runlevel Changes.
[06:48:59]
[06:48:59]Ubuntu 18.04.6 LTS firefly ttyFIQ0
[06:49:39]root@firefly:~# ls -al /proc/vmcore
[06:49:41]-r-------- 1 root root 3885387776 Mar 5 22:49 /proc/vmcore
[06:50:24]root@firefly:~# ls -al --block-size=m /proc/vmcore
系統正常啟動(dòng)后,就可以將/proc/vmcore文件拷貝出來(lái)在ubuntu上用crash工具分析。
不清楚是宿主機的原因還是代碼原因,目前主線(xiàn)的 Linux kernel 代碼在執行命令使第一個(gè)內核崩潰之后,跳轉到第二個(gè)內核的過(guò)程中卡死,在社區上也有其他人遇到了類(lèi)似的情況并給出了補丁,但是并沒(méi)有合并到主線(xiàn),不過(guò)目前為了演示暫時(shí)不考慮為何原因導致這個(gè)問(wèn)題的出現,如果你的 arm64 不存在這個(gè)問(wèn)題,那么就不需要打這個(gè)補丁了。奉上補丁如下:
diff --git a/arch/arm64/kernel/machine_kexec.c b/arch/arm64/kernel/machine_kexec.c
index aa9c94113700..3b0350d20e31 100644
--- a/arch/arm64/kernel/machine_kexec.c
+++ b/arch/arm64/kernel/machine_kexec.c
@@ -234,19 +234,12 @@ static void machine_kexec_mask_interrupts(void)
for_each_irq_desc(i, desc) {
struct irq_chip *chip;
- int ret;
chip = irq_desc_get_chip(desc);
if (!chip)
continue;
- /*
- * First try to remove the active state. If this
- * fails, try to EOI the interrupt.
- */
- ret = irq_set_irqchip_state(i, IRQCHIP_STATE_ACTIVE, false);
-
- if (ret && irqd_irq_inprogress(&desc->irq_data) &&
+ if (irqd_irq_inprogress(&desc->irq_data) &&
chip->irq_eoi)
chip->irq_eoi(&desc->irq_data);
還有一點(diǎn)需要說(shuō)明的就是在 Ubuntu 默認倉庫的 crash 不支持最新版本的 Linux 內核,需要更新到 7.2.5 版本才可以。
按照kdump執行流程,確定問(wèn)題來(lái)自那個(gè)階段。
預留內存過(guò)大,設備沒(méi)有足夠的可用內存。默認會(huì )在0~4G預留內存。比如預留512M的空間,而在0~4G并沒(méi)有可用的512M空間,就會(huì )導致預留失敗。
是否預留內存,crashkernel是否配置?
預留內存失敗。
預留內存成功:嘗試使用kexec -d -p 查看失敗的具體原因。
打印出bye后沒(méi)有任何信息輸出,可能是第二內核可能未配置串口,earlycon/console
oom后卡死,可能是預留內存太小。
驅動(dòng)初始化失敗。有些驅動(dòng),比如dma32,可能只能使用0~4G內存,在4G以上預留內存會(huì )導致驅動(dòng)加載失敗。
加上-D,打印出debug選項,查看失敗原因。
kernel,kexec,makedumpfile,crash匹配問(wèn)題,更新到最新的工具。
https://lore.kernel.org/lkml/ba0c6804-51a3-f36e-a67e-20ce84961451@arm.com/T/
https://www.cnblogs.com/shineshqw/articles/2359114.html
https://wiki.archlinux.org/title/Kdump
https://kaiwantech.wordpress.com/2017/07/13/setting-up-kdump-and-crash-for-arm-32-an-ongoing-saga/
https://juejin.cn/post/7115949300147814430
https://blog.csdn.net/Luckiers/article/details/124581570

END
聯(lián)系客服