When there's no kdump initramfs for lsinitrd to inspect with, there will
be an error:
# kdumpctl start
/boot/initramfs-3.16.0-rc7+kdump.img does not exist
Usage: lsinitrd [options] [<initramfs file> [<filename> [<filename> [...] ]]]
Usage: lsinitrd [options] -k <kernel version>
-h, --help print a help message and exit.
-s, --size sort the contents of the initramfs by size.
-m, --mod list modules.
-f, --file <filename> print the contents of <filename>.
-k, --kver <kernel version> inspect the initramfs of <kernel version>.
No kdump initial ramdisk found.
If kdump initramfs doesn't exist, we simply mark the inspecting kdump
module failing. It wouldn't matter, because we need to build kdump
Signed-off-by: WANG Chao <chaowang(a)redhat.com>
kdumpctl | 6 +++++-
1 file changed, 5 insertions(+), 1 deletion(-)
diff --git a/kdumpctl b/kdumpctl
index 98de747..4f50dcb 100755
@@ -364,7 +364,11 @@ check_rebuild()
#check if target initrd has fadump support
- initramfs_has_fadump=`lsinitrd -m $TARGET_INITRD | grep ^kdumpbase$ | wc -l`
+ if [ -f $TARGET_INITRD ]; then
+ initramfs_has_fadump=`lsinitrd -m $TARGET_INITRD | grep ^kdumpbase$ | wc -l`
if [ $image_time -eq 0 ]; then
echo -n "No kdump initial ramdisk found."; echo
Now upon failure kdump script might not be called at all and it might
not be able to execute default action. It results in a hang.
Because we disable emergency shell and rely on kdump.sh being invoked
through dracut-pre-pivot hook. But it might happen that we never call
into dracut-pre-pivot hook because certain systemd targets could not
reach due to failure in their dependencies. In those cases error
handling code does not run and system hangs.
To solve this problem, we need to separate the error handling code from
dracut-pre-pivot hook, and every time when a failure shows up, the
separated code can be called by the emergency service.
By default systemd provides an emergency service which will drop us into
shell every time upon a critical failure. It's very convenient for us to
re-use the framework of systemd emergency, because we don't have to
touch the other parts of systemd. We can use our own script instead of
the default one.
This new scheme will overwrite emergency shell and replace with kdump
error handling code. And this code will do the error handling as needed.
Now, we will not rely on dracut-pre-pivot hook running always. Instead
whenever error happens and it is serious enough that emergency shell
needed to run, now kdump error handler will run.
This patchset introduce a new kdump emergency service. It will override the
existing emergency.service. When fatal error occurs, this emergency service
will be triggered and systemd will isolate to emergency path.
This kdump emergency service is a wrapper service and it will isolate to
kdump-error-handler service. kdump-error-handler can will read kdump.conf and
act according to the configired "default action"
Along with this patchset, kdump-capture.service is introduced as a service unit
to run kdump.sh. When kdump-capture.service fails, systemd will isolate to
kdump emergency service. I copied all the dependencies from
dracut-pre-pivot.service to kdump-capture.service so that kdump.sh will be
called at the correct time window.
Address several comments from Vivek:
- split [patch 1] into 1/6 and 2/6
- remove several unnecessary lines in service unit.
- modify the description of kdump-capture.service
- introduce another kdump lib kdump-lib-2.sh used in 2nd kernel.
Address several comments from Vivek:
- update description of [PATCH 1/5] and [PATCH 5/5]
- separate the patch of cleanup to kdump-lib-initramfs.sh
Address several comments from Vivek and Dave:
- meld the original [PATCH 3/5] into [PATCH 1/5]
- add GPL license for kdump-error-handler.service and kdump-capture.service
- separate the "x-initrd.mount" and "mount under /sysroot" patch to another
- Rebase on top of the fadump patchset.
- Enable dracut-emergency again, but override it with kdump error handler.
- reboot if entering error handler in error handling path
- add comments in dracut-kdump-emergency.service
- update changelog
- add wrapper emergency.service to isolate to kdump-error-handler service
- remove extra code introduced in v6 for avoiding entering error path again
WANG Chao (2):
Introduce kdump error handling service
Introduce kdump capture service
dracut-kdump-capture.service | 30 ++++++++++++++++++++++++++++++
dracut-kdump-emergency.service | 27 +++++++++++++++++++++++++++
dracut-kdump-error-handler.service | 34 ++++++++++++++++++++++++++++++++++
dracut-kdump-error-handler.sh | 10 ++++++++++
dracut-kdump.sh | 9 ++-------
dracut-module-setup.sh | 11 +++++++++--
kdump-lib-initramfs.sh | 34 ++++++++++++++++++++++++++++++----
kexec-tools.spec | 9 ++++++++-
8 files changed, 150 insertions(+), 14 deletions(-)
create mode 100644 dracut-kdump-capture.service
create mode 100644 dracut-kdump-emergency.service
create mode 100644 dracut-kdump-error-handler.service
create mode 100755 dracut-kdump-error-handler.sh