[PATCH] mkdumprd: allow spaces after 'path' config phrase when network dump
by Kazuhito Hagio
Without this patch, when there are two or more spaces after 'path'
configuration phrase with ssh or nfs setting, SAVE_PATH is set to
'/var/crash' in mkdumprd, and in most cases kdump service fails to
start.
ssh kdump(a)192.168.122.1
path /kdump
^^
This behavior would be too sensitive and different from the other
configurations. With this patch, mkdumprd allows such spaces.
Signed-off-by: Kazuhito Hagio <k-hagio(a)ab.jp.nec.com>
---
mkdumprd | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/mkdumprd b/mkdumprd
index a6f7fe8..aa0abfd 100644
--- a/mkdumprd
+++ b/mkdumprd
@@ -13,7 +13,7 @@ export IN_KDUMP=1
conf_file="/etc/kdump.conf"
SSH_KEY_LOCATION="/root/.ssh/kdump_id_rsa"
-SAVE_PATH=$(grep ^path $conf_file| cut -d' ' -f2)
+SAVE_PATH=$(awk '/^path/ {print $2}' $conf_file)
[ -z "$SAVE_PATH" ] && SAVE_PATH=$DEFAULT_PATH
# strip the duplicated "/"
SAVE_PATH=$(echo $SAVE_PATH | tr -s /)
--
2.18.0
1 year, 4 months
Re: [dm-crypt] Kdump with full-disk LUKS encryption
by Kairui Song
Hi,
Thanks a lot, these info are very helpful.
Better to keep it for debugging for now, and ask users to use it very carefully.
On Tue, Apr 20, 2021 at 3:54 PM Milan Broz <gmazyland(a)gmail.com> wrote:
>
> Hi,
>
> TL;DR what you are trying to do is to actually reverse many security measures
> we added. It is perhaps acceptable for debugging but hardly for real generic system.
>
> - using memory-hard function increases cost of dictionary and brute-force
> attacks
> You can always decrease amount of memory needed, but you should do it only
> if you know that security margin is ok (like password is randomly generated
> with enough entropy).
>
> - key is in keyring to remove possibility for normal userspace to receive
> the key from kernel. Moreover, there is no need to retain kernel in keyring once
> dm-crypt device is activated. (It is still in kernel memory but only in crypto
> functions context). (Systemd also uses keyring to cache passphrase but that's
> different thing.)
>
> You can still use old way for activation with --disable-keyring activation,
> but then you disable this possibility.
>
> More comments below.
>
> On 19/04/2021 12:00, Kairui Song wrote:
> > Hi all,
> >
> > I'm currently trying to add kdump support for systemd with full-disk
> > LUKS encryption. vmcores contain sensitive data so they should also be
> > protected, and network dumps sometimes are not available. So kdump has
> > to open the LUKS encrypted device in the kdump environment.
> >
> > I'm using systemd/dracut, my work machine is running Fedora 34, and
> > there are several problems I'm trying to solve:
> > 1. Users have to input the password in the kdump kernel environment.
> > But users often don't have shell access to the kdump environment.
> > (headless server, graphic card not working after kexec, both are very
> > common)
> > 2. LUKS2 prefers Argon2 as the key derivation function, designed to
> > use a lot of memory. kdump is expected to use a minimal amount of
> > memory. Users will have to reserve a huge amount of memory for kdump
> > to work (eg. 1G reserve for kdump with 4G total memory which is not
> > reasonable).
>
> When I added Argon2 to LUKS2, I actually expected such issues. Despite
> some people beats me that they cannot use arbitrary amount of memory,
> we have some hard limits that were selected that it should work on most recent
> systems. Maybe kdump can live with it.
>
> - maximum memory cost limit is 4GB, no LUKS2 device can use more for Argon2
> - we never use more than half of available physical memory
> (measured on the host where the device was formatted)
> - required amount of memory is visible in LUKS2 metadata (luksDump)
> for the particular keyslot (Memory: the value is in kB)
> - we use benchmark to calculate memory cost with prefered unlocking
> time 2 seconds (again, on the device where LUKS was formatted)
> Small systems (like RPi2) the uses much smaller acceptable values.
> You can configure all costs (time, memory, threads) during format
> or even set them to predefined values.
>
> I am sorry, but there is really no way around this - and the requeired
> memory must be physical memory (otherwise it slows down extremely).
> This is a feature, not a bug :-)
>
>
> > To fix these problems, I tried to pass the master key to the second
> > kernel directly via initramfs. Kdump will modify the initramfs in
> > ramfs to include the key, kexec_load it, and never write to any actual
> > back storage. This worked with old LUKS configurations.
>
> Well, passing volume key this way is quite insecure, but perhaps
> acceptable for debugging.
>
> >
> > But LUKS2/cryptsetup now stores the key in the kernel keyring by
> > default. The key is accessible from userspace.
>
> If you are talking about volume key (not passsphrase), it is not
> available from userspace. Only reference to it. But you can use
> this reference to construct in-kernel dm-crypt device.
> Please read https://gitlab.com/cryptsetup/cryptsetup/-/blob/master/docs/Keyring.txt
>
> > Users can enter the password to start kdump manually and then it will
> > work, but usually people expect kdump service to start automatically.
> >
> > (WIP patch series:
> > https://lists.fedoraproject.org/archives/list/kexec@lists.fedoraproject.o...)
> >
> > I've several ideas about how to improve it but not sure which one is
> > better, and if this is a good idea after all:
> > 1. Simply introduce a config to let systemd-cryptsetup disable kernel
> > keyring on setup, there is currently no such option.
>
> Well, that option could be useful anyway and we have support for it
> in cryptsetup (--disable-keyring CLI option) and libcryptsetup, so why not.
> Just this should not be a default option.
>
> This is should be patch for systemd-cryptsetup only as libcryptsetup supports it.
>
> ...
>
> > 2. If we can let the key stay in userspace for a little longer, eg.
> > for systems booted with dracut/systemd, when
> > systemd-cryptsetup(a)%s.service opens the crypt device, keep the key in
> > dm-crypt. And later when services like kdump have finished loading,
> > cryptsetup can refresh the device and store the key in the kernel
> > keyring again.
>
> We invalidate volume key in keyring after libceyposetup operation
> is finished (and kernel removes the reference once keyring garbage collection
> is run).
>
> I can imagine to add some option to keep key inside keyring even after
> call is finished, but as said above, this removes some security margin
> we intentionally introduced here.
I agree with your comments, thanks! These two approaches seem not a
good idea now.
>
> ...
>
> Milan
>
How about plan 3 and 4?
> 3. Let kdump use some custom helper/service to load all needed
> resources in the early initrd boot stage, prior to
> systemd-cryptsetup(a)%s.service. It will ask the password / parse the
> keyfile and load kdump, then provide info for systemd-cryptsetup or
> just do the setup. Or maybe let systemd-cryptsetup support some kind
> of "plugins" so other tools can use it.
Some details could be changed/improved, but
systemd-cryptsetup(a)%s.service will prompt for a password or use a
keyfile anyway.
So I think at this point, loading kdump with the volume key should be
safe? At least long as the kdump kernel/environment itself isn't
compromised. Loaded kdump resources can be restricted to be only
accessible from the kernel side.
After panic, kernel kexec jumps to kdump kernel, and that's an
minimized emergency environment that only lives for a very short
period.
> 4. A better and safer solution seems to keep a consistent key ring
> between kexec boots but also more complex and difficult as different
> arch implements kexec differently.
Maybe plan 4 will be a good idea if doable? Since that keeps the key
consistent in the kernel between kexec boots, and cryptsetup can just
reuse it.
--
Best Regards,
Kairui Song
1 year, 11 months
[PATCH v4] selftest: kill VM reliably by recursively kill children processes
by Coiby Xu
qemu is launched in nested subprocess and can't be killed by simply
killing the job ids,
PID Command
2269634 │ ├─ sshd: root [priv]
2269637 │ │ └─ sshd: root@pts/0
2269638 │ │ └─ -bash
2269744 │ │ └─ make test-run V=1
2273117 │ │ └─ /bin/bash /root/kexec-tools-300/tests/scripts/run-test.sh
2273712 │ │ ├─ /bin/bash /root/kexec-tools-300/tests/scripts/run-test.sh
2273714 │ │ │ └─ /bin/bash /root/kexec-tools-300/tests/scripts/run-test.sh
2273737 │ │ │ └─ timeout --foreground 10m /root/kexec-tools-300/tests/scripts/run-qemu -nodefaults -nographic -smp 2 -m 768M -monitor no
2273738 │ │ │ └─ /usr/bin/qemu-system-x86_64 -enable-kvm -cpu host -nodefaults -nographic -smp 2 -m 768M -monitor none -serial stdio
2273746 │ │ │ ├─ /usr/bin/qemu-system-x86_64 -enable-kvm -cpu host -nodefaults -nographic -smp 2 -m 768M -monitor none -serial std
2273797 │ │ ├─ /bin/bash /root/kexec-tools-300/tests/scripts/run-test.sh
2273798 │ │ │ └─ /bin/bash /root/kexec-tools-300/tests/scripts/run-test.sh
2273831 │ │ │ └─ timeout --foreground 10m /root/kexec-tools-300/tests/scripts/run-qemu -nodefaults -nographic -smp 2 -m 768M -monitor no
2273832 │ │ │ └─ /usr/bin/qemu-system-x86_64 -enable-kvm -cpu host -nodefaults -nographic -smp 2 -m 768M -monitor none -serial stdio
2273840 │ │ │ ├─ /usr/bin/qemu-system-x86_64 -enable-kvm -cpu host -nodefaults -nographic -smp 2 -m 768M -monitor none -serial std
This led to the error "qemu-system-x86_64: can't bind ip=0.0.0.0 to
socket: Address already in use".
This patch will kill qemu by killing all the children of the job id.
Signed-off-by: Coiby Xu <coxu(a)redhat.com>
---
Thanks to Kairui for finding out an error and an issue about previous
version,
- "$_job" should be used instead "$job"
- "Ctrl-c" leads to the failure of parsing pstree result
This version stops parsing pstree and use pgrep to get the children of a
process and kill them recursively instead.
---
tests/scripts/run-test.sh | 37 +++++++++++++++++++++++++++++++++----
tests/scripts/test-lib.sh | 3 +--
2 files changed, 34 insertions(+), 6 deletions(-)
diff --git a/tests/scripts/run-test.sh b/tests/scripts/run-test.sh
index a68504d..7113be8 100755
--- a/tests/scripts/run-test.sh
+++ b/tests/scripts/run-test.sh
@@ -1,9 +1,38 @@
#!/bin/bash
-_kill_all_jobs() {
- local _jobs=$(jobs -r -p)
+_kill_if_valid_pid() {
+ local _pid="$1"
+ if ps -p $_pid > /dev/null
+ then
+ kill $_pid
+ fi
+}
+
+_recursive_kill() {
+ local _pid="$1"
+ local _children _child
+
+ _children=$(pgrep -P $_pid)
+ if [ -n "$_children" ]; then
+ for _child in $_children
+ do
+ _recursive_kill $_child
+ _kill_if_valid_pid $_child
+ done
+ fi
+ _kill_if_valid_pid $_pid
+}
- [ -n "$_jobs" ] && kill $_jobs
+_kill_all_jobs() {
+ local _jobs=$(jobs -r -p)
+ local _job
+
+ if [ -n "$_jobs" ]; then
+ for _job in $_jobs
+ do
+ _recursive_kill $_job
+ done
+ fi
}
trap '
@@ -121,7 +150,7 @@ for test_case in $testcases; do
[ $? -ne 0 ] && ret=$(expr $ret + 1)
results[$test_case]="$res"
-
+ _kill_all_jobs
echo -e "-------- Test finished: $test_case $res --------"
for script in $scripts; do
script="$testdir/$script"
diff --git a/tests/scripts/test-lib.sh b/tests/scripts/test-lib.sh
index f8a2249..8b24b2a 100644
--- a/tests/scripts/test-lib.sh
+++ b/tests/scripts/test-lib.sh
@@ -146,8 +146,7 @@ watch_test_outputs() {
ret=$?
if [ $ret -ne 255 ]; then
- # Test finished, kill VMs
- kill $(jobs -p)
+ # Test finished
break 2
fi
done
--
2.32.0
1 year, 11 months
[PATCH] Clear old crashkernl=auto in comment and doc
by Kairui Song
Signed-off-by: Kairui Song <kasong(a)redhat.com>
---
fadump-howto.txt | 9 ++++++---
kdumpctl | 2 +-
2 files changed, 7 insertions(+), 4 deletions(-)
diff --git a/fadump-howto.txt b/fadump-howto.txt
index 433e9a6..bc87644 100644
--- a/fadump-howto.txt
+++ b/fadump-howto.txt
@@ -344,9 +344,12 @@ or
OR
# grubby --update-kernel=/boot/vmlinuz-`uname -r` --args="fadump=off"
-If KDump is to be used as the dump capturing mechanism, update the crashkernel
-parameter (Else, remove "crashkernel=" parameter too, using grubby):
+Remove "crashkernel=" from kernel cmdline parameters:
- # grubby --update-kernel=/boot/vmlinuz-$kver --args="crashkernl=auto"
+ # grubby --update-kernel=/boot/vmlinuz-`uname -r` --remove-args="crashkernel"
+
+If KDump is to be used as the dump capturing mechanism, reset the crashkernel parameter:
+
+ # kdumpctl reset-crashkernel `uname -r`
Reboot the system for the settings to take effect.
diff --git a/kdumpctl b/kdumpctl
index 0fb73b6..f10b091 100755
--- a/kdumpctl
+++ b/kdumpctl
@@ -1232,7 +1232,7 @@ do_estimate()
baseline=$((${baseline%Y} * 1048576))
fi
- # The default value when using crashkernel=auto
+ # The default pre-reserved crashkernel value
baseline_size=$((baseline * size_mb))
# Current reserved crashkernel size
reserved_size=$(cat /sys/kernel/kexec_crash_size)
--
2.31.1
2 years, 1 month
Re: [PATCH] kdump/ppc64: migration action registration clean up
by Kairui Song
On Wed, Jul 28, 2021 at 2:32 AM Hari Bathini <hbathini(a)linux.ibm.com> wrote:
>
> While kdump migration action is registered for LPM event, ensure it is
> cleared as appropriate to avoid duplicate/stale notification entries.
>
> Signed-off-by: Hari Bathini <hbathini(a)linux.ibm.com>
> ---
> kexec-tools.spec | 12 +++++++-----
> 1 file changed, 7 insertions(+), 5 deletions(-)
>
> diff --git a/kexec-tools.spec b/kexec-tools.spec
> index 6f421fa..c042590 100644
> --- a/kexec-tools.spec
> +++ b/kexec-tools.spec
> @@ -272,11 +272,10 @@ mv $RPM_BUILD_ROOT/etc/kdump-adv-conf/kdump_dracut_modules/* $RPM_BUILD_ROOT/%{d
>
> touch /etc/kdump.conf
>
> -ARCH=`uname -m`
> -if [ "$ARCH" == "ppc64" ] || [ "$ARCH" == "ppc64le" ]
> -then
> - servicelog_notify --add --command=/usr/lib/kdump/kdump-migrate-action.sh --match='refcode="#MIGRATE" and serviceable=0' --type=EVENT --method=pairs_stdin
> -fi
> +%ifarch ppc64 ppc64le
> +servicelog_notify --remove --command=/usr/lib/kdump/kdump-migrate-action.sh
> +servicelog_notify --add --command=/usr/lib/kdump/kdump-migrate-action.sh --match='refcode="#MIGRATE" and serviceable=0' --type=EVENT --method=pairs_stdin
> +%endif
>
> # This portion of the script is temporary. Its only here
> # to fix up broken boxes that require special settings
> @@ -305,6 +304,9 @@ fi
> %systemd_postun_with_restart kdump.service
>
> %preun
> +%ifarch ppc64 ppc64le
> +servicelog_notify --remove --command=/usr/lib/kdump/kdump-migrate-action.sh
> +%endif
> %systemd_preun kdump.service
>
> %triggerin -- kernel-kdump
>
>
Acked-by: Kairui Song <kasong(a)redhat.com>
--
Best Regards,
Kairui Song
2 years, 2 months
Re: [PATCH] kdump/ppc64: migration action registration clean up
by Pingfan Liu
On Wed, Jul 28, 2021 at 2:32 AM Hari Bathini <hbathini(a)linux.ibm.com> wrote:
>
> While kdump migration action is registered for LPM event, ensure it is
> cleared as appropriate to avoid duplicate/stale notification entries.
>
> Signed-off-by: Hari Bathini <hbathini(a)linux.ibm.com>
> ---
> kexec-tools.spec | 12 +++++++-----
> 1 file changed, 7 insertions(+), 5 deletions(-)
>
> diff --git a/kexec-tools.spec b/kexec-tools.spec
> index 6f421fa..c042590 100644
> --- a/kexec-tools.spec
> +++ b/kexec-tools.spec
> @@ -272,11 +272,10 @@ mv $RPM_BUILD_ROOT/etc/kdump-adv-conf/kdump_dracut_modules/* $RPM_BUILD_ROOT/%{d
>
> touch /etc/kdump.conf
>
> -ARCH=`uname -m`
> -if [ "$ARCH" == "ppc64" ] || [ "$ARCH" == "ppc64le" ]
> -then
> - servicelog_notify --add --command=/usr/lib/kdump/kdump-migrate-action.sh --match='refcode="#MIGRATE" and serviceable=0' --type=EVENT --method=pairs_stdin
> -fi
> +%ifarch ppc64 ppc64le
> +servicelog_notify --remove --command=/usr/lib/kdump/kdump-migrate-action.sh
> +servicelog_notify --add --command=/usr/lib/kdump/kdump-migrate-action.sh --match='refcode="#MIGRATE" and serviceable=0' --type=EVENT --method=pairs_stdin
> +%endif
>
> # This portion of the script is temporary. Its only here
> # to fix up broken boxes that require special settings
> @@ -305,6 +304,9 @@ fi
> %systemd_postun_with_restart kdump.service
>
> %preun
> +%ifarch ppc64 ppc64le
> +servicelog_notify --remove --command=/usr/lib/kdump/kdump-migrate-action.sh
> +%endif
> %systemd_preun kdump.service
>
> %triggerin -- kernel-kdump
>
>
LGTM. But I think that it is better to wait for a verification of RHEL
2 years, 2 months
[PATCH] kdump/ppc64: migration action registration clean up
by Hari Bathini
While kdump migration action is registered for LPM event, ensure it is
cleared as appropriate to avoid duplicate/stale notification entries.
Signed-off-by: Hari Bathini <hbathini(a)linux.ibm.com>
---
kexec-tools.spec | 12 +++++++-----
1 file changed, 7 insertions(+), 5 deletions(-)
diff --git a/kexec-tools.spec b/kexec-tools.spec
index 6f421fa..c042590 100644
--- a/kexec-tools.spec
+++ b/kexec-tools.spec
@@ -272,11 +272,10 @@ mv $RPM_BUILD_ROOT/etc/kdump-adv-conf/kdump_dracut_modules/* $RPM_BUILD_ROOT/%{d
touch /etc/kdump.conf
-ARCH=`uname -m`
-if [ "$ARCH" == "ppc64" ] || [ "$ARCH" == "ppc64le" ]
-then
- servicelog_notify --add --command=/usr/lib/kdump/kdump-migrate-action.sh --match='refcode="#MIGRATE" and serviceable=0' --type=EVENT --method=pairs_stdin
-fi
+%ifarch ppc64 ppc64le
+servicelog_notify --remove --command=/usr/lib/kdump/kdump-migrate-action.sh
+servicelog_notify --add --command=/usr/lib/kdump/kdump-migrate-action.sh --match='refcode="#MIGRATE" and serviceable=0' --type=EVENT --method=pairs_stdin
+%endif
# This portion of the script is temporary. Its only here
# to fix up broken boxes that require special settings
@@ -305,6 +304,9 @@ fi
%systemd_postun_with_restart kdump.service
%preun
+%ifarch ppc64 ppc64le
+servicelog_notify --remove --command=/usr/lib/kdump/kdump-migrate-action.sh
+%endif
%systemd_preun kdump.service
%triggerin -- kernel-kdump
2 years, 2 months
[PATCH] Check the existence of /sys/bus/ccwgroup/devices/*/online beforehand
by Coiby Xu
On s390x KVM machines, the following errors would show when building kdump
initramfs that dumps vmcore to a remote target,
$ kdumpctl rebuild
/usr/lib/dracut/modules.d/99kdumpbase/module-setup.sh: line 475: /sys/bus/ccwgroup/devices/online: No such file or directory
/usr/lib/dracut/modules.d/99kdumpbase/module-setup.sh: line 476: [: -ne: unary operator expected
This happens because s390x KVM machines use virtual network and
/sys/bus/ccwgroup/devices/ exists but is empty. Fix it by check
the existence of file "/sys/bus/ccwgroup/devices/*/online".
Fixes: commit 7d472515688fb330eee76dac1c39ae628398f757
("Iterate /sys/bus/ccwgroup/devices to tell if we should set up rd.znet")
BugLink: https://bugzilla.redhat.com/show_bug.cgi?id=1982474
Reported-by: Jie Li <jieli(a)redhat.com>
Signed-off-by: Coiby Xu <coxu(a)redhat.com>
---
dracut-module-setup.sh | 1 +
1 file changed, 1 insertion(+)
diff --git a/dracut-module-setup.sh b/dracut-module-setup.sh
index 8211d14..a1f33e8 100755
--- a/dracut-module-setup.sh
+++ b/dracut-module-setup.sh
@@ -462,6 +462,7 @@ find_online_znet_device() {
NETWORK_DEVICES=$(find $CCWGROUPBUS_DEVICEDIR)
for d in $NETWORK_DEVICES
do
+ [ ! -f "$d/online" ] && continue
read ONLINE < $d/online
if [ $ONLINE -ne 1 ]; then
continue
--
2.32.0
2 years, 2 months
[PATCH] Make `dump_to_rootfs` wait for 90s for real
by Kairui Song
When `failure_action` is set to `dump_to_rootfs`, the message:
"Waiting for rootfs mount, will timeout after 90 seconds"
is actually wrong. Kdump will simply call `systemctl start sysroot.mount`,
but the timeout value of sysroot.mount depends on the unit service and
dracut parameters. And by default, dracut will set
JobRunningTimeoutSec=0 and JobTimeoutSec=0 for the device units,
which means it will wait forever. (see wait_for_dev function in dracut)
For some devices, this can be fixed by setting rd.timeout=90. But when
initqueue is set enabled during initramfs build, dracut will force set
timeout for host devices to `0`. (see 99base/module-setup.sh).
Depending on dracut / systemd can make things unpredictable and break as
parameters or code change. To make things easy to understand and
maintain, just call `systemctl` with `--no-block` params, and implement
a standalone wait loop. Now `dump_to_rootfs` will actually wait for
90s then timeout.
Signed-off-by: Kairui Song <kasong(a)redhat.com>
---
kdump-lib-initramfs.sh | 14 ++++++++++++--
1 file changed, 12 insertions(+), 2 deletions(-)
diff --git a/kdump-lib-initramfs.sh b/kdump-lib-initramfs.sh
index 4cd18e4..319f9a0 100755
--- a/kdump-lib-initramfs.sh
+++ b/kdump-lib-initramfs.sh
@@ -230,10 +230,20 @@ dump_to_rootfs()
dinfo "Clean up dead systemd services"
systemctl cancel
dinfo "Waiting for rootfs mount, will timeout after 90 seconds"
- systemctl start sysroot.mount
+ systemctl start --no-block sysroot.mount
- ddebug "NEWROOT=$NEWROOT"
+ _loop=0
+ while [ $_loop -lt 90 ] && ! is_mounted /sysroot; do
+ sleep 1
+ _loop=$((_loop + 1))
+ done
+
+ if ! is_mounted /sysroot; then
+ derror "Failed to mount rootfs"
+ return
+ fi
+ ddebug "NEWROOT=$NEWROOT"
dump_fs $NEWROOT
}
--
2.31.1
2 years, 2 months
Re: [RESEND PATCH] kdump/ppc64: rebuild initramfs image after migration
by Kairui Song
On Mon, Jul 12, 2021 at 6:03 PM Hari Bathini <hbathini(a)linux.ibm.com> wrote:
>
> Dump capture initramfs needs rebuild after partition migration (LPM).
> Use servicelog notification mechanism to invoke kdump rebuild after
> migration.
>
> Signed-off-by: Hari Bathini <hbathini(a)linux.ibm.com>
> ---
>
> * Rebased on recent changes.
>
>
> kdump-migrate-action.sh | 8 ++++++++
> kdump-restart.sh | 8 ++++++++
> kexec-tools.spec | 16 ++++++++++++++++
> 3 files changed, 32 insertions(+)
> create mode 100755 kdump-migrate-action.sh
> create mode 100644 kdump-restart.sh
>
> diff --git a/kdump-migrate-action.sh b/kdump-migrate-action.sh
> new file mode 100755
> index 0000000..c516639
> --- /dev/null
> +++ b/kdump-migrate-action.sh
> @@ -0,0 +1,8 @@
> +#!/bin/sh
> +
> +systemctl is-active kdump
> +if [ $? -ne 0 ]; then
> + exit 0
> +fi
> +
> +/usr/lib/kdump/kdump-restart.sh
> diff --git a/kdump-restart.sh b/kdump-restart.sh
> new file mode 100644
> index 0000000..a9ecfc1
> --- /dev/null
> +++ b/kdump-restart.sh
> @@ -0,0 +1,8 @@
> +#!/bin/bash
> +export PATH="$PATH:/usr/bin:/usr/sbin"
> +
> +exec >>/var/log/kdump-migration.log 2>&1
> +
> +echo "kdump: Partition Migration detected. Rebuilding initramfs image to reload."
> +/usr/bin/kdumpctl rebuild
> +/usr/bin/kdumpctl reload
> diff --git a/kexec-tools.spec b/kexec-tools.spec
> index 98d39fe..1106d6b 100644
> --- a/kexec-tools.spec
> +++ b/kexec-tools.spec
> @@ -42,6 +42,8 @@ Source31: kdump-logger.sh
> Source32: mkfadumprd
> Source33: 92-crashkernel.install
> Source34: crashkernel-howto.txt
> +Source35: kdump-migrate-action.sh
> +Source36: kdump-restart.sh
>
> #######################################
> # These are sources for mkdumpramfs
> @@ -61,6 +63,9 @@ Source200: dracut-fadump-init-fadump.sh
> Source201: dracut-fadump-module-setup.sh
>
> Requires(post): systemd-units
> +%ifarch ppc64 ppc64le
> +Requires(post): servicelog
> +%endif
> Requires(preun): systemd-units
> Requires(postun): systemd-units
> Requires(pre): coreutils sed zlib
> @@ -199,6 +204,10 @@ install -m 644 %{SOURCE25} $RPM_BUILD_ROOT%{_mandir}/man8/kdumpctl.8
> install -m 755 %{SOURCE20} $RPM_BUILD_ROOT%{_prefix}/lib/kdump/kdump-lib.sh
> install -m 755 %{SOURCE23} $RPM_BUILD_ROOT%{_prefix}/lib/kdump/kdump-lib-initramfs.sh
> install -m 755 %{SOURCE31} $RPM_BUILD_ROOT%{_prefix}/lib/kdump/kdump-logger.sh
> +%ifarch ppc64 ppc64le
> +install -m 755 %{SOURCE35} $RPM_BUILD_ROOT%{_prefix}/lib/kdump/kdump-migrate-action.sh
> +install -m 755 %{SOURCE36} $RPM_BUILD_ROOT%{_prefix}/lib/kdump/kdump-restart.sh
> +%endif
> %ifnarch s390x
> install -m 755 %{SOURCE28} $RPM_BUILD_ROOT%{_udevrulesdir}/../kdump-udev-throttler
> %endif
> @@ -265,6 +274,13 @@ mv $RPM_BUILD_ROOT/etc/kdump-adv-conf/kdump_dracut_modules/* $RPM_BUILD_ROOT/%{d
> %systemd_post kdump.service
>
> touch /etc/kdump.conf
> +
> +ARCH=`uname -m`
> +if [ "$ARCH" == "ppc64" ] || [ "$ARCH" == "ppc64le" ]
> +then
> + servicelog_notify --add --command=/usr/lib/kdump/kdump-migrate-action.sh --match='refcode="#MIGRATE" and serviceable=0' --type=EVENT --method=pairs_stdin
> +fi
> +
> # This portion of the script is temporary. Its only here
> # to fix up broken boxes that require special settings
> # in /etc/sysconfig/kdump. It will be removed when
>
Acked-by: Kairui Song <kasong(a)redhat.com>
--
Best Regards,
Kairui Song
2 years, 2 months