[PATCH] mkdumprd: allow spaces after 'path' config phrase when network dump
by Kazuhito Hagio
Without this patch, when there are two or more spaces after 'path'
configuration phrase with ssh or nfs setting, SAVE_PATH is set to
'/var/crash' in mkdumprd, and in most cases kdump service fails to
start.
ssh kdump(a)192.168.122.1
path /kdump
^^
This behavior would be too sensitive and different from the other
configurations. With this patch, mkdumprd allows such spaces.
Signed-off-by: Kazuhito Hagio <k-hagio(a)ab.jp.nec.com>
---
mkdumprd | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/mkdumprd b/mkdumprd
index a6f7fe8..aa0abfd 100644
--- a/mkdumprd
+++ b/mkdumprd
@@ -13,7 +13,7 @@ export IN_KDUMP=1
conf_file="/etc/kdump.conf"
SSH_KEY_LOCATION="/root/.ssh/kdump_id_rsa"
-SAVE_PATH=$(grep ^path $conf_file| cut -d' ' -f2)
+SAVE_PATH=$(awk '/^path/ {print $2}' $conf_file)
[ -z "$SAVE_PATH" ] && SAVE_PATH=$DEFAULT_PATH
# strip the duplicated "/"
SAVE_PATH=$(echo $SAVE_PATH | tr -s /)
--
2.18.0
1 year, 6 months
[PATCH v2] Introduce get_kdump_mntpoint_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 b079f27..2157c34 100755
--- a/kdump-lib.sh
+++ b/kdump-lib.sh
@@ -258,6 +258,25 @@ get_mntpoint_from_target()
findmnt -k -f -n -r -o TARGET --source $1
}
+# Get the path where the target will be mounted in kdump kernel
+# $1: kdump target device
+get_kdump_mntpoint_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 fb264c3..081720e 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_mntpoint_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 35f5eed..f3e9336 100644
--- a/mkdumprd
+++ b/mkdumprd
@@ -51,21 +51,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_mntpoint_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)
@@ -85,14 +76,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.25.3
3 years, 6 months
[PATCH] Fix the problem that kdump prints redundant /
by Kairui Song
In second kernel, kdump always prints redundant '/':
kdump: saving to /sysroot//var/crash/127.0.0.1-2020-03-12-21:32:54/
Just trim it.
Signed-off-by: Kairui Song <kasong(a)redhat.com>
---
kdump-lib-initramfs.sh | 14 ++++++++------
1 file changed, 8 insertions(+), 6 deletions(-)
diff --git a/kdump-lib-initramfs.sh b/kdump-lib-initramfs.sh
index 7b314a7..49b12dc 100755
--- a/kdump-lib-initramfs.sh
+++ b/kdump-lib-initramfs.sh
@@ -125,7 +125,9 @@ dump_fs()
# Remove -F in makedumpfile case. We don't want a flat format dump here.
[[ $CORE_COLLECTOR = *makedumpfile* ]] && CORE_COLLECTOR=`echo $CORE_COLLECTOR | sed -e "s/-F//g"`
- echo "kdump: saving to $_mp/$KDUMP_PATH/$HOST_IP-$DATEDIR/"
+ local _dump_path=$(echo "$_mp/$KDUMP_PATH/$HOST_IP-$DATEDIR/" | tr -s /)
+
+ echo "kdump: saving to $_dump_path"
# Only remount to read-write mode if the dump target is mounted read-only.
if [[ "$_op" = "ro"* ]]; then
@@ -133,14 +135,14 @@ dump_fs()
mount -o remount,rw $_dev $_mp || return 1
fi
- mkdir -p $_mp/$KDUMP_PATH/$HOST_IP-$DATEDIR || return 1
+ mkdir -p $_dump_path || return 1
- save_vmcore_dmesg_fs ${DMESG_COLLECTOR} "$_mp/$KDUMP_PATH/$HOST_IP-$DATEDIR/"
- save_opalcore_fs "$_mp/$KDUMP_PATH/$HOST_IP-$DATEDIR/"
+ save_vmcore_dmesg_fs ${DMESG_COLLECTOR} "$_dump_path"
+ save_opalcore_fs "$_dump_path"
echo "kdump: saving vmcore"
- $CORE_COLLECTOR /proc/vmcore $_mp/$KDUMP_PATH/$HOST_IP-$DATEDIR/vmcore-incomplete || return 1
- mv $_mp/$KDUMP_PATH/$HOST_IP-$DATEDIR/vmcore-incomplete $_mp/$KDUMP_PATH/$HOST_IP-$DATEDIR/vmcore
+ $CORE_COLLECTOR /proc/vmcore $_dump_path/vmcore-incomplete || return 1
+ mv $_dump_path/vmcore-incomplete $_dump_path/vmcore
sync
echo "kdump: saving vmcore complete"
--
2.25.3
3 years, 7 months
[PATCH v2] Partially Revert "Don't mount the dump target unless needed"
by Kairui Song
This partially reverts commit 6dee286467e5a697d25148712a110da1a720ac96.
There are reports that NFSv3 is failing after this commit, and after
more debug, I found NFSv4 may not work properly if
"nfs4_disable_idmapping" is set to 0.
The cause of the failure is that kdump.sh runs after dracut's pre-pivot
and clean up hook, many dracut module will install hooks to kill some
running services, so if the dump target requires a service to be running
but it's killed, mount will fail.
Dracut ensures the configured mount points are ready before pre-pivot.
After pre-pivot, any further mounting operation may not work as expected.
Although there is no report of other type of dump target failure except
NFSv3, it's better to revert this, to avoid other potential risk, and wait
for a proper fix for that systemd/kernel issue.
Else, this may bring more trouble for further development.
But still keep the change in kdump-lib-initramfs.sh for better
robustness.
Signed-off-by: Kairui Song <kasong(a)redhat.com>
---
mkdumprd | 5 ++---
1 file changed, 2 insertions(+), 3 deletions(-)
diff --git a/mkdumprd b/mkdumprd
index 35f5eed..cedf536 100644
--- a/mkdumprd
+++ b/mkdumprd
@@ -77,13 +77,12 @@ to_mount() {
fi
# mount fs target as rw in 2nd kernel
_options=$(echo $_options | sed 's/\(^\|,\)ro\($\|,\)/\1rw\2/g')
- # filter out 'noauto' here, it will be force appended later, avoid duplication
+ # with 'noauto' in fstab nfs and non-root disk mount will fail in 2nd
+ # kernel, filter it out here.
_options=$(echo $_options | sed 's/\(^\|,\)noauto\($\|,\)/\1/g')
# drop nofail or nobootwait
_options=$(echo $_options | sed 's/\(^\|,\)nofail\($\|,\)/\1/g')
_options=$(echo $_options | sed 's/\(^\|,\)nobootwait\($\|,\)/\1/g')
- # only mount the dump target when needed.
- _options="$_options,noauto"
_mntopts="$_target $_fstype $_options"
#for non-nfs _dev converting to use udev persistent name
--
2.25.3
3 years, 7 months
[PATCH] Revert "Don't mount the dump target unless needed"
by Kairui Song
This reverts commit 6dee286467e5a697d25148712a110da1a720ac96.
There are reports that NFSv3 is failing after this commit, and after
more debug, I found NFSv4 may not work properly if
"nfs4_disable_idmapping" is set to 0.
Besides, kdump.sh runs after dracut's pre-pivot and clean up hook, many
dracut module will install hooks to kill some running services, so
kdump.sh may have the risk of failing to setup certain kinds of dump
targets that requires the service to be running.
Dracut ensures the configured mount points are ready before pre-pivot,
and after pre-pivot, any further mounting operation may not work as
expected.
Although there is no report of other type of dump target failure except
NFSv3, we better revert this, to avoid other potential risk, and wait
for a proper fix for that systemd/kernel issue.
Else, this may bring more trouble for further development.
---
kdump-lib-initramfs.sh | 30 +++++-------------------------
mkdumprd | 5 ++---
2 files changed, 7 insertions(+), 28 deletions(-)
diff --git a/kdump-lib-initramfs.sh b/kdump-lib-initramfs.sh
index a7c0bf9..2b5da16 100755
--- a/kdump-lib-initramfs.sh
+++ b/kdump-lib-initramfs.sh
@@ -97,31 +97,16 @@ get_kdump_confs()
# dump_fs <mount point| device>
dump_fs()
{
- local _do_umount=""
+
local _dev=$(findmnt -k -f -n -r -o SOURCE $1)
local _mp=$(findmnt -k -f -n -r -o TARGET $1)
local _op=$(findmnt -k -f -n -r -o OPTIONS $1)
+ echo "kdump: dump target is $_dev"
+
if [ -z "$_mp" ]; then
- _dev=$(findmnt -s -f -n -r -o SOURCE $1)
- _mp=$(findmnt -s -f -n -r -o TARGET $1)
- _op=$(findmnt -s -f -n -r -o OPTIONS $1)
-
- if [ -n "$_dev" ] && [ -n "$_mp" ]; then
- echo "kdump: dump target $_dev is not mounted, trying to mount..."
- mkdir -p $_mp
- mount -o $_op $_dev $_mp
-
- if [ $? -ne 0 ]; then
- echo "kdump: mounting failed (mount point: $_mp, option: $_op)"
- return 1
- fi
- _do_umount=1
- else
- echo "kdump: error: Dump target $_dev is not usable"
- fi
- else
- echo "kdump: dump target is $_dev"
+ echo "kdump: error: Dump target $_dev is not mounted."
+ return 1
fi
# Remove -F in makedumpfile case. We don't want a flat format dump here.
@@ -146,11 +131,6 @@ dump_fs()
sync
echo "kdump: saving vmcore complete"
-
- if [ $_do_umount ]; then
- umount $_mp || echo "kdump: warn: failed to umount target"
- fi
-
# improper kernel cmdline can cause the failure of echo, we can ignore this kind of failure
return 0
}
diff --git a/mkdumprd b/mkdumprd
index 35f5eed..cedf536 100644
--- a/mkdumprd
+++ b/mkdumprd
@@ -77,13 +77,12 @@ to_mount() {
fi
# mount fs target as rw in 2nd kernel
_options=$(echo $_options | sed 's/\(^\|,\)ro\($\|,\)/\1rw\2/g')
- # filter out 'noauto' here, it will be force appended later, avoid duplication
+ # with 'noauto' in fstab nfs and non-root disk mount will fail in 2nd
+ # kernel, filter it out here.
_options=$(echo $_options | sed 's/\(^\|,\)noauto\($\|,\)/\1/g')
# drop nofail or nobootwait
_options=$(echo $_options | sed 's/\(^\|,\)nofail\($\|,\)/\1/g')
_options=$(echo $_options | sed 's/\(^\|,\)nobootwait\($\|,\)/\1/g')
- # only mount the dump target when needed.
- _options="$_options,noauto"
_mntopts="$_target $_fstype $_options"
#for non-nfs _dev converting to use udev persistent name
--
2.25.3
3 years, 7 months
Fwd: Kdump on fedora server 31 settings and service manager ask
by Dorian ROSSE
Envoyé d’Outlook Mobile<https://aka.ms/blhgte>
________________________________
De : Dorian ROSSE <dorianbrice(a)hotmail.fr>
Envoyé : lundi 27 avril 2020 à 12:27
À : kexec(a)lists.fedoraprojects.org
Objet : Kdump on fedora server 31 settings and service manager ask
Hello,
How to install kdump because coredump doesn't work and a 'locate coredump' went to the kernel,
I can't send an e-mail to coredump mailing list,
Thank you in advance to explain how to install and configure kdump for run and enable the service,
Regards.
azaretdodo.
Envoyé d’Outlook Mobile<https://aka.ms/blhgte>
3 years, 7 months
[PATCH] Change the dracut-network dependency to weak dependency
by Lianbo Jiang
When installing the kexec-tools package, it usually pulls it's whole
dependency chain, which is almost used in every kdump environment, but
actually, it is not needed on machines with 'install_weak_deps=0'.
To fix it, let's change the dependency from strong dependency(Requires)
to weak dependency(Recommends), which allows users to decide whether
they need to install the dracut-network package.
Signed-off-by: Lianbo Jiang <lijiang(a)redhat.com>
---
kexec-tools.spec | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/kexec-tools.spec b/kexec-tools.spec
index 6bada4ab66cc..c63ad30d6b3b 100644
--- a/kexec-tools.spec
+++ b/kexec-tools.spec
@@ -57,9 +57,9 @@ Requires(preun): systemd-units
Requires(postun): systemd-units
Requires(pre): coreutils sed zlib
Requires: dracut >= 047-34.git20180604
-Requires: dracut-network >= 044-117
Requires: dracut-squash >= 049-4
Requires: ethtool
+Recommends: dracut-network >= 044-117
BuildRequires: zlib-devel zlib zlib-static elfutils-devel-static glib2-devel bzip2-devel ncurses-devel bison flex lzo-devel snappy-devel
BuildRequires: pkgconfig intltool gettext
BuildRequires: systemd-units
--
2.17.1
3 years, 7 months
Re: [PATCH] Don't unmount the dump target just after saving vmcore
by Kairui Song
Thank you very much for the patch!
On Tue, Apr 21, 2020 at 3:03 AM HAGIO KAZUHITO(萩尾 一仁)
<k-hagio-ab(a)nec.com> wrote:
>
> From: Kazuhito Hagio <k-hagio-ab(a)nec.com>
>
> Since commit 6dee286467e5 ("Don't mount the dump target unless needed"),
> dump_fs function unmounts the dump target just after saving vmcore.
>
> This broke the condition that it's mounted when executing "kdump_post",
> which had been stable since RHEL5, and a certain tool which uses the
> kdump_post hook to save information of 2nd kernel to the dump target
> started to fail.
>
> As unmounting it is done by systemd-shutdown before reboot without
> the umount command as below, so let's don't unmount it in dump_fs.
>
> systemd-shutdown[1]: Unmounting file systems.
> [547]: Remounting '/sysroot' read-only in with options '(null)'.
> EXT4-fs (dm-0): re-mounted. Opts: (null)
> [548]: Unmounting '/sysroot'.
>
> Signed-off-by: Kazuhito Hagio <k-hagio-ab(a)nec.com>
> ---
> kdump-lib-initramfs.sh | 6 ------
> 1 file changed, 6 deletions(-)
>
> diff --git a/kdump-lib-initramfs.sh b/kdump-lib-initramfs.sh
> index a7c0bf9..7b314a7 100755
> --- a/kdump-lib-initramfs.sh
> +++ b/kdump-lib-initramfs.sh
> @@ -97,7 +97,6 @@ get_kdump_confs()
> # dump_fs <mount point| device>
> dump_fs()
> {
> - local _do_umount=""
> local _dev=$(findmnt -k -f -n -r -o SOURCE $1)
> local _mp=$(findmnt -k -f -n -r -o TARGET $1)
> local _op=$(findmnt -k -f -n -r -o OPTIONS $1)
> @@ -116,7 +115,6 @@ dump_fs()
> echo "kdump: mounting failed (mount point: $_mp, option: $_op)"
> return 1
> fi
> - _do_umount=1
> else
> echo "kdump: error: Dump target $_dev is not usable"
> fi
> @@ -147,10 +145,6 @@ dump_fs()
>
> echo "kdump: saving vmcore complete"
>
> - if [ $_do_umount ]; then
> - umount $_mp || echo "kdump: warn: failed to umount target"
> - fi
> -
> # improper kernel cmdline can cause the failure of echo, we can ignore this kind of failure
> return 0
> }
> --
Looks good to me, Acked.
--
Best Regards,
Kairui Song
3 years, 7 months
[PATCH] Don't unmount the dump target just after saving vmcore
by HAGIO KAZUHITO(萩尾 一仁)
From: Kazuhito Hagio <k-hagio-ab(a)nec.com>
Since commit 6dee286467e5 ("Don't mount the dump target unless needed"),
dump_fs function unmounts the dump target just after saving vmcore.
This broke the condition that it's mounted when executing "kdump_post",
which had been stable since RHEL5, and a certain tool which uses the
kdump_post hook to save information of 2nd kernel to the dump target
started to fail.
As unmounting it is done by systemd-shutdown before reboot without
the umount command as below, so let's don't unmount it in dump_fs.
systemd-shutdown[1]: Unmounting file systems.
[547]: Remounting '/sysroot' read-only in with options '(null)'.
EXT4-fs (dm-0): re-mounted. Opts: (null)
[548]: Unmounting '/sysroot'.
Signed-off-by: Kazuhito Hagio <k-hagio-ab(a)nec.com>
---
kdump-lib-initramfs.sh | 6 ------
1 file changed, 6 deletions(-)
diff --git a/kdump-lib-initramfs.sh b/kdump-lib-initramfs.sh
index a7c0bf9..7b314a7 100755
--- a/kdump-lib-initramfs.sh
+++ b/kdump-lib-initramfs.sh
@@ -97,7 +97,6 @@ get_kdump_confs()
# dump_fs <mount point| device>
dump_fs()
{
- local _do_umount=""
local _dev=$(findmnt -k -f -n -r -o SOURCE $1)
local _mp=$(findmnt -k -f -n -r -o TARGET $1)
local _op=$(findmnt -k -f -n -r -o OPTIONS $1)
@@ -116,7 +115,6 @@ dump_fs()
echo "kdump: mounting failed (mount point: $_mp, option: $_op)"
return 1
fi
- _do_umount=1
else
echo "kdump: error: Dump target $_dev is not usable"
fi
@@ -147,10 +145,6 @@ dump_fs()
echo "kdump: saving vmcore complete"
- if [ $_do_umount ]; then
- umount $_mp || echo "kdump: warn: failed to umount target"
- fi
-
# improper kernel cmdline can cause the failure of echo, we can ignore this kind of failure
return 0
}
--
2.24.1
3 years, 7 months
[PATCH] dracut-module-setup.sh: fix breakage in get_pcs_fence_kdump_nodes()
by Pingfan Liu
pcs cluster and cluster cib-upgrade may throw some information and disturb
the parsing. Mute them
Signed-off-by: Pingfan Liu <piliu(a)redhat.com>
---
dracut-module-setup.sh | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/dracut-module-setup.sh b/dracut-module-setup.sh
index 685b858..024e333 100755
--- a/dracut-module-setup.sh
+++ b/dracut-module-setup.sh
@@ -678,7 +678,7 @@ is_localhost() {
get_pcs_fence_kdump_nodes() {
local nodes
- pcs cluster sync && pcs cluster cib-upgrade
+ pcs cluster sync > /dev/null 2>&1 && pcs cluster cib-upgrade > /dev/null 2>&1
# get cluster nodes from cluster cib, get interface and ip address
nodelist=`pcs cluster cib | xmllint --xpath "/cib/status/node_state/@uname" -`
--
2.7.5
3 years, 7 months