resolves: bz2027568
upstream: fedora
conflict: None-functional conflict in spec file.
commit 146f662622
Author: Hari Bathini <hbathini@linux.ibm.com>
Date: Tue Jul 27 23:59:48 2021 +0530
kdump/ppc64: migration action registration clean up
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@linux.ibm.com>
Acked-by: Kairui Song <kasong@redhat.com>
Signed-off-by: Tao Liu <ltao@redhat.com>
upstream: fedora
resolves: bz2027568
conflict: The upstream patch was submitted before
"Add file supported-kdump-targets.txt to kexec-tools"
was added to rhel9. So there are SourceXX conflict
in spec file. And similar code merge with patch
"add keyutils as a weak dependency for POWER"
commit 71b7a2f47c
Author: Hari Bathini <hbathini@linux.ibm.com>
Date: Mon Jul 12 15:33:03 2021 +0530
kdump/ppc64: rebuild initramfs image after migration
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@linux.ibm.com>
Reviewed-by: Pingfan Liu <piliu@redhat.com>
Acked-by: Kairui Song <kasong@redhat.com>
Signed-off-by: Tao Liu <ltao@redhat.com>
Resolves: bz2024450
Upstream: Fedora
Conflict: RHEL9 POWER kexec-tools doesn't have any dependency on other
packages.
commit c3c8df3745
Author: Coiby Xu <coxu@redhat.com>
Date: Thu Nov 18 12:26:01 2021 +0800
add keytuils as a weak dependency for POWER
When secureboot is enabled, kdumpctl needs to use keyctl to add/remove
a key to/from the .ima keyring.
Fixes: commit 596fa0a07f
("kdumpctl: enable secure boot on ppc64le LPARs")
Signed-off-by: Coiby Xu <coxu@redhat.com>
Acked-by: Hari Bathini <hbathini@linux.ibm.com>
Signed-off-by: Coiby Xu <coxu@redhat.com>
Resolves: bz1931802
Upstream: Fedora
Conflict: The upstream commit was submitted before shfmt and .editorconfig.
So there are issues like 4 spaces verse tab indentation, double
brackets verse single bracket and etc.
commit 596fa0a07f
Author: Pingfan Liu <piliu@redhat.com>
Date: Thu Feb 18 14:01:18 2021 +0800
kdumpctl: enable secure boot on ppc64le LPARs
On ppc64le LPAR, secure-boot is a little different from bare metal,
Where
host secure boot: /ibm,secure-boot/os-secureboot-enforcing DT property exists
while
guest secure boot: /ibm,secure-boot >= 2
Make kexec-tools adapt to LPAR
Signed-off-by: Pingfan Liu <piliu@redhat.com>
Acked-by: Kairui Song <kasong@redhat.com>
Signed-off-by: Coiby Xu <coxu@redhat.com>
Resolves: bz1895232
Upstream: Fedora
Conflict: None
commit 4948fd88d5ff328a69ecc1c1b55e5f09cd65556a
Author: Pingfan Liu <piliu@redhat.com>
Date: Thu Oct 21 10:12:18 2021 +0800
sysconfig: make kexec_file_load as default option on aarch64
Signed-off-by: Pingfan Liu <piliu@redhat.com>
Signed-off-by: Pingfan Liu <piliu@redhat.com>
Resolves: bz1881876
Upstream: Fedora
Conflict: None
commit a239a939237ced11c35d52d722a7eecb84091de6
Author: Pingfan Liu <piliu@redhat.com>
Date: Thu Oct 21 10:13:10 2021 +0800
sysconfig: make kexec_file_load as default option on ppc64le
Signed-off-by: Pingfan Liu <piliu@redhat.com>
Signed-off-by: Pingfan Liu <piliu@redhat.com>
upstream: fedora
resolves: bz2008397
conflict: none
commit 9ffda5bc1c
Author: Tao Liu <ltao@redhat.com>
Date: Wed Nov 10 16:56:53 2021 +0800
Enable zstd compression for makedumpfile in kexec-tools.spec
The Zstandard (zstd) compression method is not enabled:
$ makedumpfile -v
makedumpfile: version 1.7.0 (released on 8 Nov 2021)
lzo enabled
snappy enabled
zstd disabled
This patch will enable it when building kexec-tools rpm package.
Signed-off-by: Tao Liu <ltao@redhat.com>
Acked-by: Coiby Xu <coxu@redhat.com>
Signed-off-by: Tao Liu <ltao@redhat.com>
resolves: bz1982535
resolves: bz2003832
resolves: bz2014626
resolves: bz1989451
Increased release subversion for the commit message.
Fixes: commit c1406d2cab
("Rebuilt for IMA sigs, glibc 2.34, aarch64 flags")
The release subversion wasn't increased for this commit.
Signed-off-by: Tao Liu <ltao@redhat.com>
upstream: fedora
resolves: bz2003832
conflict: none
commit 6936fbc1b2
Author: Coiby Xu <coxu@redhat.com>
Date: Mon Nov 1 14:13:16 2021 +0800
fix broken extra_bins when installing multiple binaries
When there more than one binaries, quoting "$val" would make
dracut-install treat multiple binaries as one binary. Take
"extra_bins /usr/sbin/ping /usr/sbin/ip" as an example, the
following error would occur when building initrd,
dracut-install: ERROR: installing '/usr/sbin/ping /usr/sbin/ip'
dracut: FAILED: /usr/lib/dracut/dracut-install -D /var/tmp/dracut.ODrioZ/initramfs -a /usr/sbin/ping /usr/sbin/ip
Fix it by not quoting the variable and bypassing SC2086 shellcheck.
Fixes: commit 86538ca6e2
("bash scripts: fix variable quoting issue")
Acked-by: Tao Liu <ltao@redhat.com>
Signed-off-by: Coiby Xu <coxu@redhat.com>
Signed-off-by: Tao Liu <ltao@redhat.com>
upstream: fedora
resolves: bz1982535
conflict: none
commit 727251e52e
Author: Tao Liu <ltao at redhat.com>
Date: Tue Oct 26 22:03:28 2021 +0800
mkdumprd: drop mountaddr/mountproto nfs mount options
nfs service will append extra mount options to kernel mount options.
Such as mountaddr/mountproto options. These options only represent
current mounting details of the 1st kernel, but may not appropriate
for the 2nd kernel for the same reason as commit
d4f04afa47 ("mkdumprd: drop some nfs
mount options when reading from kernel"). This patch will remove
these options.
Signed-off-by: Tao Liu <ltao@redhat.com>
Acked-by: Coiby Xu <coxu@redhat.com>
Signed-off-by: Tao Liu <ltao@redhat.com>
upstream: fedora
resolves: bz2003832
conflict: none
commit f6e6aa4551
Author: Kairui Song <kasong@redhat.com>
Date: Wed Sep 1 17:38:50 2021 +0800
92-crashkernel.install: fix exit code
The return value of set_ck_kernel or set_grub_ck is wrongly being used
as the exit code. This hook should exit with 0 or it may result in
unexpected behavior of kernel-install.
Signed-off-by: Kairui Song <kasong@redhat.com>
Acked-by: Pingfan Liu <piliu@redhat.com>
Signed-off-by: Tao Liu <ltao@redhat.com>
upstream: fedora
resolves: bz2003832
conflict: none
commit 4c39ad9a0c
Author: Kairui Song <kasong@redhat.com>
Date: Mon Sep 13 16:40:25 2021 +0800
dracut-early-kdump.sh: make it POSIX compatible
Refactor and remove bash only syntax.
Signed-off-by: Kairui Song <kasong@redhat.com>
Acked-by: Philipp Rudo <prudo@redhat.com>
Signed-off-by: Tao Liu <ltao@redhat.com>
upstream: fedora
resolves: bz2003832
conflict: none
commit ee337c6f49
Author: Kairui Song <kasong@redhat.com>
Date: Mon Sep 13 03:38:14 2021 +0800
Add header comment for POSIX compliant scripts
To make things cleaner and more human readable, add a short comment for
the POSIX scripts.
Signed-off-by: Kairui Song <kasong@redhat.com>
Acked-by: Philipp Rudo <prudo@redhat.com>
Signed-off-by: Tao Liu <ltao@redhat.com>
upstream: fedora
resolves: bz2003832
conflict: none
commit 4b4d045b8c
Author: Kairui Song <kasong@redhat.com>
Date: Wed Aug 11 19:55:19 2021 +0800
mkdumprd: allow using dash
All non-POSIX syntax in second kernel are gone, tested on Fedora 34
with latest dracut, dash now works fine.
Signed-off-by: Kairui Song <kasong@redhat.com>
Acked-by: Philipp Rudo <prudo@redhat.com>
Signed-off-by: Tao Liu <ltao@redhat.com>
upstream: fedora
resolves: bz2003832
conflict: none
commit 8cd57e5565
Author: Kairui Song <kasong@redhat.com>
Date: Wed Aug 11 19:19:59 2021 +0800
kdump-logger.sh: make it POSIX compatible
Refactor to remove some bash only syntax.
Signed-off-by: Kairui Song <kasong@redhat.com>
Acked-by: Philipp Rudo <prudo@redhat.com>
Signed-off-by: Tao Liu <ltao@redhat.com>
upstream: fedora
resolves: bz2003832
conflict:
Regenerated with shfmt command because of
too much hunk patches. When comparing with the original
patch, only patch "kdumpctl: enable secure boot on ppc64le LPARs"
related hunks are different.
commit 4cdce1f489
Author: Kairui Song <kasong@redhat.com>
Date: Tue Sep 14 03:09:30 2021 +0800
kdump-lib.sh: reformat with shfmt
This is a batch update done with:
shfmt -s -w kdump-lib.sh
Clean up code style and reduce code base size, no behaviour change.
Signed-off-by: Kairui Song <kasong@redhat.com>
Acked-by: Philipp Rudo <prudo@redhat.com>
Signed-off-by: Tao Liu <ltao@redhat.com>
upstream: fedora
resolves: bz2003832
conflict: none
commit 4f01cb1b0a
Author: Kairui Song <kasong@redhat.com>
Date: Mon Sep 13 01:18:04 2021 +0800
kdump-lib.sh: fix variable quoting issue
Fixed quoting issues found by shellcheck, no feature
change. This should fix many errors when there is space
in any shell variables.
And fixed how remove_cmdline_param is being called in prepare_cmdline.
Kernel parameters can have space like: param="spaces in here". So currently
remove_cmdline_param is broken since its args always get split by space.
But prepare_cmdline is expecting remove_cmdline_param to split its args
by space and passing a list of kernel args separated by space as a whole arg.
So fix that by using `xargs` to parse and split the args properly, then
call remove_cmdline_param.
Following quoting related issues are fixed (check the link
for example code and what could go wrong):
https://github.com/koalaman/shellcheck/wiki/SC1007https://github.com/koalaman/shellcheck/wiki/SC2046https://github.com/koalaman/shellcheck/wiki/SC2053https://github.com/koalaman/shellcheck/wiki/SC2060https://github.com/koalaman/shellcheck/wiki/SC2068https://github.com/koalaman/shellcheck/wiki/SC2086
Signed-off-by: Kairui Song <kasong@redhat.com>
Signed-off-by: Tao Liu <ltao@redhat.com>
upstream: fedora
resolves: bz2003832
conflict: none
commit f39000f524
Author: fj1508ic@fujitsu.com <fj1508ic@fujitsu.com>
Date: Tue Jan 26 06:37:28 2021 +0000
Remove trace_buf_size and trace_event from the kernel bootparameters of the kdump kernel
The kdump kernel uses resources for ftrace because trace_buf_size, which
specifies the ring buffer size for ftrace, and trace_event, which specifies
a valid trace event, are not removed, but the kdump kernel does not require
ftrace.
trace_buf_size is ignored if the specified size is 0, so specify 1.
Signed-off-by: Hisashi Nagaoka <fj1508ic@fujitsu.com>
Acked-by: Kairui Song <kasong@redhat.com>
Signed-off-by: Tao Liu <ltao@redhat.com>
upstream: fedora
resolves: bz2003832
conflict: none
commit 319219d23b
Author: Kairui Song <kasong@redhat.com>
Date: Mon Sep 13 01:17:23 2021 +0800
kdump-lib.sh: fix a few ambiguous or redundant code
Fix a few ambiguous syntax issues and remove some unused variables.
Also refactor some code to make it more robust.
Signed-off-by: Kairui Song <kasong@redhat.com>
Acked-by: Philipp Rudo <prudo@redhat.com>
Signed-off-by: Tao Liu <ltao@redhat.com>
upstream: fedora
resolves: bz2003832
conflict: none
commit c0edb80b8f
Author: Kairui Song <kasong@redhat.com>
Date: Wed Sep 8 13:31:31 2021 +0800
kdump-lib.sh: fix arithmetic operation syntax
Get rid of let, and remove useless '$' on arithmetic variables.
Signed-off-by: Kairui Song <kasong@redhat.com>
Acked-by: Philipp Rudo <prudo@redhat.com>
Signed-off-by: Tao Liu <ltao@redhat.com>
upstream: fedora
resolves: bz2003832
conflict: none
commit 53813e8b9a
Author: Kairui Song <kasong@redhat.com>
Date: Wed Sep 8 02:48:17 2021 +0800
kdump-lib.sh: remove useless echo and cat
Replace echo "$(cmd)" and "var=$(cmd); echo $var" with just `cmd`.
And remove some useless cat.
Signed-off-by: Kairui Song <kasong@redhat.com>
Acked-by: Philipp Rudo <prudo@redhat.com>
Signed-off-by: Tao Liu <ltao@redhat.com>
upstream: fedora
resolves: bz2003832
conflict: none
commit 58d3e6db3a
Author: Kairui Song <kasong@redhat.com>
Date: Wed Sep 8 15:20:42 2021 +0800
kdump-lib.sh: rework nmcli related functions
This fixes word splitting issue with nmcli args. Current kexec-tools
scripts won't call nmcli with correct arguments when there are space in
network interface name.
nmcli expects multiple parameters, but get_nmcli_value_by_field only
accepts two params and depends on shell word splitting to split the
_nm_show_cmd into multiple params, which is very fragile.
So switch the param order, simplified this function and now multiple
params can be used properly.
And get_nmcli_connection_show_cmd_by_ifname returns multiple
nmcli params in a single variable, it depend on shell word splitting to
split the words when calling nmcli. But this is very fragile and break
easily when there are any special character in the connection path.
This function is only introduced to get and cache the nmcli command
which contains the "connection name".
Actually only cache the "connection path" is enough. Callers should
just call get_nmcli_connection_apath_by_ifname to cache the path, and
a new helper get_nmcli_field_by_conpath is introduced here to get value
from nmcli. This way "connection path" can contain any character.
Also get rid of another nmcli_cmd usage in
get_nmcli_connection_apath_by_ifname which stores multiple params in a
single bash variable separated by space.
Signed-off-by: Kairui Song <kasong@redhat.com>
Acked-by: Philipp Rudo <prudo@redhat.com>
Signed-off-by: Tao Liu <ltao@redhat.com>
upstream: fedora
resolves: bz2003832
conflict:
Patch hunk modified for function is_secure_boot_enforced().
commit 30090f3a15
Author: Kairui Song <kasong@redhat.com>
Date: Mon Sep 13 01:17:05 2021 +0800
kdump-lib.sh: replace '[ ]' with '[[ ]]' and get rid of legacy ``
Updated file syntax with following command:
sed -i -e 's/\(\s\)\[\s\([^]]*\)\s\]/\1\[\[\ \2 \]\]/g' kdump-lib.sh
(replace '[ ]' with '[[ ]]')
sed -i -e 's/`\([^`]*\)`/\$(\1)/g' kdump-lib.sh
(replace `...` with $(...))
And manually updated [[ ... -a ... ]] and [[ ... -o ... ]] with && and
||.
Signed-off-by: Kairui Song <kasong@redhat.com>
Acked-by: Philipp Rudo <prudo@redhat.com>
Signed-off-by: Tao Liu <ltao@redhat.com>
upstream: fedora
resolves: bz2003832
conflict: none
commit 5debf397fe
Author: Kairui Song <kasong@redhat.com>
Date: Tue Sep 14 03:04:08 2021 +0800
kdump-lib-initramfs.sh: make it POSIX compatible
POSIX doesn't support keyword local, so add double underscore and prefix
to variable names, and reduce variable usage, to avoid any variable name
conflict.
Also reformat the code with `shfmt -s -w kdump-lib-initramfs.sh`.
Signed-off-by: Kairui Song <kasong@redhat.com>
Acked-by: Philipp Rudo <prudo@redhat.com>
Signed-off-by: Tao Liu <ltao@redhat.com>
upstream: fedora
resolves: bz2003832
conflict: none
commit 7c76611abb
Author: Kairui Song <kasong@redhat.com>
Date: Wed Sep 15 23:10:07 2021 +0800
dracut-kdump.sh: reformat with shfmt
This is done with `shfmt -w -s dracut-kdump.sh`. There is no behaviour
change.
Signed-off-by: Kairui Song <kasong@redhat.com>
Acked-by: Philipp Rudo <prudo@redhat.com>
Signed-off-by: Tao Liu <ltao@redhat.com>
upstream: fedora
resolves: bz2003832
conflict: none
commit b1339c3b8a
Author: Kairui Song <kasong@redhat.com>
Date: Wed Aug 18 21:06:52 2021 +0800
dracut-kdump.sh: make it POSIX compatible
POSIX doesn't support keyword `local`, so this commit reduced variable usage.
Heredoc ("<<<") operation is also not supported, so kdump.conf is now pre-parse
into a temp file. Also fixes many POSIX syntax errors.
Signed-off-by: Kairui Song <kasong@redhat.com>
Acked-by: Philipp Rudo <prudo@redhat.com>
Signed-off-by: Tao Liu <ltao@redhat.com>
upstream: fedora
resolves: bz2003832
conflict: none
commit 725027b735
Author: Kairui Song <kasong@redhat.com>
Date: Thu Aug 12 02:55:32 2021 +0800
dracut-kdump.sh: POSIX doesn't support pipefail
Set pipefail will cause POSIX shell to exit with failure. So only do
that in bash.
Signed-off-by: Kairui Song <kasong@redhat.com>
Acked-by: Philipp Rudo <prudo@redhat.com>
Signed-off-by: Tao Liu <ltao@redhat.com>
upstream: fedora
resolves: bz2003832
conflict: none
commit b1c794a2cf
Author: Kairui Song <kasong@redhat.com>
Date: Tue Sep 14 03:00:48 2021 +0800
dracut-kdump.sh: Use stat instead of ls to get vmcore size
ls output is fragile, so use stat instead.
Signed-off-by: Kairui Song <kasong@redhat.com>
Acked-by: Philipp Rudo <prudo@redhat.com>
Signed-off-by: Tao Liu <ltao@redhat.com>
upstream: fedora
resolves: bz2003832
conflict: none
commit 7a9823b42e
Author: Kairui Song <kasong@redhat.com>
Date: Tue Aug 3 13:23:26 2021 +0800
dracut-kdump.sh: simplify dump_ssh
There is a workaround for `scp` that it expects IPv6 address to be
quoted with [ ... ], only apply the workaround once and store the
updated `scp` address to reuse it.
Signed-off-by: Kairui Song <kasong@redhat.com>
Acked-by: Philipp Rudo <prudo@redhat.com>
Signed-off-by: Tao Liu <ltao@redhat.com>
upstream: fedora
resolves: bz2003832
conflict: none
commit 8f89e89071
Author: Kairui Song <kasong@redhat.com>
Date: Mon Aug 2 01:25:17 2021 +0800
dracut-kdump.sh: remove add_dump_code
`add_dump_code "<op>"` is just `DUMP_INSTRUCTION="<op>"`, no need a
extra wrapper for that.
Signed-off-by: Kairui Song <kasong@redhat.com>
Acked-by: Philipp Rudo <prudo@redhat.com>
Signed-off-by: Tao Liu <ltao@redhat.com>
upstream: fedora
resolves: bz2003832
conflict: none
commit 0675edbadb
Author: Kairui Song <kasong@redhat.com>
Date: Mon Aug 2 01:19:44 2021 +0800
dracut-kdump.sh: don't put KDUMP_SCRIPT_DIR in PATH
monitor_dd_progress is the only extra binary in KDUMP_SCRIPT_DIR, no
need to change PATH environment variable, just call it directly.
Signed-off-by: Kairui Song <kasong@redhat.com>
Acked-by: Philipp Rudo <prudo@redhat.com>
Signed-off-by: Tao Liu <ltao@redhat.com>
upstream: fedora
resolves: bz2003832
conflict: none
commit a1205effaa
Author: Kairui Song <kasong@redhat.com>
Date: Thu Aug 5 00:59:29 2021 +0800
kdump-lib-initramfs.sh: move dump related functions to kdump.sh
These dump related functions are only used by dracut-kdump.sh.
Signed-off-by: Kairui Song <kasong@redhat.com>
Acked-by: Philipp Rudo <prudo@redhat.com>
Signed-off-by: Tao Liu <ltao@redhat.com>
upstream: fedora
resolves: bz2003832
conflict: none
commit e7118d1de8
Author: Kairui Song <kasong@redhat.com>
Date: Mon Aug 2 00:50:22 2021 +0800
Merge kdump-error-handler.sh into kdump.sh
kdump-error-handler.sh does nothing except calling three functions,
it can be easily merged into kdump.sh by using a parameter to run the
error handling routine.
kdump-lib-initramfs.sh was created to hold the three shared functions
and related code, so by merging these two files, kdump-lib-initramfs.sh
can be simplified by a lot.
Following up commits will clean up kdump-lib-initramfs.sh.
Signed-off-by: Kairui Song <kasong@redhat.com>
Acked-by: Philipp Rudo <prudo@redhat.com>
Signed-off-by: Tao Liu <ltao@redhat.com>
upstream: fedora
resolves: bz2003832
conflict: none
commit a5faa052d4
Author: Kairui Song <kasong@redhat.com>
Date: Tue Sep 14 03:25:46 2021 +0800
kdump-lib-initramfs.sh: prepare to be a POSIX compatible lib
Move all functions needed in the second kernel from kdump-lib.sh
to kdump-lib-initramfs.sh, and update shebang headers.
Now, kdump-lib-initramfs.sh is an independent lib script, no longer
depend on kdump-lib.sh, and kdump-lib.sh is no longer needed for
the second kernel.
In later commits, functions in kdump-lib-initramfs.sh will be reworked
to be POSIX compatible, kdump-lib.sh will contain bash only functions.
POSIX shell have very limited features, eg. `local` keyword doesn't
exist in POSIX but we rely on that heavily. So kdump-lib.sh will
use bash syntax and contain the most complex helper and codes.
kdump-lib-initramfs.sh will contain the minimum set of helpers,
and be shared by both the first and second kernel.
Signed-off-by: Kairui Song <kasong@redhat.com>
Acked-by: Philipp Rudo <prudo@redhat.com>
Signed-off-by: Tao Liu <ltao@redhat.com>
upstream: fedora
resolves: bz2003832
conflict:
function load_kdump_kernel_key() not exist in rhel9,
so related patch hunk is removed.
commit 0e4b66b1ab
Author: Kairui Song <kasong@redhat.com>
Date: Tue Sep 14 02:25:40 2021 +0800
bash scripts: reformat with shfmt
This is a batch update done with:
shfmt -s -w mkfadumprd mkdumprd kdumpctl *-module-setup.sh
Clean up code style and reduce code base size, no behaviour change.
Signed-off-by: Kairui Song <kasong@redhat.com>
Acked-by: Philipp Rudo <prudo@redhat.com>
Signed-off-by: Tao Liu <ltao@redhat.com>
upstream: fedora
resolves: bz2003832
conflict:
function remove_kdump_kernel_key() not presented in rhel9,
so related patch hunk are removed.
commit 86538ca6e2
Author: Kairui Song <kasong@redhat.com>
Date: Wed Sep 8 17:21:41 2021 +0800
bash scripts: fix variable quoting issue
Fixed quoting issues found by shellcheck, no feature
change. This should fix many errors when there is space
in any shell variables, eg. dump target's name/path/id.
False positives are marked with "# shellcheck disable=SCXXXX", for
example, args are expected to split so it should not be quoted.
And replaced some `cut -d ' ' -fX` with `awk '{print $X}'` since cut
is fragile, and doesn't work well with any quoted strings that have
redundant space.
Following quoting related issues are fixed (check the link
for example code and what could go wrong):
https://github.com/koalaman/shellcheck/wiki/SC2046https://github.com/koalaman/shellcheck/wiki/SC2053https://github.com/koalaman/shellcheck/wiki/SC2068https://github.com/koalaman/shellcheck/wiki/SC2086https://github.com/koalaman/shellcheck/wiki/SC2206
Signed-off-by: Kairui Song <kasong@redhat.com>
Acked-by: Philipp Rudo <prudo@redhat.com>
Signed-off-by: Tao Liu <ltao@redhat.com>
upstream: fedora
resolves: bz2003832
conflict: none
commit 8b4b7bf808
Author: Coiby Xu <coxu@redhat.com>
Date: Fri Mar 26 10:22:09 2021 +0800
Don't use die in dracut-module-setup.sh
die (in dracut-lib.sh) is supposed to be used in the initramfs environment.
Signed-off-by: Coiby Xu <coxu@redhat.com>
Acked-by: Kairui Song <kasong@redhat.com>
Signed-off-by: Tao Liu <ltao@redhat.com>
upstream: fedora
resolves: bz2003832
conflict:
function load_kdump_kernel_key() not presented in rhel9,
so related patch hunk are removed.
commit 70978c00e5
Author: Kairui Song <kasong@redhat.com>
Date: Wed Sep 8 17:20:51 2021 +0800
bash scripts: replace '[ ]' with '[[ ]]' for bash scripts
kdumpctl, mkdumprd, *-module-setup.sh only target bash, since they
only run in first kernel and depend on dracut, and dracut depends
on bash. So use '[[ ]]' to replace '[ ]'.
This is a batch update done with following command:
`sed -i -e 's/\(\s\)\[\s\([^]]*\)\s\]/\1\[\[\ \2 \]\]/g' kdumpctl, mkdumprd, *-module-setup.sh`
and replaced [ ... -a ... ] with [[ ... ]] && [[ ... ]] manually.
See https://tldp.org/LDP/abs/html/testconstructs.html for more details
on '[[ ]]', it's more versatile, safer, and slightly faster than '[ ]'.
This will also help shfmt to clean up the code in later commits.
Signed-off-by: Kairui Song <kasong@redhat.com>
Acked-by: Philipp Rudo <prudo@redhat.com>
Signed-off-by: Tao Liu <ltao@redhat.com>
upstream: fedora
resolves: bz2003832
conflict: none
commit 2d9504c4a4
Author: Lianbo Jiang <lijiang@redhat.com>
Date: Tue Jun 1 18:33:44 2021 +0800
mkdumprd: display the absolute path of dump location in the check_user_configured_target()
When kdump service fails, the current errors do not display the
absolute path of dump location(marked it as "^"), for example:
kdump: kexec: unloaded kdump kernel
kdump: Stopping kdump: [OK]
kdump: Detected change(s) in the following file(s): /etc/kdump.conf
kdump: Rebuilding /boot/initramfs-4.18.0-304.el8.x86_64kdump.img
kdump: Dump path "/var1/crash" does not exist in dump target "UUID=c202ef45-3ac3-4adb-85e7-307a916757f0"
^^^^^^^^^^^
kdump: mkdumprd: failed to make kdump initrd
kdump: Starting kdump: [FAILED]
Here, it should output the absolute path of dump location with this
format: "<mount path>/<path>". To fix it, let's extend the relative
pathname to the absolute pathname in check_user_configured_target().
Signed-off-by: Lianbo Jiang <lijiang@redhat.com>
Acked-by: Kairui Song <kasong@redhat.com>
Signed-off-by: Tao Liu <ltao@redhat.com>
upstream: fedora
resolves: bz2003832
conflict: none
commit c6021648f1
Author: Kairui Song <kasong@redhat.com>
Date: Fri Mar 19 18:21:11 2021 +0800
Don't iterate the whole /sys/devices just to find drm device
On some large systems, /sys/devices is huge and it's not a wise idea to
iterate it. `find` may cause tremendous contention on the kernfs_mutex
when there are already stress on /sys, and it will perform very very
poorly.
Simply check if drm class presents should be good enough.
Signed-off-by: Kairui Song <kasong@redhat.com>
Acked-by: Pingfan Liu <piliu@redhat.com>
Signed-off-by: Tao Liu <ltao@redhat.com>
upstream: fedora
resolves: bz2003832
conflict: none
commit e5a745ce77
Author: Coiby Xu <coxu@redhat.com>
Date: Sat Feb 20 11:55:52 2021 +0800
mkdumprd: prompt the user to install nfs-utils when mounting NFS fs failed
When nfs-utils is not installed, mounting as NFS fs would fail.
Currently, the error message is not user-friendly,
mount: /tmp/mkdumprd.HyPGpS/target: bad option; for several filesystems (e.g. nfs, cifs) you might need a /sbin/mount.<type> helper program.
kdump: Failed to mount on xxx for kdump preflight check.
kdump: mkdumprd: failed to make kdump initrd
Prompt the user to install nfs-utilsa in the error message,
kdump: Failed to mount on xxx for kdump preflight check. Please make sure nfs-utils has been installed.
Signed-off-by: Coiby Xu <coxu@redhat.com>
Acked-by: Kairui Song <kasong@redhat.com>
Signed-off-by: Tao Liu <ltao@redhat.com>
upstream: fedora
resolves: bz2003832
conflict: none
commit 54cc5c44be
Author: Kairui Song <kasong@redhat.com>
Date: Wed Sep 8 01:48:52 2021 +0800
bash scripts: use $(...) notation instead of legacy `...`
This is a batch update done with following command:
`sed -i -e 's/`\([^`]*\)`/\$(\1)/g' mkfadumprd mkdumprd \
kdumpctl dracut-module-setup.sh dracut-fadump-module-setup.sh \
dracut-early-kdump-module-setup.sh`
And manually converted some corner cases. This fixes
all related issues detected by shellcheck.
Make it easier to do clean up in later commits.
Check following link for reasons to switch to the new syntax:
https://github.com/koalaman/shellcheck/wiki/SC2006
Signed-off-by: Kairui Song <kasong@redhat.com>
Acked-by: Philipp Rudo <prudo@redhat.com>
Signed-off-by: Tao Liu <ltao@redhat.com>
upstream: fedora
resolves: bz2003832
conflict: none
commit a416930706
Author: Kairui Song <kasong@redhat.com>
Date: Wed Aug 4 15:50:30 2021 +0800
bash scripts: always use "read -r"
This helps to strip spaces and avoid mangling backslashes:
https://github.com/koalaman/shellcheck/wiki/SC2162
Signed-off-by: Kairui Song <kasong@redhat.com>
Acked-by: Philipp Rudo <prudo@redhat.com>
Signed-off-by: Tao Liu <ltao@redhat.com>
upstream: fedora
resolves: bz2003832
conflict: none
commit fdfad3102e
Author: Kairui Song <kasong@redhat.com>
Date: Wed Aug 4 15:46:27 2021 +0800
bash scripts: get rid of unnecessary sed calls
Use bash builtin string substitution instead, as suggested by:
https://github.com/koalaman/shellcheck/wiki/SC2001
Signed-off-by: Kairui Song <kasong@redhat.com>
Acked-by: Philipp Rudo <prudo@redhat.com>
Signed-off-by: Tao Liu <ltao@redhat.com>