[PATCH] kdumpctl: check hostonly-kernel-modules.txt for kernel module
by Kairui Song
Since Dracut commit a0d9ad6 loaded-kernel-modules is renamed to
hostonly-kernel-modules and contains all hostonly modules. So check
hostonly-kernel-modules instead for module change.
Signed-off-by: Kairui Song <kasong(a)redhat.com>
---
kdumpctl | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/kdumpctl b/kdumpctl
index 0bf5c20..414d1ab 100755
--- a/kdumpctl
+++ b/kdumpctl
@@ -406,7 +406,7 @@ check_dump_fs_modified()
local _target _path _dracut_args
local _target_drivers _module_name
- local _old_drivers="$(lsinitrd $TARGET_INITRD -f /usr/lib/dracut/loaded-kernel-modules.txt | tr '\n' ' ')"
+ local _old_drivers="$(lsinitrd $TARGET_INITRD -f /usr/lib/dracut/hostonly-kernel-modules.txt | tr '\n' ' ')"
# No need to check in case of mount target specified via "dracut_args".
if is_mount_in_dracut_args; then
--
2.24.1
4 years, 1 month
[PATCH] Introduce get_kdump_path_from_target and fix duplicated /
by Kairui Song
User a helper to get the path to mount dump target in kdump kernel, and
fix duplicated '/' in the mount path problem.
Fixes: bz1785371
Signed-off-by: Kairui Song <kasong(a)redhat.com>
---
kdump-lib.sh | 19 +++++++++++++++++++
kdumpctl | 7 +------
mkdumprd | 20 +++++---------------
3 files changed, 25 insertions(+), 21 deletions(-)
diff --git a/kdump-lib.sh b/kdump-lib.sh
index 9c41439..d27aa3b 100755
--- a/kdump-lib.sh
+++ b/kdump-lib.sh
@@ -285,6 +285,25 @@ get_mntpoint_from_target()
fi
}
+# Get the path where the target will be mounted in kdump kernel
+# $1: kdump target device
+get_kdump_path_from_target()
+{
+ local _mntpoint=$(get_mntpoint_from_target $1)
+
+ # mount under /sysroot if dump to root disk or mount under
+ # /kdumproot/$_mntpoint in other cases in 2nd kernel. systemd
+ # will be in charge to umount it.
+ if [ "$_mntpoint" = "/" ];then
+ _mntpoint="/sysroot"
+ else
+ _mntpoint="/kdumproot/$_mntpoint"
+ fi
+
+ # strip duplicated "/"
+ echo $_mntpoint | tr -s "/"
+}
+
# get_option_value <option_name>
# retrieves value of option defined in kdump.conf
get_option_value() {
diff --git a/kdumpctl b/kdumpctl
index 88128a3..594f99d 100755
--- a/kdumpctl
+++ b/kdumpctl
@@ -480,12 +480,7 @@ check_dump_fs_modified()
return 2
fi
- if [[ "$_target" = "$(get_root_fs_device)" ]]; then
- _new_mntpoint="/sysroot"
- else
- _new_mntpoint="/kdumproot/$(get_mntpoint_from_target $_target)"
- fi
-
+ _new_mntpoint="$(get_kdump_path_from_target $_target)"
_dracut_args=$(lsinitrd $TARGET_INITRD -f usr/lib/dracut/build-parameter.txt)
if [[ -z "$_dracut_args" ]];then
echo "Warning: No dracut arguments found in initrd"
diff --git a/mkdumprd b/mkdumprd
index b46fd32..c6a0586 100644
--- a/mkdumprd
+++ b/mkdumprd
@@ -54,21 +54,12 @@ add_dracut_sshkey() {
# caller should ensure $1 is valid and mounted in 1st kernel
to_mount() {
- local _dev=$1 _source _target _fstype _options _mntopts _pdev
+ local _dev=$1 _source _new_mntpoint _fstype _options _mntopts _pdev
_source=$(findmnt -k -f -n -r -o SOURCE $_dev)
- _target=$(get_mntpoint_from_target $_dev)
- # mount under /sysroot if dump to root disk or mount under
- #/kdumproot/$_target in other cases in 2nd kernel. systemd
- #will be in charge to umount it.
-
- if [ "$_target" = "/" ];then
- _target="/sysroot"
- else
- _target="/kdumproot/$_target"
- fi
-
_fstype=$(findmnt -k -f -n -r -o FSTYPE $_dev)
+ _new_mntpoint=$(get_kdump_path_from_target $_dev)
+
[[ -e /etc/fstab ]] && _options=$(findmnt --fstab -f -n -r -o OPTIONS $_dev)
if [ -z "$_options" ]; then
_options=$(findmnt -k -f -n -r -o OPTIONS $_dev)
@@ -88,14 +79,13 @@ to_mount() {
# only mount the dump target when needed.
_options="$_options,noauto"
- _mntopts="$_target $_fstype $_options"
- #for non-nfs _dev converting to use udev persistent name
+ _mntopts="$_new_mntpoint $_fstype $_options"
+ # for non-nfs _dev converting to use udev persistent name
if [ -b "$_source" ]; then
_pdev="$(get_persistent_dev $_source)"
if [ -z "$_pdev" ]; then
return 1
fi
-
else
_pdev=$_dev
fi
--
2.24.1
4 years, 1 month
[PATCH v2] mkdumprd: Use DUMP_TARGET which printing error message during ssh
by Bhupesh Sharma
When building kdump initramfs for a SSH dump target, mkdumprd would
check whether it has the write permission on the SSH Server's
$DUMP_TARGET.
However $DUMP_TARGET is missing in the actual error message when the
user doesn't not have the write permission. For example:
# kdumpctl restart
kexec: unloaded kdump kernel
Stopping kdump: [OK]
Could not create temporary directory on :/home/bhsharma/test. Make
sure user has write permission on destination
mkdumprd: failed to make kdump initrd
Starting kdump: [FAILED]
This patch using $1 value passed to mkdumprd, to print the
$DUMP_TARGET inside mkdir_save_path_ssh() function to
fix the issue.
Signed-off-by: Bhupesh Sharma <bhsharma(a)redhat.com>
---
mkdumprd | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/mkdumprd b/mkdumprd
index 6c33fc565579..9599b338e858 100644
--- a/mkdumprd
+++ b/mkdumprd
@@ -130,7 +130,7 @@ get_ssh_size() {
#mkdir if save path does not exist on ssh dump target
#$1=ssh dump target
-#caller should ensure write permission on $DUMP_TARGET:$SAVE_PATH
+#caller should ensure write permission on $1:$SAVE_PATH
#called from while loop and shouldn't read from stdin, so we're using "ssh -n"
mkdir_save_path_ssh()
{
@@ -139,14 +139,14 @@ mkdir_save_path_ssh()
ssh -qn $_opt $1 mkdir -p $SAVE_PATH 2>&1 > /dev/null
_ret=$?
if [ $_ret -ne 0 ]; then
- perror_exit "mkdir failed on $DUMP_TARGET:$SAVE_PATH"
+ perror_exit "mkdir failed on $1:$SAVE_PATH"
fi
- #check whether user has write permission on $SAVE_PATH/$DUMP_TARGET
+ #check whether user has write permission on $SAVE_PATH/$1
_dir=$(ssh -qn $_opt $1 mktemp -dqp $SAVE_PATH 2>/dev/null)
_ret=$?
if [ $_ret -ne 0 ]; then
- perror_exit "Could not create temporary directory on $DUMP_TARGET:$SAVE_PATH. Make sure user has write permission on destination"
+ perror_exit "Could not create temporary directory on $1:$SAVE_PATH. Make sure user has write permission on destination"
fi
ssh -qn $_opt $1 rmdir $_dir
--
2.7.4
4 years, 1 month
[PATCH] kdumpctl: Export DUMP_TARGET
by Bhupesh Sharma
When building kdump initramfs for a SSH dump target, mkdumprd would
check whether it has the write permission on the SSH Server's
$DUMP_TARGET.
However $DUMP_TARGET is missing in the actual error message when the
user doesn't not have the write permission. For example:
# kdumpctl restart
kexec: unloaded kdump kernel
Stopping kdump: [OK]
Could not create temporary directory on :/home/bhsharma/test. Make
sure user has write permission on destination
mkdumprd: failed to make kdump initrd
Starting kdump: [FAILED]
This patch exports $DUMP_TARGET from kdumpctl to make sure that
mkdumprd can use the same inside mkdir_save_path_ssh() function to
fix the issue. Note that without this patch, $DUMP_TARGET is
uninitialized in mkdumprd.
Signed-off-by: Bhupesh Sharma <bhsharma(a)redhat.com>
---
kdumpctl | 1 +
1 file changed, 1 insertion(+)
diff --git a/kdumpctl b/kdumpctl
index 88128a3e73d6..0d5760891069 100755
--- a/kdumpctl
+++ b/kdumpctl
@@ -720,6 +720,7 @@ check_ssh_config()
;;
ssh)
DUMP_TARGET=$config_val
+ export DUMP_TARGET
;;
*)
;;
--
2.7.4
4 years, 1 month
[PATCH] fadump: introduce kdump-boot.sh as cmdline hook to rename kdump-ethx name
by Pingfan Liu
Currently, while building the initrd with dump capture support, if a
network-based dump target is specified, network is configured in the initial
ramdisk which includes an interface name change if necessary.
When fadump is configured, the initrd used for booting production kernel is
rebuilt with dump capturing support. This initrd applies the network
configuration changes, intended for capturing a dump, while booting the
production kernel as well, potentially changing the network interface name in
production kernel. Avoid enforcing kdump specific network parameters while boot
production kernel to tackle that problem.
In fadump initrd, using a cmdline hook to strip "kdump-" from *.conf, so
production kernel can not be affected.
Signed-off-by: Pingfan Liu <piliu(a)redhat.com>
---
dracut-kdump-boot.sh | 27 +++++++++++++++++++++++++++
dracut-module-setup.sh | 4 ++++
kexec-tools.spec | 3 +++
3 files changed, 34 insertions(+)
create mode 100644 dracut-kdump-boot.sh
diff --git a/dracut-kdump-boot.sh b/dracut-kdump-boot.sh
new file mode 100644
index 0000000..6210084
--- /dev/null
+++ b/dracut-kdump-boot.sh
@@ -0,0 +1,27 @@
+#!/bin/sh
+
+ip_conf="/etc/cmdline.d/40ip.conf"
+bridge_conf="/etc/cmdline.d/41bridge.conf"
+bond_conf="/etc/cmdline.d/42bond.conf"
+team_conf="/etc/cmdline.d/44team.conf"
+vlan_conf="/etc/cmdline.d/43vlan.conf"
+files="$ip_conf $bridge_conf $bond_conf $team_conf $vlan_conf"
+
+rename_eth()
+{
+ for f in $files
+ do
+ if [ -f "$f" ]; then
+ sed -i 's/kdump-//' $f
+ fi
+ done
+}
+
+# An Initrd with dump capturing support can boot a production kernel
+# as well (FADump). In such scenario, avoid enforcing such parameters
+# in production kernel that make sense only while capturing dump.
+[ ! -f /etc/fadump.initramfs ] && return
+
+if [ ! -f /proc/device-tree/rtas/ibm,kernel-dump ]; then
+ rename_eth
+fi
diff --git a/dracut-module-setup.sh b/dracut-module-setup.sh
index 8691f9c..1237896 100755
--- a/dracut-module-setup.sh
+++ b/dracut-module-setup.sh
@@ -835,6 +835,10 @@ install() {
cp "$moddir/kdump-emergency.target" "$initdir/$systemdsystemunitdir/emergency.target"
# Also redirect dracut-emergency to kdump error handler
ln_r "$systemdsystemunitdir/emergency.service" "$systemdsystemunitdir/dracut-emergency.service"
+ if is_fadump_capable; then
+ inst_hook cmdline 50 "$moddir/kdump-boot.sh"
+ fi
+
# Check for all the devices and if any device is iscsi, bring up iscsi
# target. Ideally all this should be pushed into dracut iscsi module
diff --git a/kexec-tools.spec b/kexec-tools.spec
index d80b108..7559186 100644
--- a/kexec-tools.spec
+++ b/kexec-tools.spec
@@ -51,6 +51,7 @@ Source107: dracut-kdump-emergency.target
Source108: dracut-early-kdump.sh
Source109: dracut-early-kdump-module-setup.sh
Source110: dracut-kdump-wait-for-target.sh
+Source111: dracut-kdump-boot.sh
Requires(post): systemd-units
Requires(preun): systemd-units
@@ -222,8 +223,10 @@ cp %{SOURCE105} $RPM_BUILD_ROOT/etc/kdump-adv-conf/kdump_dracut_modules/99kdumpb
cp %{SOURCE106} $RPM_BUILD_ROOT/etc/kdump-adv-conf/kdump_dracut_modules/99kdumpbase/%{remove_dracut_prefix %{SOURCE106}}
cp %{SOURCE107} $RPM_BUILD_ROOT/etc/kdump-adv-conf/kdump_dracut_modules/99kdumpbase/%{remove_dracut_prefix %{SOURCE107}}
cp %{SOURCE110} $RPM_BUILD_ROOT/etc/kdump-adv-conf/kdump_dracut_modules/99kdumpbase/%{remove_dracut_prefix %{SOURCE110}}
+cp %{SOURCE111} $RPM_BUILD_ROOT/etc/kdump-adv-conf/kdump_dracut_modules/99kdumpbase/%{remove_dracut_prefix %{SOURCE111}}
chmod 755 $RPM_BUILD_ROOT/etc/kdump-adv-conf/kdump_dracut_modules/99kdumpbase/%{remove_dracut_prefix %{SOURCE100}}
chmod 755 $RPM_BUILD_ROOT/etc/kdump-adv-conf/kdump_dracut_modules/99kdumpbase/%{remove_dracut_prefix %{SOURCE101}}
+chmod 755 $RPM_BUILD_ROOT/etc/kdump-adv-conf/kdump_dracut_modules/99kdumpbase/%{remove_dracut_prefix %{SOURCE111}}
mkdir -p -m755 $RPM_BUILD_ROOT/etc/kdump-adv-conf/kdump_dracut_modules/99earlykdump
cp %{SOURCE108} $RPM_BUILD_ROOT/etc/kdump-adv-conf/kdump_dracut_modules/99earlykdump/%{remove_dracut_prefix %{SOURCE108}}
cp %{SOURCE109} $RPM_BUILD_ROOT/etc/kdump-adv-conf/kdump_dracut_modules/99earlykdump/%{remove_dracut_early_kdump_prefix %{SOURCE109}}
--
2.7.5
4 years, 1 month
Re: [PATCH] kdump-lib.sh: Fix is_user_configured_dump_target()
by Kairui Song
Thanks for the patch, looks good to me.
On Tue, Feb 25, 2020 at 1:13 AM HAGIO KAZUHITO(萩尾 一仁)
<k-hagio-ab(a)nec.com> wrote:
>
> Currently, is_user_configured_dump_target() doesn't work as expected
> due to lack of grep -E option.
>
> As a result, kdump service with a ssh dump configuration can unnecessarily
> fail to start due to the non-existence of a directory at where the path
> option specifies on the local system:
>
> kdumpctl[9760]: Rebuilding /boot/initramfs-5.4.19-200.fc31.x86_64kdump.img
> kdumpctl[9760]: Dump path /var/crash/ssh does not exist.
> kdumpctl[9760]: mkdumprd: failed to make kdump initrd
> kdumpctl[9760]: Starting kdump: [FAILED]
>
> Signed-off-by: Kazuhito Hagio <k-hagio-ab(a)nec.com>
> ---
> kdump-lib.sh | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/kdump-lib.sh b/kdump-lib.sh
> index 2428b5d..9c41439 100755
> --- a/kdump-lib.sh
> +++ b/kdump-lib.sh
> @@ -117,7 +117,7 @@ to_dev_name() {
>
> is_user_configured_dump_target()
> {
> - grep -q "^ext[234]|^xfs|^btrfs|^minix|^raw|^nfs|^ssh" /etc/kdump.conf || is_mount_in_dracut_args;
> + grep -E -q "^ext[234]|^xfs|^btrfs|^minix|^raw|^nfs|^ssh" /etc/kdump.conf || is_mount_in_dracut_args;
> }
>
> get_user_configured_dump_disk()
> --
> 2.24.1
> _______________________________________________
> kexec mailing list -- kexec(a)lists.fedoraproject.org
> To unsubscribe send an email to kexec-leave(a)lists.fedoraproject.org
> Fedora Code of Conduct: https://docs.fedoraproject.org/en-US/project/code-of-conduct/
> List Guidelines: https://fedoraproject.org/wiki/Mailing_list_guidelines
> List Archives: https://lists.fedoraproject.org/archives/list/kexec@lists.fedoraproject.org
--
Best Regards,
Kairui Song
4 years, 1 month
[PATCH 0/2] Check whether makedumpfile command-line is valid or not
by Kazuhito Hagio
Currently it's difficult to check whether a makedumpfile command-line
is valid or not without a dump test. This is inefficient and if a
wrong configuration is not tested, you will miss the vmcore when a
panic occurs.
In order to check it when generating initramfs, use makedumpfile
--check-params option, which was recently added.
With this patchset, kdumpctl can point out mistakes in core_collector
option and fail. For example, if there is a practical mistake that
dump_level is -1:
# cat /etc/kdump.conf
core_collector makedumpfile -l --message-level 1 -d -1
# kdumpctl start
Detected change(s) in the following file(s):
/etc/kdump.conf
Rebuilding /boot/initramfs-5.4.19-200.fc31.x86_64kdump.img
Dump_level(-1) is invalid.
makedumpfile parameter check failed.
mkdumprd: failed to make kdump initrd
Starting kdump: [FAILED]
Kazuhito Hagio (2):
makedumpfile: Introduce --check-params option
mkdumprd: Use makedumpfile --check-params option
...mpfile-Introduce-check-params-option.patch | 255 ++++++++++++++++++
kexec-tools.spec | 2 +
mkdumprd | 24 +-
3 files changed, 275 insertions(+), 6 deletions(-)
create mode 100644 kexec-tools-2.0.20-makedumpfile-Introduce-check-params-option.patch
--
2.24.1
4 years, 1 month