File kdump-add-requires-mounts-for-into-systemd-unit.patch of Package kdump
From: Petr Tesarik <ptesarik@suse.com>
Subject: Add RequiresMountsFor= line to kdump-save.service
References: bsc#936363, bsc#936475, bsc#936489
Patch-mainline: v0.8.16
Git-commit: 27a14cde287a8ddab2221e1dc5b342e5a735c7ee
If one of the required mounts times out, the systemd transaction does
not fail, and systemd may try to start kdump-save.service before the
required mounts are available. Adding all required mounts as requirement
prevents such failures.
Idea-from: Roberto Sassu <rsassu@suse.com>
Signed-off-by: Petr Tesarik <ptesarik@suse.com>
---
init/CMakeLists.txt | 2 +-
init/kdump-save.service | 31 -------------------------------
init/kdump-save.service.in | 31 +++++++++++++++++++++++++++++++
init/module-setup.sh | 7 +++++--
4 files changed, 37 insertions(+), 34 deletions(-)
--- a/init/module-setup.sh
+++ b/init/module-setup.sh
@@ -146,8 +146,11 @@ install() {
"$systemdutildir"/system-generators/kdump-device-timeout-generator
inst_simple /lib/kdump/save_dump.sh
- inst_simple "$moddir/kdump-save.service" \
- "$systemdsystemunitdir"/kdump-save.service
+ awk -v mountpoints="${kdump_mnt[*]}" '{
+ gsub(/@KDUMP_MOUNTPOINTS@/, mountpoints)
+ print
+ }' "$moddir/kdump-save.service.in" > \
+ "$initdir/$systemdsystemunitdir"/kdump-save.service
ln_r "$systemdsystemunitdir"/kdump-save.service \
"$systemdsystemunitdir"/initrd.target.wants/kdump-save.service
else
--- a/init/kdump-save.service
+++ /dev/null
@@ -1,31 +0,0 @@
-# This file is part of systemd.
-#
-# systemd is free software; you can redistribute it and/or modify it
-# under the terms of the GNU Lesser General Public License as published by
-# the Free Software Foundation; either version 2.1 of the License, or
-# (at your option) any later version.
-
-# See systemd.special(7) for details
-
-[Unit]
-Description=save kernel crash dump
-Documentation=man:kdump(7)
-Wants=dracut-mount.service dracut-pre-pivot.service
-After=dracut-mount.service dracut-pre-pivot.service
-After=initrd.target
-Before=initrd-cleanup.service
-ConditionPathExists=/etc/initrd-release
-ConditionPathExists=/proc/vmcore
-
-[Service]
-Type=oneshot
-ExecStart=/lib/kdump/save_dump.sh
-StandardInput=tty
-StandardOutput=tty
-StandardError=tty
-KillMode=process
-RemainAfterExit=yes
-
-# Bash ignores SIGTERM, so we send SIGHUP instead, to ensure that bash
-# terminates cleanly.
-KillSignal=SIGHUP
--- /dev/null
+++ b/init/kdump-save.service.in
@@ -0,0 +1,31 @@
+# This file is part of systemd.
+#
+# systemd is free software; you can redistribute it and/or modify it
+# under the terms of the GNU Lesser General Public License as published by
+# the Free Software Foundation; either version 2.1 of the License, or
+# (at your option) any later version.
+
+# See systemd.special(7) for details
+
+[Unit]
+Description=save kernel crash dump
+Documentation=man:kdump(7)
+RequiresMountsFor=@KDUMP_MOUNTPOINTS@
+Wants=dracut-mount.service dracut-pre-pivot.service
+After=dracut-mount.service dracut-pre-pivot.service
+Before=initrd-cleanup.service
+ConditionPathExists=/etc/initrd-release
+ConditionPathExists=/proc/vmcore
+
+[Service]
+Type=oneshot
+ExecStart=/lib/kdump/save_dump.sh
+StandardInput=tty
+StandardOutput=tty
+StandardError=tty
+KillMode=process
+RemainAfterExit=yes
+
+# Bash ignores SIGTERM, so we send SIGHUP instead, to ensure that bash
+# terminates cleanly.
+KillSignal=SIGHUP
--- a/init/CMakeLists.txt
+++ b/init/CMakeLists.txt
@@ -97,7 +97,7 @@ INSTALL(
INSTALL(
FILES
- ${CMAKE_CURRENT_SOURCE_DIR}/kdump-save.service
+ ${CMAKE_CURRENT_SOURCE_DIR}/kdump-save.service.in
DESTINATION
/usr/lib/dracut/modules.d/99kdump
PERMISSIONS