Hi,
Thank you very much for the fast turn-around on this!
Colin built a test Atomic tree that included kexec-tools-2.0.7-17.el7.x86_64. I removed the previous initramfs-kdump.img and rebooted.
After reboot, the kdump service was able to automatically locate the /boot/ostree/* directory containing the kernel vmlinuz and build a new initramfs-kdump.img. I then crashed the system. Here is a snippet from the console log:
kdump: dump target is /dev/mapper/atomicos-root kdump: saving to /sysroot//crash/127.0.0.1-2015.01.30-14:15:47/ kdump: saving vmcore-dmesg.txt kdump: saving vmcore-dmesg.txt complete kdump: saving vmcore Copying data : [100.0 %] - kdump: saving vmcore complete Stopping Kdump Vmcore Save Service... [ OK ] Stopped Kdump Vmcore Save Service.
And after boot:
-bash-4.2# ls -alhR /sysroot/crash /sysroot/crash: total 4.0K drwxr-xr-x. 3 root root 42 Jan 30 14:15 . drwxr-xr-x. 12 root root 4.0K Jan 30 14:15 .. drwxr-xr-x. 2 root root 42 Jan 30 14:15 127.0.0.1-2015.01.30-14:15:47
/sysroot/crash/127.0.0.1-2015.01.30-14:15:47: total 185M drwxr-xr-x. 2 root root 42 Jan 30 14:15 . drwxr-xr-x. 3 root root 42 Jan 30 14:15 .. -rw-------. 1 root root 185M Jan 30 14:15 vmcore -rw-r--r--. 1 root root 40K Jan 30 14:15 vmcore-dmesg.txt
-bash-4.2# grep KDUMP_BOOTDIR /etc/sysconfig/kdump #KDUMP_BOOTDIR="/boot"
-bash-4.2# rpm -q kexec-tools kexec-tools-2.0.7-17.el7.x86_64
----- Original Message -----
From: "Baoquan He" bhe@redhat.com To: kexec@lists.fedoraproject.org Cc: "Baoquan He" bhe@redhat.com Sent: Thursday, January 29, 2015 10:17:04 PM Subject: [Patch v6] kdumpctl: adjust the boot dir if kernel is put in sub dir of /boot
Previously /boot is asumed as the default dir where kernel and initrd is put. However, the directory containing the running kernel image on Atomic systems differs in each installation. Usually something like:
/boot/ostree/rhel-atomic-host-b50a015b637c353dc6554c851f8a1212b60d6121a7316715e4a63e2a4113cd72
This means that kdump will not find vmlinuz when installed on an Atomic host, and thus the kdump service will fail to start.
In this patch, the kdump boot dir finding behaviour is a little changed. Firstly check whether user has specify a directory explicitly in /etc/sysconfig/kdump. If yes that is respected. Otherwise we assume 1st kernel and kdump kernel are put in the same place under /boot. Then find it according /proc/cmdline and append it to /boot/
Note: So now the KDUMP_BOOTDIR in /etc/sysconfig/kdump is set as empty by default. If user set KDUMP_BOOTDIR to a directory, then he need to take care of all related things himself. otherwise kdump script handle it automatically.
Signed-off-by: Baoquan He bhe@redhat.com
kdump.sysconfig.i386 | 2 +- kdump.sysconfig.ppc64 | 2 +- kdump.sysconfig.ppc64le | 2 +- kdump.sysconfig.s390x | 2 +- kdump.sysconfig.x86_64 | 2 +- kdumpctl | 19 +++++++++++++++++++ kexec-kdump-howto.txt | 10 ++++++++++ 7 files changed, 34 insertions(+), 5 deletions(-)
diff --git a/kdump.sysconfig.i386 b/kdump.sysconfig.i386 index 0d26a66..84b2447 100644 --- a/kdump.sysconfig.i386 +++ b/kdump.sysconfig.i386 @@ -26,7 +26,7 @@ KDUMP_COMMANDLINE_APPEND="irqpoll nr_cpus=1 reset_devices numa=off udev.children KEXEC_ARGS=""
#Where to find the boot image -KDUMP_BOOTDIR="/boot" +#KDUMP_BOOTDIR="/boot"
#What is the image type used for kdump KDUMP_IMG="vmlinuz" diff --git a/kdump.sysconfig.ppc64 b/kdump.sysconfig.ppc64 index 923aa26..5295626 100644 --- a/kdump.sysconfig.ppc64 +++ b/kdump.sysconfig.ppc64 @@ -26,7 +26,7 @@ KDUMP_COMMANDLINE_APPEND="irqpoll maxcpus=1 noirqdistrib reset_devices cgroup_di KEXEC_ARGS=""
#Where to find the boot image -KDUMP_BOOTDIR="/boot" +#KDUMP_BOOTDIR="/boot"
#What is the image type used for kdump KDUMP_IMG="vmlinuz" diff --git a/kdump.sysconfig.ppc64le b/kdump.sysconfig.ppc64le index 923aa26..5295626 100644 --- a/kdump.sysconfig.ppc64le +++ b/kdump.sysconfig.ppc64le @@ -26,7 +26,7 @@ KDUMP_COMMANDLINE_APPEND="irqpoll maxcpus=1 noirqdistrib reset_devices cgroup_di KEXEC_ARGS=""
#Where to find the boot image -KDUMP_BOOTDIR="/boot" +#KDUMP_BOOTDIR="/boot"
#What is the image type used for kdump KDUMP_IMG="vmlinuz" diff --git a/kdump.sysconfig.s390x b/kdump.sysconfig.s390x index 848b043..745dd27 100644 --- a/kdump.sysconfig.s390x +++ b/kdump.sysconfig.s390x @@ -29,7 +29,7 @@ MKDUMPRD_ARGS="" KEXEC_ARGS=""
#Where to find the boot image -KDUMP_BOOTDIR="/boot" +#KDUMP_BOOTDIR="/boot"
#What is the image type used for kdump KDUMP_IMG="vmlinuz" diff --git a/kdump.sysconfig.x86_64 b/kdump.sysconfig.x86_64 index 989c3c7..d9ad9b5 100644 --- a/kdump.sysconfig.x86_64 +++ b/kdump.sysconfig.x86_64 @@ -26,7 +26,7 @@ KDUMP_COMMANDLINE_APPEND="irqpoll nr_cpus=1 reset_devices cgroup_disable=memory KEXEC_ARGS=""
#Where to find the boot image -KDUMP_BOOTDIR="/boot" +#KDUMP_BOOTDIR="/boot"
#What is the image type used for kdump KDUMP_IMG="vmlinuz" diff --git a/kdumpctl b/kdumpctl index 1c97405..31ceb47 100755 --- a/kdumpctl +++ b/kdumpctl @@ -292,6 +292,23 @@ get_pcs_cluster_modified_files() echo $modified_files }
+check_boot_dir() +{
- local _is_atomic
- #If user specify a boot dir for kdump kernel, let's use it. Otherwise
- #check whether it's a atomic host. If yes parse the subdirectory under
- #/boot; If not just find it under /boot.
- [ -n "$KDUMP_BOOTDIR" ] && return
- _is_atomic=$(cat /proc/cmdline | grep "ostree")
- if [ -z "$_is_atomic" ] || [ "$(uname -m)" = "s390x" ]; then
KDUMP_BOOTDIR="/boot"
- else
eval $(cat /proc/cmdline| grep "BOOT_IMAGE" | cut -d' ' -f1)
KDUMP_BOOTDIR="/boot"$(dirname $BOOT_IMAGE)
- fi
+}
setup_target_initrd() { if [ $DEFAULT_DUMP_MODE == "fadump" ]; then @@ -311,6 +328,8 @@ check_rebuild() local _force_rebuild force_rebuild="0" local initramfs_has_fadump
- check_boot_dir
- if [ -z "$KDUMP_KERNELVER" ]; then kdump_kver=`uname -r` else
diff --git a/kexec-kdump-howto.txt b/kexec-kdump-howto.txt index 5582e40..05b497f 100644 --- a/kexec-kdump-howto.txt +++ b/kexec-kdump-howto.txt @@ -404,6 +404,16 @@ Say foo.com:/export/tmp is mounted on /var. In this case dump target is nfs server and path will be adjusted to "/crash" and dump will be saved to foo.com:/export/tmp/crash/ directory.
+Kdump boot directory +==================== +Usually kdump kernel is the same as 1st kernel. So kdump will try to find +kdump kernel under /boot according to /proc/cmdline. E.g we execute below +command and get an output:
- cat /proc/cmdline
- BOOT_IMAGE=/xxx/vmlinuz-3.yyy.zzz root=xxxx .....
+Then kdump kernel will be /boot/xxx/vmlinuz-3.yyy.zzz. +However a variable KDUMP_BOOTDIR in /etc/sysconfig/kdump is provided to +user if kdump kernel is put in a different directory.
Kdump Post-Capture Executable
-- 1.8.5.3
kexec mailing list kexec@lists.fedoraproject.org https://lists.fedoraproject.org/mailman/listinfo/kexec