Commit Graph

111 Commits

Author SHA1 Message Date
Tao Liu
98e1935293 Don't iterate the whole /sys/devices just to find drm device
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>
2021-11-09 20:48:26 +08:00
Tao Liu
b9cefb4161 mkdumprd: prompt the user to install nfs-utils when mounting NFS fs failed
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>
2021-11-09 20:41:42 +08:00
Tao Liu
16c2821171 bash scripts: use $(...) notation instead of legacy ...
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>
2021-11-09 20:39:50 +08:00
Tao Liu
67611bba2a bash scripts: always use "read -r"
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>
2021-11-09 20:39:17 +08:00
Tao Liu
d07b20d718 bash scripts: get rid of unnecessary sed calls
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>
2021-11-09 20:39:09 +08:00
Tao Liu
480de7c63d bash scripts: get rid of expr and let
upstream: fedora
resolves: bz2003832
conflict: none

commit c4d85142be
Author: Kairui Song <kasong@redhat.com>
Date:   Wed Aug 4 15:18:59 2021 +0800

    bash scripts: get rid of expr and let

    As suggested by:
    https://github.com/koalaman/shellcheck/wiki/SC2219

    Signed-off-by: Kairui Song <kasong@redhat.com>
    Acked-by: Philipp Rudo <prudo@redhat.com>

Signed-off-by: Tao Liu <ltao@redhat.com>
2021-11-09 20:39:02 +08:00
Tao Liu
e07098aa14 bash scripts: remove useless cat
upstream: fedora
resolves: bz2003832
conflict:
    load_kdump_kernel_key() didn't present in rhel9,
    so removed the patch for it.

commit 6d45257cc1
Author: Kairui Song <kasong@redhat.com>
Date:   Wed Aug 4 15:14:00 2021 +0800

    bash scripts: remove useless cat

    Some `cat` calls are useless, remove them to make it cleaner.
    See: https://github.com/koalaman/shellcheck/wiki/SC2002

    Signed-off-by: Kairui Song <kasong@redhat.com>
    Acked-by: Philipp Rudo <prudo@redhat.com>

Signed-off-by: Tao Liu <ltao@redhat.com>
2021-11-09 20:38:55 +08:00
Tao Liu
6d930905d5 dracut-module-setup.sh: remove surrounding $() for subshell
upstream: fedora
resolves: bz2003832
conflict: none

commit 3b0157197b
Author: Kairui Song <kasong@redhat.com>
Date:   Wed Sep 8 15:15:44 2021 +0800

    dracut-module-setup.sh: remove surrounding $() for subshell

    Some functions are executed in subshell to avoid variable environment
    pollution. But the surrounding $() is not needed, and it may lead to
    executing output which is unexpected here.

    See: https://github.com/koalaman/shellcheck/wiki/SC2091

    Signed-off-by: Kairui Song <kasong@redhat.com>
    Suggested-by: Coiby Xu <coxu@redhat.com>

Signed-off-by: Tao Liu <ltao@redhat.com>
2021-11-03 16:15:26 +08:00
Tao Liu
9abf44a082 dracut-module-setup.sh: make iscsi check fail early if cd failed
upstream: fedora
resolves: bz2003832
conflict: none

commit 67e559a6b9
Author: Kairui Song <kasong@redhat.com>
Date:   Wed Aug 4 16:29:55 2021 +0800

    dracut-module-setup.sh: make iscsi check fail early if cd failed

    As suggested by:
    https://github.com/koalaman/shellcheck/wiki/SC2164

    Signed-off-by: Kairui Song <kasong@redhat.com>
    Acked-by: Philipp Rudo <prudo@redhat.com>

Signed-off-by: Tao Liu <ltao@redhat.com>
2021-11-03 16:15:06 +08:00
Tao Liu
72c3befcb8 dracut-module-setup.sh: fix a loop over ls issue
upstream: fedora
resolves: bz2003832
conflict: none

commit 3b2fa982bb
Author: Kairui Song <kasong@redhat.com>
Date:   Wed Aug 4 16:16:44 2021 +0800

    dracut-module-setup.sh: fix a loop over ls issue

    Iterating over ls output is fragile:
    https://github.com/koalaman/shellcheck/wiki/SC2045

    Signed-off-by: Kairui Song <kasong@redhat.com>
    Acked-by: Philipp Rudo <prudo@redhat.com>

Signed-off-by: Tao Liu <ltao@redhat.com>
2021-11-03 16:14:44 +08:00
Tao Liu
057e505536 dracut-module-setup.sh: fix a ambiguous variable reference
upstream: fedora
resolves: bz2003832
conflict: none

commit dfe7555323
Author: Kairui Song <kasong@redhat.com>
Date:   Wed Aug 4 15:51:34 2021 +0800

    dracut-module-setup.sh: fix a ambiguous variable reference

    Wrap the variable with {...}, else it may get interpreted as array due
    to the '[' char next to it.

    Signed-off-by: Kairui Song <kasong@redhat.com>
    Acked-by: Philipp Rudo <prudo@redhat.com>

Signed-off-by: Tao Liu <ltao@redhat.com>
2021-11-03 16:14:24 +08:00
Tao Liu
c8faddc4f8 dracut-module-setup.sh: use "*" to expend array as string
upstream: fedora
resolves: bz2003832
conflict: none

commit da3ad9cbda
Author: Kairui Song <kasong@redhat.com>
Date:   Wed Aug 4 15:47:43 2021 +0800

    dracut-module-setup.sh: use "*" to expend array as string

    As suggested by:
    https://github.com/koalaman/shellcheck/wiki/SC2199
    The array is not quoted here but implicitly concatenate still happens,
    could be harmless but shellcheck complains about it so fix it.

    Signed-off-by: Kairui Song <kasong@redhat.com>
    Acked-by: Philipp Rudo <prudo@redhat.com>

Signed-off-by: Tao Liu <ltao@redhat.com>
2021-11-03 16:14:08 +08:00
Tao Liu
c0cbd45726 dracut-module-setup.sh: fix _bondoptions wrong references
upstream: fedora
resolves: bz2003832
conflict: none

commit 49dd4fcdbb
Author: Kairui Song <kasong@redhat.com>
Date:   Wed Aug 4 15:41:10 2021 +0800

    dracut-module-setup.sh: fix _bondoptions wrong references

    Signed-off-by: Kairui Song <kasong@redhat.com>
    Acked-by: Philipp Rudo <prudo@redhat.com>

Signed-off-by: Tao Liu <ltao@redhat.com>
2021-11-03 16:13:55 +08:00
Tao Liu
3fb4383a9c dracut-module-setup.sh: remove an unused variable
upstream: fedora
resolves: bz2003832
conflict: none

commit ba7aa447b2
Author: Kairui Song <kasong@redhat.com>
Date:   Wed Aug 4 14:29:10 2021 +0800

    dracut-module-setup.sh: remove an unused variable

    Signed-off-by: Kairui Song <kasong@redhat.com>
    Acked-by: Philipp Rudo <prudo@redhat.com>

Signed-off-by: Tao Liu <ltao@redhat.com>
2021-11-03 16:13:40 +08:00
Tao Liu
37b61ee43a dracut-module-setup.sh: rework kdump_get_ip_route_field
upstream: fedora
resolves: bz2003832
conflict: none

commit 46542ccda5
Author: Kairui Song <kasong@redhat.com>
Date:   Wed Aug 4 02:59:43 2021 +0800

    dracut-module-setup.sh: rework kdump_get_ip_route_field

    Avoid duplicated echo / cut / grep call, just use sed.

    Signed-off-by: Kairui Song <kasong@redhat.com>
    Acked-by: Philipp Rudo <prudo@redhat.com>

Signed-off-by: Tao Liu <ltao@redhat.com>
2021-11-03 16:13:28 +08:00
Tao Liu
caa2405338 mkfadumprd: make _dracut_isolate_args an array
upstream: fedora
resolves: bz2003832
conflict: none

commit 982205d607
Author: Kairui Song <kasong@redhat.com>
Date:   Wed Aug 4 03:06:57 2021 +0800

    mkfadumprd: make _dracut_isolate_args an array

    To make arguments list work as expected, array is preferred.

    Check following link for details:
    https://github.com/koalaman/shellcheck/wiki/SC2089

    Signed-off-by: Kairui Song <kasong@redhat.com>
    Acked-by: Philipp Rudo <prudo@redhat.com>

Signed-off-by: Tao Liu <ltao@redhat.com>
2021-11-03 16:13:10 +08:00
Tao Liu
1539061bbe mkdumprd: use array to store ssh arguments in mkdir_save_path_ssh
upstream: fedora
resolves: bz2003832
conflict: none

commit 3a4b0351d0
Author: Kairui Song <kasong@redhat.com>
Date:   Wed Aug 18 15:45:20 2021 +0800

    mkdumprd: use array to store ssh arguments in mkdir_save_path_ssh

    For storing arguments, plain string is not a good choice. Array is
    preferred:

    See: https://github.com/koalaman/shellcheck/wiki/SC2089

    Signed-off-by: Kairui Song <kasong@redhat.com>
    Acked-by: Philipp Rudo <prudo@redhat.com>

Signed-off-by: Tao Liu <ltao@redhat.com>
2021-11-03 16:12:53 +08:00
Tao Liu
9658700a8b mkdumprd: remove an awk call in get_fs_size
upstream: fedora
resolves: bz2003832
conflict: none

commit c486b1fa30
Author: Kairui Song <kasong@redhat.com>
Date:   Tue Sep 7 14:42:30 2021 +0800

    mkdumprd: remove an awk call in get_fs_size

    By using `df --output=avail`, the awk call can be dropped.

    Signed-off-by: Kairui Song <kasong@redhat.com>
    Acked-by: Philipp Rudo <prudo@redhat.com>

Signed-off-by: Tao Liu <ltao@redhat.com>
2021-11-03 16:12:28 +08:00
Tao Liu
033d4cf5fb mkdumprd: fix multiple issues with get_ssh_size
upstream: fedora
resolves: bz2003832
conflict: none

commit d6449e7293
Author: Kairui Song <kasong@redhat.com>
Date:   Wed Aug 4 17:15:42 2021 +0800

    mkdumprd: fix multiple issues with get_ssh_size

    Currently get_ssh_size is not working as expected, it should return the
    target's available space, but it will include df's header row string as
    the result. Fix this issue by only use the last output line.

    And the _opt variable will be used as args so it should be an array.

    Also remove the awk call, just use `df --output=avail` instead.

    Signed-off-by: Kairui Song <kasong@redhat.com>
    Acked-by: Philipp Rudo <prudo@redhat.com>

Signed-off-by: Tao Liu <ltao@redhat.com>
2021-11-03 16:12:12 +08:00
Tao Liu
0d42485888 mkdumprd: remove some redundant echo
upstream: fedora
resolves: bz2003832
conflict: none

commit e4c7b5bbf5
Author: Kairui Song <kasong@redhat.com>
Date:   Wed Aug 4 03:53:35 2021 +0800

    mkdumprd: remove some redundant echo

    Signed-off-by: Kairui Song <kasong@redhat.com>
    Acked-by: Philipp Rudo <prudo@redhat.com>

Signed-off-by: Tao Liu <ltao@redhat.com>
2021-11-03 16:11:52 +08:00
Tao Liu
dd08f1bddd mkdumprd: make dracut_args an array again
upstream: fedora
resolves: bz2003832
conflict: none

commit 227fc2bc7d
Author: Kairui Song <kasong@redhat.com>
Date:   Wed Aug 4 03:50:04 2021 +0800

    mkdumprd: make dracut_args an array again

    To make arguments list work as expected, array is preferred.

    Use xargs only to parse the "dracut_args" config value, and pass the
    array directly to dracut.

    Check following link for details:
    https://github.com/koalaman/shellcheck/wiki/SC2089

    Signed-off-by: Kairui Song <kasong@redhat.com>
    Acked-by: Philipp Rudo <prudo@redhat.com>

Signed-off-by: Tao Liu <ltao@redhat.com>
2021-11-03 16:11:30 +08:00
Tao Liu
514b4f0679 mkdumprd: use kdump_get_conf_val to read config values
upstream: fedora
resolves: bz2003832
conflict: none

commit 075e62252e
Author: Kairui Song <kasong@redhat.com>
Date:   Wed Aug 4 01:58:04 2021 +0800

    mkdumprd: use kdump_get_conf_val to read config values

    Simplify the code and cover more corner cases.

    Signed-off-by: Kairui Song <kasong@redhat.com>
    Acked-by: Philipp Rudo <prudo@redhat.com>

Signed-off-by: Tao Liu <ltao@redhat.com>
2021-11-03 16:11:00 +08:00
Tao Liu
e35e4054ca kdumpctl: refine grep usage
upstream: fedora
resolves: bz2003832
conflict: none

commit 80525aface
Author: Kairui Song <kasong@redhat.com>
Date:   Wed Aug 4 15:44:02 2021 +0800

    kdumpctl: refine grep usage

    Use `grep -q` instead of redirect to /dev/null.

    Use `grep -c` instead, as suggested in:
    https://github.com/koalaman/shellcheck/wiki/SC2126

    Use `grep -E` instead of `egrep`.
    https://github.com/koalaman/shellcheck/wiki/SC2196

    Signed-off-by: Kairui Song <kasong@redhat.com>

Signed-off-by: Tao Liu <ltao@redhat.com>
2021-11-03 16:10:36 +08:00
Tao Liu
6c43817d23 kdumpctl: fix fragile loops over find output
upstream: fedora
resolves: bz2003832
conflict: none

commit dfb76467c9
Author: Kairui Song <kasong@redhat.com>
Date:   Wed Aug 4 16:22:17 2021 +0800

    kdumpctl: fix fragile loops over find output

    For loops over find output are fragile, use a while read loop:
    https://github.com/koalaman/shellcheck/wiki/SC2044

    Signed-off-by: Kairui Song <kasong@redhat.com>
    Acked-by: Philipp Rudo <prudo@redhat.com

Signed-off-by: Tao Liu <ltao@redhat.com>
2021-11-03 16:10:13 +08:00
Tao Liu
6afe4ea23f kdumpctl: use kdump_get_conf_val to read config values
upstream: fedora
resolves: bz2003832
conflict: none

commit 01613b7211
Author: Kairui Song <kasong@redhat.com>
Date:   Tue Aug 3 22:50:02 2021 +0800

    kdumpctl: use kdump_get_conf_val to read config values

    Also fixed kdumpctl, use `awk` instead of `cut` to read
    core_collector's executable name correctly when its arguments
    are not seperated 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>
2021-11-03 16:09:49 +08:00
Tao Liu
9a937b5e22 kdump-lib.sh: use kdump_get_conf_val to read config values
upstream: fedora
resolves: bz2003832
conflict: none

commit ab1ef78aa2
Author: Kairui Song <kasong@redhat.com>
Date:   Wed Aug 4 01:18:48 2021 +0800

    kdump-lib.sh: use kdump_get_conf_val to read config values

    Signed-off-by: Kairui Song <kasong@redhat.com>
    Acked-by: Philipp Rudo <prudo@redhat.com>

Signed-off-by: Tao Liu <ltao@redhat.com>
2021-11-03 16:09:16 +08:00
Tao Liu
14205c1d6f kdump-lib.sh: add a config value retrive helper
upstream: fedora
resolves: bz2003832
conflict: none

commit 09ccf88405
Author: Kairui Song <kasong@redhat.com>
Date:   Mon Aug 16 23:25:14 2021 +0800

    kdump-lib.sh: add a config value retrive helper
    Add a helper kdump_get_conf_val to replace get_option_value.

    It can help cover more corner cases in the code, like when there are
    multiple spaces in config file, config value separated by a tab,
    heading spaces, or trailing comments.

    And this uses "sed group command" and "sed hold buffer", make it much
    faster than previous `grep <config> | tail -1`.

    This helper is supposed to provide a universal way for kexec-tools
    scripts to read in config value. Currently, different scripts are
    reading the config in many different fragile ways.

    For example, following codes are found in kexec-tools script code base:
      1. grep ^force_rebuild $KDUMP_CONFIG_FILE
	 echo $_force_rebuild | cut -d' '  -f2

      2. grep ^kdump_post $KDUMP_CONFIG_FILE | cut -d\  -f2

      3. awk '/^sshkey/ {print $2}' $conf_file

      4. grep ^path $KDUMP_CONFIG_FILE | cut -d' '  -f2-

    1, 2, and 4 will fail if the space is replaced by, e.g. a tab

    1 and 2 might fail if there are multiple spaces between config name
    and config value:
    "kdump_post  /var/crash/scripts/kdump-post.sh"
    A space will be read instead of config value.

    1, 2, 3 will fail if there are space in file path, like:
    "kdump_post /var/crash/scripts dir/kdump-post.sh"

    4 will fail if there are trailing comments:
    "path /var/crash # some comment here"

    And all will fail if there are heading space,
    " path /var/crash"

    And all will most likely cause problems if the config file contains
    the same option more than once.

    And all of them are slower than the new sed call. Old get_option_value
    is also very slow and doesn't handle heading space.

    Although we never claim to support heading space or tailing comments
    before, it's harmless to be more robust on config reading, and many
    conf files in /etc support heading spaces. And have a faster and
    safer config reading helper makes it easier to clean up the code.

    Signed-off-by: Kairui Song <kasong@redhat.com>
    Acked-by: Philipp Rudo <prudo@redhat.com>

Signed-off-by: Tao Liu <ltao@redhat.com>
2021-11-03 16:08:50 +08:00
Tao Liu
67b8dd1cb8 kdump-lib.sh: add a config format and read helper
upstream: fedora
resolves: bz2003832
conflict: none

commit a0282ab22c
Author: Kairui Song <kasong@redhat.com>
Date:   Tue Aug 3 19:49:51 2021 +0800

    kdump-lib.sh: add a config format and read helper

    Add a helper `kdump_read_conf` to replace read_strip_comments.
    `kdump_read_conf` does a few more things:

      - remove trailing spaces.
      - format the content, remove duplicated spaces between name and value.
      - read from KDUMP_CONFIG_FILE (/etc/kdump.conf) directly, avoid pasting
	"/etc/kdump.conf" path everywhere in the code.
      - check if config file exists, just in case.

    Also unify the environmental variable, now KDUMP_CONFIG_FILE stands for
    the default config location.

    This helps avoid some shell pitfalls about spaces when reading config.

    Signed-off-by: Kairui Song <kasong@redhat.com>
    Acked-by: Philipp Rudo <prudo@redhat.com>

Signed-off-by: Tao Liu <ltao@redhat.com>
2021-11-03 16:08:22 +08:00
Tao Liu
45ebaec123 Add a .editorconfig file
upstream: fedora
resolves: bz2003832
conflict: none

commit bcb1176ec6
Author: Kairui Song <kasong@redhat.com>
Date:   Fri Jul 30 01:08:30 2021 +0800

    Add a .editorconfig file

    EditorConfig file is helpful for tools like `shfmt`, also could be a
    hint for code styling.

    The code style spec used in this new added .editorconfig file is
    generated based on existing code style.

    Following commits will make mkfadumprd, mkdumprd, kdumpctl, kdump-lib.sh,
    and *-module-setup.sh only be used in first kernel, so use bash syntax
    for these scripts. Other scripts will use sh syntax for better POSIX
    compatibility.

    Signed-off-by: Kairui Song <kasong@redhat.com>
    Acked-by: Pingfan Liu <piliu@redhat.com>
    Acked-by: Philipp Rudo <prudo@redhat.com>

Signed-off-by: Tao Liu <ltao@redhat.com>
2021-11-03 16:06:56 +08:00
Tao Liu
7ccb7e18e7 Remove hard requirement on grubby
Resolves: bz2014626
Upstream: Fedora
Conflict: None

commit 7ddda7e6d0
Author: Kairui Song <kasong@redhat.com>
Date:   Wed Aug 18 22:25:22 2021 +0800

    Remove hard requirement on grubby

    Downgrade to "Recommends:" as suggested by CoreOS team.

    Signed-off-by: Kairui Song <kasong@redhat.com>
    Acked-by: Tao Liu <ltao@redhat.com>

Signed-off-by: Tao Liu <ltao@redhat.com>
Signed-off-by: Timothée Ravier <travier@redhat.com>
2021-10-28 13:26:19 +08:00
Tao Liu
c65278f12a Release 2.0.22-14
Resolves: bz1986667

Signed-off-by: Tao Liu <ltao@redhat.com>
2021-09-08 14:11:53 +08:00
Tao Liu
220b190cd8 Add file supported-kdump-targets.txt to kexec-tools
Resolves: bz1986667
Copied from rhel-8.5

Signed-off-by: Tao Liu <ltao@redhat.com>
2021-09-07 14:32:27 +08:00
Mohan Boddu
c1406d2cab Rebuilt for IMA sigs, glibc 2.34, aarch64 flags
Related: rhbz#1991688
Signed-off-by: Mohan Boddu <mboddu@redhat.com>
2021-08-09 21:11:43 +00:00
Tao Liu
572dfb2ae8 Release 2.0.22-13
Resolves: bz1986250

Signed-off-by: Tao Liu <ltao@redhat.com>
2021-08-09 09:56:52 +08:00
Kairui Song
f3db4acbcf Clear old crashkernl=auto in comment and doc
Resolves: bz1986250
Upstream: Fedora

commit 097059dedc
Author: Kairui Song <kasong@redhat.com>
Date:   Fri Jul 30 14:40:45 2021 +0800

    Clear old crashkernl=auto in comment and doc

    Acked-by: Pingfan Liu <piliu@redhat.com>
    Signed-off-by: Kairui Song <kasong@redhat.com>

Signed-off-by: Kairui Song <kasong@redhat.com>
2021-08-06 01:33:34 +00:00
Tao Liu
a42016ff19 Release 2.0.22-12
Resolves: bz1981684
Resolves: bz1986281

Signed-off-by: Tao Liu <ltao@redhat.com>
2021-08-02 10:31:39 +08:00
Kairui Song
6cc04b5313 kdumpctl: fix a typo
Resolves: bz1981684
Conflict: Minor conflict resolved easily
Upstream: Fedora

commit bcd8d6a47b
Author: Kairui Song <kasong@redhat.com>
Date:   Thu Jul 15 03:08:28 2021 +0800

    kdumpctl: fix a typo

    Recommanded -> Recommended

    Signed-off-by: Kairui Song <kasong@redhat.com>
    Acked-by: Coiby Xu <coxu@redhat.com>

Signed-off-by: Kairui Song <kasong@redhat.com>
2021-07-30 09:21:21 +00:00
Kairui Song
abb0c38b7f kdump-lib.sh: kdump_get_arch_recommend_size uses crashkernel.default
Resolves: bz1986281
Conflict: None
Upstream: Fedora

commit 7b7ddaba88
Author: Kairui Song <kasong@redhat.com>
Date:   Fri Jul 2 01:31:26 2021 +0800

    kdump-lib.sh: kdump_get_arch_recommend_size uses crashkernel.default

    The new `crashkernel.default` file in kernel package can be used as the
    ck_cmdline source.

    Also keep the legacy code so old kernel packages will still work.

    Signed-off-by: Kairui Song <kasong@redhat.com>
    Acked-by: Pingfan Liu <piliu@redhat.com>

Signed-off-by: Kairui Song <kasong@redhat.com>
2021-07-30 15:22:14 +08:00
Tao Liu
0ef6c1aa27 Release 2.0.22-11
Resolves: bz1972463
Resolves: bz1982474
Resolves: bz1979879

Signed-off-by: Tao Liu <ltao@redhat.com>
2021-07-26 10:30:33 +08:00
Kairui Song
0cbec881dc Make dump_to_rootfs wait for 90s for real
Previous commit da6b280 ('Cleanup dead systemd services before start sysroot.mount')
is not enough for fixing bz1972463. Coiby found a new issue that never
saw before, this patch fixes it.

Resolves: bz1972463
Conflict: None
Upstream: Fedora

commit 660cf4ac03
Author: Kairui Song <kasong@redhat.com>
Date:   Tue Jul 20 13:41:08 2021 +0800

    Make `dump_to_rootfs` wait for 90s for real

    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@redhat.com>
    Acked-by: Coiby Xu <coxu@redhat.com>

Signed-off-by: Kairui Song <kasong@redhat.com>
2021-07-22 09:59:16 +00:00
Coiby Xu
d4de3e9dcc Check the existence of /sys/bus/ccwgroup/devices/*/online beforehand
Resolves: bz1982474
Upstream: Fedora
Conflict: None

commit b2bbb54d89
Author: Coiby Xu <coxu@redhat.com>
Date:   Thu Jul 15 09:18:33 2021 +0800

    Check the existence of /sys/bus/ccwgroup/devices/*/online beforehand

    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 7d47251568
           ("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@redhat.com>
    Signed-off-by: Coiby Xu <coxu@redhat.com>
    Acked-by: Kairui Song <kasong@redhat.com>

Signed-off-by: Coiby Xu <coxu@redhat.com>
2021-07-21 17:24:50 +08:00
Philipp Rudo
3f28dc72a2 kdump.sysconfig.s390: Remove "prot_virt" from kdump kernel cmdline
Resolves: bz1979879
Upstream: Fedora
Conflict: None

commit 914a856c66
Author: Philipp Rudo <prudo@redhat.com>
Date:   Fri Jul 16 10:34:35 2021 +0200

    kdump.sysconfig.s390: Remove "prot_virt" from kdump kernel cmdline

    "prot_virt" enables the kernel to run Secure Execution virtual machines
    on s390. These virtual machines are isolated from the hypervisor and
    thus protected against tampering by a malicious host. Enabling
    "prot_virt" requires a minimum of ~2.5GB memory which exceeds what is
    typically reserved for the crashkernel. Thus remove "prot_virt" from the
    command line for the 2nd kernel to prevent it to run out-of-memory.

    For more discussions about this, see:
    https://lists.fedoraproject.org/archives/list/kexec@lists.fedoraproject.org/thread/QSRRNV4ALKXUJC2VM3US4Z2NSQRHVMXB/

    Signed-off-by: Philipp Rudo <prudo@redhat.com>
    Acked-by: Baoquan He <bhe@redhat.com>

Signed-off-by: Philipp Rudo <prudo@redhat.com>
2021-07-20 17:27:12 +02:00
Tao Liu
b84de553b4 Release 2.0.22-10
Resolves: bz1924115
Resolves: bz1972463
Resolves: bz1977559

Signed-off-by: Tao Liu <ltao@redhat.com>
2021-07-20 15:51:38 +08:00
Kairui Song
2b7f081a06 fadump-init: clean up mount points properly
Resolves: bz1924115
Conflict: None
Upstream: Fedora

commit 97930d3cca
Author: Kairui Song <kasong@redhat.com>
Date:   Mon Jun 28 13:57:27 2021 +0800

    fadump-init: clean up mount points properly

    When running with squash module enabled for both initramfs, /dev and
    /run are also mounted by squash-init, so move them to newroot as well,
    else they might leak.

    Also pass `-d` to umount so loop devices (if used) will be force freed.

    Signed-off-by: Kairui Song <kasong@redhat.com>
    Acked-by: Hari Bathini <hbathini@linux.ibm.com>

Signed-off-by: Kairui Song <kasong@redhat.com>
2021-07-20 15:43:43 +08:00
Kairui Song
8e51ebe6fb fadump: kdumpctl should check the modules used by the fadump initramfs
Resolves: bz1924115
Conflict: None
Upstream: Fedora

commit bf6671b60d
Author: Kairui Song <kasong@redhat.com>
Date:   Fri Jun 25 14:44:45 2021 +0800

    fadump: kdumpctl should check the modules used by the fadump initramfs

    After fadump embedded the fadump initramfs in the normal initramfs,
    kdumpctl will mistakenly rebuild the initramfs everytime.

    kdumpctl checks the hostonly-kernel-modules.txt file in initramfs
    to check if required drivers are included, but the normal initramfs
    is built in non-hostonly mode, so it doesn't have a
    hostonly-kernel-modules.txt file. The check will always fail.

    So let mkfadumprd make a copy of the hostonly-kernel-modules.txt in the
    fadump initramfs and let kdumpctl check that file instead.

    Signed-off-by: Kairui Song <kasong@redhat.com>
    Acked-by: Hari Bathini <hbathini@linux.ibm.com>

Signed-off-by: Kairui Song <kasong@redhat.com>
2021-07-20 15:43:26 +08:00
Kairui Song
96a3fc1ac8 fadump: isolate fadump initramfs image within the default one
Resolves: bz1924115
Conflict: None
Upstream: Fedora

commit fa9201b240 (devel)
Author: Hari Bathini <hbathini@linux.ibm.com>
Date:   Wed Jun 23 20:06:48 2021 +0530

    fadump: isolate fadump initramfs image within the default one

    In case of fadump, the initramfs image has to be built to boot into
    the production environment as well as to offload the active crash dump
    to the specified dump target (for boot after crash). As the same image
    would be used for both boot scenarios, it could not be built optimally
    while accommodating both cases.

    Use --include to include the initramfs image built for offloading
    active crash dump to the specified dump target. Also, introduce a new
    out-of-tree dracut module (99zz-fadumpinit) that installs a customized
    init program while moving the default /init to /init.dracut. This
    customized init program is leveraged to isolate fadump image within
    the default initramfs image by kicking off default boot process
    (exec /init.dracut) for regular boot scenario and activating fadump
    initramfs image, if the system is booting after a crash.

    If squash is available, ensure default initramfs image is also built
    with squash module to reduce memory consumption in capture kernel.

    Signed-off-by: Hari Bathini <hbathini@linux.ibm.com>
    Signed-off-by: Kairui Song <kasong@redhat.com>
    Acked-by: Kairui Song <kasong@redhat.com>

Signed-off-by: Kairui Song <kasong@redhat.com>
2021-07-20 15:43:11 +08:00
Kairui Song
da6b280a63 Cleanup dead systemd services before start sysroot.mount
Resolves: bz1972463
Conflict: None
Upstream: Fedora

commit 2603ba7187 (origin/rawhide, rawhide)
Author: Kairui Song <kasong@redhat.com>
Date:   Fri Jul 2 03:27:05 2021 +0800

    Cleanup dead systemd services before start sysroot.mount

    When kdump failed due to initqueue timeout, the sysroot.mount and other
    serivces could be stuck in `start` but `dead` status:

    Example output of systemctl:

    dev-disk-by\x2duuid-530830d1\x2df2c7\x2d4c9a\x2d9a82\x2d148609097521.device loaded inactive   dead    start
    <... snip ...>
    squash-root.mount               loaded active     mounted       /squash/root
    squash.mount                    loaded active     mounted       /squash
    sysroot.mount                   loaded inactive   dead    start /sysroot
    <... snip ...>
    dracut-cmdline.service          loaded active     exited        dracut cmdline hook
    dracut-initqueue.service        loaded activating start   start dracut initqueue hook
    dracut-mount.service            loaded inactive   dead    start dracut mount hook

    At this point calling `systemctl start sysroot.mount` will just hang as
    systemd will just wait for the services that are stuck in `start`
    status. So call `systemctl cancel` here to cancel all pending jobs and
    have a clean start for mounting sysroot.

    Signed-off-by: Kairui Song <kasong@redhat.com>
    Acked-by: Coiby Xu <coxu@redhat.com>

Signed-off-by: Kairui Song <kasong@redhat.com>
2021-07-20 07:12:55 +00:00
Coiby Xu
396e92f397 Revert "Revert "x86_64: enable the kexec file load by default""
Resolves: bz1977559
Upstream: Fedora
Conflict: None

commit 7ae9669f3961c9a95f3b04803bf61730b34f585a
Author: Coiby Xu <coxu@redhat.com>
Date:   Tue Jul 6 10:31:36 2021 +0800

    Revert "Revert "x86_64: enable the kexec file load by default""

    This reverts commit 073c30973c, i.e.
    re-enable the kexec file load by default since this dual signature
    issue no longer bothers Fedora 34.

    Signed-off-by: Coiby Xu <coxu@redhat.com>
    Acked-by: Kairui Song <kasong@redhat.com>

Signed-off-by: Coiby Xu <coxu@redhat.com>
2021-07-14 09:21:57 +08:00
Tao Liu
0fb5d148a2 Release 2.0.22-9
Resolves: bz1974638
Resolves: bz1977543

Signed-off-by: Tao Liu <ltao@redhat.com>
2021-07-12 09:04:31 +08:00
Kairui Song
f5ffd4fd22 Add a crashkernel-howto.txt doc
Resolves: bz1974638
Upstream: Fedora
Conflict: None

commit 7dbbb4bb31
Author: Kairui Song <kasong@redhat.com>
Date:   Fri Jun 25 04:01:45 2021 +0800

    Add a crashkernel-howto.txt doc

    Signed-off-by: Kairui Song <kasong@redhat.com>
    Acked-by: Baoquan He <bhe@redhat.com>

Signed-off-by: Kairui Song <kasong@redhat.com>
2021-07-08 15:43:40 +08:00