Commit Graph

35 Commits

Author SHA1 Message Date
Coiby Xu
3f828198af rewrite reset_crashkernel to support fadump and to used by RPM scriptlet
Resolves: bz1895258
Upstream: Fedora
Conflict: None

commit 140da74a34
Author: Coiby Xu <coxu@redhat.com>
Date:   Wed Dec 1 13:39:40 2021 +0800

    rewrite reset_crashkernel to support fadump and to used by RPM scriptlet

    Rewrite kdumpctl reset-crashkernel KERNEL_PATH as
    kdumpctl reset-crashkernel [--fadump=[on|off|nocma]]  [--kernel=path_to_kernel] [--reboot]

    This interface would reset a specific kernel to the default crashkernel value
    given the kernel path. And it also supports grubby's syntax so there are the
    following special cases,
     - if --kernel not specified,
        - use KDUMP_KERNELVER if it's defined in /etc/sysconfig/kdump
        - otherwise use current running kernel, i.e. `uname -r`
     - if --kernel=DEFAULT, the default boot kernel is chosen
     - if --kernel=ALL, all kernels would have its crashkernel reset to the
       default value and the /etc/default/grub is updated as well

    --fadump=[on|off|nocma] toggles fadump on/off for the kernel provided
    in KERNEL_PATH. If --fadump is omitted, the dump mode is determined by
    parsing the kernel command line for the kernel(s) to update.

    CoreOS/Atomic/Silverblue needs to be treated as a special case because,
     - "rpm-ostree kargs" is used to manage kernel command line parameters
        so --kernel doesn't make sense and there is no need to find current
        running kernel
     - "rpm-ostree kargs" itself would prompt the user to reboot the system
       after modify the kernel command line parameter
     - POWER is not supported so we can assume the dump mode is always kdump

    This interface will also be called by kexec-tools RPM scriptlets [1]
    to reset crashkernel.

    Note the support of crashkenrel.default is dropped.

    [1] https://docs.fedoraproject.org/en-US/packaging-guidelines/Scriptlets/

    Reviewed-by: Pingfan Liu <piliu@redhat.com>
    Reviewed-by: Philipp Rudo <prudo@redhat.com>
    Signed-off-by: Coiby Xu <coxu@redhat.com>

Signed-off-by: Coiby Xu <coxu@redhat.com>
2022-01-06 03:55:25 +00:00
Coiby Xu
16777a88b8 fix incorrect usage of rpm-ostree to update kernel command line parameters
Resolves: bz1895258
Upstream: Fedora
Conflict: None

commit 12ecbce359
Author: Coiby Xu <coxu@redhat.com>
Date:   Mon Dec 13 10:57:13 2021 +0800

    fix incorrect usage of rpm-ostree to update kernel command line parameters

    CoreOS/Atomic/Silverblue use "rpm-ostree kargs" to manage kernel command
    line parameters.

    Fixes: 86130ec ("kdumpctl: Add kdumpctl reset-crashkernel")

    Reviewed-by: Pingfan Liu <piliu@redhat.com>
    Reviewed-by: Philipp Rudo <prudo@redhat.com>
    Signed-off-by: Coiby Xu <coxu@redhat.com>

Signed-off-by: Coiby Xu <coxu@redhat.com>
2022-01-06 03:55:25 +00:00
Coiby Xu
b3d9b9bd5c add helper functions to get kernel path by kernel release and the path of current running kernel
Resolves: bz1895258
Upstream: Fedora
Conflict: None

commit 945cbbd59b
Author: Coiby Xu <coxu@redhat.com>
Date:   Tue Dec 7 15:16:07 2021 +0800

    add helper functions to get kernel path by kernel release and the path of current running kernel

    grubby --info=kernel-path or --add-kernel=kernel-path accepts a kernel
    path (e.g. /boot/vmlinuz-5.14.14-200.fc34.x86_64) instead of kernel release
    (e.g 5.14.14-200.fc34.x86_64). So we need to know the kernel path given
    a kernel release. Although for Fedora/RHEL, the kernel path is
    "/boot/vmlinuz-<KERNEL_RELEASE>", a path kernel could also be
    /boot/<machine-id>/<KERNEL_RELEASE>/vmlinuz. So the most reliable way to
    find the kernel path given a kernel release is to use "grubby --info".

    For osbuild, a kernel path may not yet exist but it's valid for
    "grubby --update-kernel=KERNEL_PATH". For example, "grubby -info" may
    output something as follows,

    index=0
    kernel="/var/cache/osbuild-worker/osbuild-store/tmp/tmp2prywdy5object/tree/boot/vmlinuz-5.15.10-100.fc34.x86_64"
    args="ro no_timer_check net.ifnames=0 console=tty1 console=ttyS0,115200n8"
    root="UUID=76a22bf4-f153-4541-b6c7-0332c0dfaeac"
    initrd="/var/cache/osbuild-worker/osbuild-store/tmp/tmp2prywdy5object/tree/boot/initramfs-5.15.10-100.fc34.x86_64.img"

    There is no need to check if path like
    /var/cache/osbuild-worker/osbuild-store/tmp/tmp2prywdy5object/tree/boot/vmlinuz-5.15.10-100.fc34.x86_64
    physically exists.

    Note these helper functions doesn't support CoreOS/Atomic/Silverblue
    since grubby isn't used by them.

    Reviewed-by: Pingfan Liu <piliu@redhat.com>
    Reviewed-by: Philipp Rudo <prudo@redhat.com>
    Signed-off-by: Coiby Xu <coxu@redhat.com>

Signed-off-by: Coiby Xu <coxu@redhat.com>
2022-01-06 03:55:25 +00:00
Coiby Xu
d5cf913260 add helper functions to get dump mode
Resolves: bz1895258
Upstream: Fedora
Conflict: None

commit 3d2079c31c
Author: Coiby Xu <coxu@redhat.com>
Date:   Wed Dec 1 16:57:15 2021 +0800

    add helper functions to get dump mode

    Add a helper function to get dump mode. The dump mode would be
     - fadump if fadump=on or fadump=nocma
     - kdump if fadump=off or empty fadump

    Otherwise return 1.

    Also add another helper function to return a kernel's dump mode.

    Reviewed-by: Pingfan Liu <piliu@redhat.com>
    Reviewed-by: Philipp Rudo <prudo@redhat.com>
    Signed-off-by: Coiby Xu <coxu@redhat.com>

Signed-off-by: Coiby Xu <coxu@redhat.com>
2022-01-06 03:55:25 +00:00
Coiby Xu
27b5ab3cbb add a helper function to read kernel cmdline parameter from grubby --info
Resolves: bz1895258
Upstream: Fedora
Conflict: None

commit fb9e6838ab
Author: Coiby Xu <coxu@redhat.com>
Date:   Tue Nov 16 06:48:40 2021 +0800

    add a helper function to read kernel cmdline parameter from grubby --info

    This helper function will be used to retrieve the value of kernel
    cmdline parameters including crashkernel, fadump, swiotlb and etc.

    Suggested-by: Philipp Rudo <prudo@redhat.com>
    Reviewed-by: Pingfan Liu <piliu@redhat.com>
    Signed-off-by: Coiby Xu <coxu@redhat.com>

Signed-off-by: Coiby Xu <coxu@redhat.com>
2022-01-06 03:55:25 +00:00
Coiby Xu
acf9f64ca6 provide kdumpctl get-default-crashkernel for kdump_anaconda_addon and RPM scriptlet
Resolves: bz1895258
Upstream: Fedora
Conflict: None

commit 796d0f6fd2
Author: Coiby Xu <coxu@redhat.com>
Date:   Tue Nov 16 12:23:02 2021 +0800

    provide kdumpctl get-default-crashkernel for kdump_anaconda_addon and RPM scriptlet

    Provide "kdumpctl get-default-crashkernel" for kdump_anaconda_addon
    so crashkernel.default isn't needed.

    When fadump is on, kdump_anaconda_addon would need to specify the dump
    mode, i.e. "kdumpctl get-default-crashkernel fadump".

    This interface would also be used by RPM scriptlet [1] to fetch default
    crashkernel value.

    [1] https://docs.fedoraproject.org/en-US/packaging-guidelines/Scriptlets/

    Reviewed-by: Pingfan Liu <piliu@redhat.com>
    Reviewed-by: Philipp Rudo <prudo@redhat.com>
    Signed-off-by: Coiby Xu <coxu@redhat.com>

Signed-off-by: Coiby Xu <coxu@redhat.com>
2022-01-06 03:55:25 +00:00
Coiby Xu
eb95f93880 kdumpctl: enable secure boot on ppc64le LPARs
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>
2021-11-26 12:03:07 +08:00
Tao Liu
b494b7f193 bash scripts: reformat with shfmt
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>
2021-11-09 21:42:45 +08:00
Tao Liu
63308480fc bash scripts: declare and assign separately
upstream: fedora
resolves: bz2003832
conflict: none

commit 4f75e16700
Author: Kairui Song <kasong@redhat.com>
Date:   Wed Aug 18 02:04:45 2021 +0800

    bash scripts: declare and assign separately

    Declare and assign separately to avoid masking return values:
    https://github.com/koalaman/shellcheck/wiki/SC2155

    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 21:37:15 +08:00
Tao Liu
f6d6b60a6a bash scripts: fix redundant exit code check
upstream: fedora
resolves: bz2003832
conflict: none

commit a4648fc851
Author: Kairui Song <kasong@redhat.com>
Date:   Wed Sep 8 17:23:16 2021 +0800

    bash scripts: fix redundant exit code check

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

    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 21:35:45 +08:00
Tao Liu
bf4667b866 bash scripts: fix variable quoting issue
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/SC2046
    https://github.com/koalaman/shellcheck/wiki/SC2053
    https://github.com/koalaman/shellcheck/wiki/SC2068
    https://github.com/koalaman/shellcheck/wiki/SC2086
    https://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>
2021-11-09 21:27:55 +08:00
Tao Liu
dcb59c30d5 bash scripts: replace '[ ]' with '[[ ]]' for bash scripts
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>
2021-11-09 21:13:59 +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
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
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
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
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
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
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
a0fe51b32e kdumpctl: Add kdumpctl reset-crashkernel
Resolves: bz1974638
Upstream: Fedora
Conflict: None

commit 86130ec10f
Author: Kairui Song <kasong@redhat.com>
Date:   Thu Jun 10 13:06:22 2021 +0800

    kdumpctl: Add kdumpctl reset-crashkernel

    In newer kernel, crashkernel.default will contain the default
    crashkernel value of a kernel build. So introduce a new sub command
    to help user reset kernel crashkernel size to the default value.

    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:42:14 +08:00
Tao Liu
ba2668b537 kdumpctl: fix check_config error when kdump.conf is empty
Resolves: bz1975632
Upstream: Fedora
Conflict: None

commit 6137956f79
Author: Kairui Song <kasong@redhat.com>
Date:   Wed Apr 14 13:41:19 2021 +0800

    kdumpctl: fix check_config error when kdump.conf is empty

    Kdump scirpt already have default values for core_collector, path in
    many other place. Empty kdump.conf still works. Fix this corner case and
    fix the error message.

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

Signed-off-by: Tao Liu <ltao@redhat.com>
2021-06-25 12:29:40 +08:00
Tao Liu
5f4c5f9819 Write to /var/lib/kdump if $KDUMP_BOOTDIR not writable
Resolves: bz1965952
Upstream: Fedora
Conflict: None

commit 75bdcb7399
Author: Kelvin Fan <kfan@redhat.com>
Date:   Fri Apr 16 22:31:13 2021 +0000

    Write to `/var/lib/kdump` if $KDUMP_BOOTDIR not writable

    The `/boot` directory on some operating systems might be read-only.
    If we cannot write to `$KDUMP_BOOTDIR` when generating the kdump
    initrd, attempt to place the generated initrd at `/var/lib/kdump`
    instead.

    Signed-off by: Kelvin Fan <kelvinfan001@gmail.com>
    Acked-by: Kairui Song <kasong@redhat.com>

Signed-off-by: Tao Liu <ltao@redhat.com>
2021-06-23 09:34:40 +08:00
Kairui Song
a9fda5c885 kdumpctl: Add kdumpctl estimate
Resolves: bz1951415
Upstream: fedora
Conflict: none

commit e9e6a2c745
Author: Kairui Song <kasong@redhat.com>
Date:   Thu Apr 22 03:27:10 2021 +0800

    kdumpctl: Add kdumpctl estimate

    Add a rough esitimation support, currently, following memory usage are
    checked by this sub command:

    - System RAM
    - Kdump Initramfs size
    - Kdump Kernel image size
    - Kdump Kernel module size
    - Kdump userspace user and other runtime allocated memory (currently
      simply using a fixed value: 64M)
    - LUKS encryption memory usage

    The output of kdumpctl estimate looks like this:
      # kdumpctl estimate
      Reserved crashkernel:    256M
      Recommanded crashkernel: 160M

      Kernel image size:   47M
      Kernel modules size: 12M
      Initramfs size:      19M
      Runtime reservation: 64M
      Large modules:
          xfs: 1892352
          nouveau: 2318336

    And if the kdump target is encrypted:
      # kdumpctl estimate
      Encrypted kdump target requires extra memory, assuming using the keyslot with minimun memory requirement

      Reserved crashkernel:    256M
      Recommanded crashkernel: 655M

      Kernel image size:   47M
      Kernel modules size: 12M
      Initramfs size:      19M
      Runtime reservation: 64M
      LUKS required size:  512M
      Large modules:
          xfs: 1892352
          nouveau: 2318336
      WARNING: Current crashkernel size is lower than recommanded size 655M.

    The "Recommanded" value is calculated based on memory usages mentioned
    above, and will be adjusted accodingly to be no less than the value provided
    by kdump_get_arch_recommend_size.

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

Signed-off-by: Kairui Song <kasong@redhat.com>
2021-05-20 16:08:16 +08:00
DistroBaker
624a6443ca Merged update from upstream sources
This is an automated DistroBaker update from upstream sources.
If you do not know what this is about or would like to opt out,
contact the OSCI team.

Source: https://src.fedoraproject.org/rpms/kexec-tools.git#33108ef524ff033295711f888ce2c67d457951aa
2021-01-22 08:12:00 +00:00
DistroBaker
6333173003 Merged update from upstream sources
This is an automated DistroBaker update from upstream sources.
If you do not know what this is about or would like to opt out,
contact the OSCI team.

Source: https://src.fedoraproject.org/rpms/kexec-tools.git#fc703518525dc85b88873120f2bcf7bffa682735
2021-01-08 13:46:38 +00:00
DistroBaker
a1014067b4 Merged update from upstream sources
This is an automated DistroBaker update from upstream sources.
If you do not know what this is about or would like to opt out,
contact the OSCI team.

Source: https://src.fedoraproject.org/rpms/kexec-tools.git#d5e39c9f7b721b80d2aa1afa85c38754a5be074e
2020-11-30 11:50:38 +00:00
DistroBaker
17a51515f0 Merged update from upstream sources
This is an automated DistroBaker update from upstream sources.
If you do not know what this is about or would like to opt out,
contact the OSCI team.

Source: https://src.fedoraproject.org/rpms/kexec-tools.git#4f492cf73ea11ff74f5b062e18fcea45cb5e7eeb
2020-11-20 12:35:49 +00:00
DistroBaker
5cac7c3f96 Merged update from upstream sources
This is an automated DistroBaker update from upstream sources.
If you do not know what this is about or would like to opt out,
contact the OSCI team.

Source: https://src.fedoraproject.org/rpms/kexec-tools.git#bfd06661e81465d077bac435c90b4082134adf19
2020-11-05 05:34:29 +00:00
Petr Šabata
f5bf4978d8 RHEL 9.0.0 Alpha bootstrap
The content of this branch was automatically imported from Fedora ELN
with the following as its source:
https://src.fedoraproject.org/rpms/kexec-tools#041ba89902961b5490a7143d9596dc00d732cba0
2020-10-15 14:45:57 +02:00