On Thu, Jan 29, 2015 at 04:06:15PM +0800, Baoquan He wrote:
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.
I am not a big fan of changing anything in /etc/sysconfig/kdump until
and unless we have to.
Reason being that this does not work over upgrades. So assume that you
have already shipped a version of kexec-tools for atomic and now you
are upgrading it to new version. In that case old /etc/sysconfig/kdump
will be used and things will still be broken. So in general changing
what we have already shipped can create problems.
In this case, GA is yet to go out of door, so it might fly. But then
it creates confusion for our regular customers who might be surprised
to see the empty BOOT dir.
Even if we have to do it this way, I think it might be better to *not*
specify a value of BOOT and just keep it commented out. That would mean
that kdump logic can assume its own default values.
I am not sure that what's wrong with the approach to look for kernel in
/boot/ direcotry first and if we don't find it there, then adjust to
/boot/<atomic>/ dir.
Anyway, I can live with this solution too (though I am not too happy
about changing current options in /etc/sysconfig/kdump.). So let us
atleasts comment out BOOT optoin instead of assuming that blank means
we can choose our own /boot.
Signed-off-by: Baoquan He <bhe(a)redhat.com>
---
kdump.sysconfig.i386 | 4 ++--
kdump.sysconfig.ppc64 | 4 ++--
kdump.sysconfig.ppc64le | 4 ++--
kdump.sysconfig.s390x | 4 ++--
kdump.sysconfig.x86_64 | 4 ++--
kdumpctl | 17 +++++++++++++++++
kexec-kdump-howto.txt | 10 ++++++++++
7 files changed, 37 insertions(+), 10 deletions(-)
diff --git a/kdump.sysconfig.i386 b/kdump.sysconfig.i386
index 0d26a66..bb10c93 100644
--- a/kdump.sysconfig.i386
+++ b/kdump.sysconfig.i386
@@ -25,8 +25,8 @@ KDUMP_COMMANDLINE_APPEND="irqpoll nr_cpus=1 reset_devices numa=off
udev.children
# KEXEC_ARGS="--elf32-core-headers"
KEXEC_ARGS=""
-#Where to find the boot image
-KDUMP_BOOTDIR="/boot"
+#Where to find the boot image, you can specify a place here.
+KDUMP_BOOTDIR=""
Let us comment it out. And put a comment that if one does not specify
it then scripts will choose its own default. In most of the systems
it will be /boot and in atomic systems it will be a subdirectory of
/boot.
[..]
--- a/kdumpctl
+++ b/kdumpctl
@@ -292,6 +292,21 @@ get_pcs_cluster_modified_files()
echo $modified_files
}
+check_boot_dir()
+{
How about calling it set_default_boot_dir().
+ local _boot_dir
+ #If user specify a boot dir for kdump kernel, let's use it. Otherwise
+ #assume it's in the same place as 1st kernel.
+ [ -n "$KDUMP_BOOTDIR" ] && return
+ _boot_dir=$(cat /proc/cmdline | grep "BOOT_IMAGE")
+ if [ -z "$_boot_dir" ]; then
+ KDUMP_BOOTDIR="/boot"
+ else
+ eval $(echo "$_boot_dir" | cut -d' ' -f1)
+ KDUMP_BOOTDIR="/boot"$(dirname $BOOT_IMAGE)
+ fi
+}
+
setup_target_initrd()
{
if [ $DEFAULT_DUMP_MODE == "fadump" ]; then
@@ -311,6 +326,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
Thanks
Vivek