[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, 4 months
[RESEND PATCH v4 0/2] Disable device dump by default and update doc
by Kairui Song
Update from V3:
Rebase and resend patch as previousely the kernel parameter is not ready
in Fedora, no change
Update from V2:
Adjust the doc.
Update from V1:
Split into two patches and update docs as well.
Kairui Song (2):
Disable device dump by default
kexec-kdump-howto.txt: Add notes about device dump
kdump.sysconfig | 2 +-
kdump.sysconfig.aarch64 | 2 +-
kdump.sysconfig.i386 | 2 +-
kdump.sysconfig.ppc64 | 2 +-
kdump.sysconfig.ppc64le | 2 +-
kdump.sysconfig.s390x | 2 +-
kdump.sysconfig.x86_64 | 2 +-
kexec-kdump-howto.txt | 17 +++++++++++++++++
8 files changed, 24 insertions(+), 7 deletions(-)
--
2.21.0
4 years
[PATCH v2] dracut-module-setup: fix bond ifcfg processing
by Kairui Song
Bond options in ifcfg is space separated, dracut expected it to be comma
separated, so it have to be parsed and converted during initramfs
building.
The currently parsing and convert pattern is flawed, for example:
" downdelay=0 miimon=100 mode=802.3ad updelay=0 "
is converted to :
":,downdelay=0 miimon=100 mode=802.3ad updelay=0 "
should be:
":downdelay=0,miimon=100,mode=802.3ad,updelay=0"
So fix this issue by using more simple but robust method for processing
the options.
Signed-off-by: Kairui Song <kasong(a)redhat.com>
---
Update from V1:
- Add a xargs call to deduplicate the spaces. Although bash should
convert the unquated string into a list of parameters and deduplicate
the spaces automatically, but if someone add quotes it will break and
it's confusing.
---
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 3fa696d..b395160 100755
--- a/dracut-module-setup.sh
+++ b/dracut-module-setup.sh
@@ -264,7 +264,7 @@ kdump_setup_bond() {
source_ifcfg_file $_netdev
- bondoptions="$(echo :$BONDING_OPTS | sed 's/\s\+/,/')"
+ bondoptions=":$(echo $BONDING_OPTS | xargs echo | tr " " ",")"
echo "$bondoptions" >> ${initdir}/etc/cmdline.d/42bond.conf
}
--
2.21.0
4 years
[PATCH] kdumpctl: distinguish the failed reason of ssh
by Pingfan Liu
On a host with ipaddr not ready before kdump service, ssh return errno 255.
While if no ssh-key, ssh also return errno 255. For both of cases, the
current kdump code promote user to run 'kdumpctl propagate'. This confuses
user who already installs ssh-key.
In order to tell these two cases from each other, the ssh warning message
should be involved, and parsed.
For the no ssh-key case , warning message is "Permission denied" or "No
such file or directory". For the other, warning message is "Network
Unreachable"
This patch also does a slight change to enlarge the timeout from 60s to
180s. This value can meet test at the time being
Signed-off-by: Pingfan Liu <piliu(a)redhat.com>
---
kdumpctl | 25 +++++++++++++++++++------
1 file changed, 19 insertions(+), 6 deletions(-)
diff --git a/kdumpctl b/kdumpctl
index 2f2d819..f75b820 100755
--- a/kdumpctl
+++ b/kdumpctl
@@ -738,24 +738,38 @@ check_and_wait_network_ready()
local start_time=$(date +%s)
local cur
local diff
+ local retval
+ local errmsg
while true; do
- ssh -q -i $SSH_KEY_LOCATION -o BatchMode=yes $DUMP_TARGET mkdir -p $SAVE_PATH
+ errmsg=$(ssh -i $SSH_KEY_LOCATION -o BatchMode=yes $DUMP_TARGET mkdir -p $SAVE_PATH 2>&1)
+ retval=$?
+
# ssh exits with the exit status of the remote command or with 255 if an error occurred
- if [ $? -eq 0 ]; then
+ if [ $retval -eq 0 ]; then
return 0
- elif [ $? -ne 255 ]; then
+ elif [ $retval -ne 255 ]; then
+ echo "Could not create $DUMP_TARGET:$SAVE_PATH, you should check the privilege on server side" >&2
return 1
fi
+
+ # if server removes the authorized_keys or, no /root/.ssh/kdump_id_rsa
+ echo $errmsg | grep -q "Permission denied\|No such file or directory"
+ if [ $? -eq 0 ]; then
+ echo "Could not create $DUMP_TARGET:$SAVE_PATH, you probably need to run \"kdumpctl propagate\"" >&2
+ return 1
+ fi
+
cur=$(date +%s)
- diff=$( $cur - $start_time )
+ let "diff = $cur - $start_time"
# 60s time out
- if [ $diff -gt 60 ]; then
+ if [ $diff -gt 180 ]; then
break;
fi
sleep 1
done
+ echo "Could not create $DUMP_TARGET:$SAVE_PATH, ipaddr is not ready yet. You should check network connection" >&2
return 1
}
@@ -763,7 +777,6 @@ check_ssh_target()
{
check_and_wait_network_ready
if [ $? -ne 0 ]; then
- echo "Could not create $DUMP_TARGET:$SAVE_PATH, you probably need to run \"kdumpctl propagate\"" >&2
return 1
fi
return 0
--
2.20.1
4 years
[PATCHv2 0/2] dracut-module-setup: handling host alias
by Pingfan Liu
commit 88bbab963f11a71aae2f7cff224ce0f5038111a8
dracut-module-setup.sh: skip alias of localhost in get_pcs_fence_kdump_nodes()
is not enough to handle host alias
-1. "host -A" does not provide alias name.
-2. 'generic fence kdump' can also be protected by the same logic
Pingfan Liu (2):
dracut-module-setup: get localhost alias by manual
dracut-module-setup: filter out localhost for generic_fence_kdump
dracut-module-setup.sh | 41 +++++++++++++++++++++++++++++++++++++++--
1 file changed, 39 insertions(+), 2 deletions(-)
--
2.7.5
4 years, 1 month
[PATCH 0/2] dracut-module-setup: handling host alias
by Pingfan Liu
commit 88bbab963f11a71aae2f7cff224ce0f5038111a8
dracut-module-setup.sh: skip alias of localhost in get_pcs_fence_kdump_nodes()
is not enough to handle host alias
-1. "host -A" does not provide alias name.
-2. 'generic fence kdump' can also be protected by the same logic
Pingfan Liu (2):
dracut-module-setup: get localhost alias by manual
dracut-module-setup: filter out localhost for generic_fence_kdump
dracut-module-setup.sh | 41 +++++++++++++++++++++++++++++++++++++++--
1 file changed, 39 insertions(+), 2 deletions(-)
--
2.7.5
4 years, 1 month
[PATCH] dracut-module-setup: fix bond ifcfg processing
by Kairui Song
Bond options in ifcfg is space separated, dracut expected it to be comma
separated, so it have to be parsed and converted during initramfs
building.
The currently parsing and convert pattern is flawed, for example:
" downdelay=0 miimon=100 mode=802.3ad updelay=0 "
is converted to :
":,downdelay=0 miimon=100 mode=802.3ad updelay=0 "
should be:
":downdelay=0,miimon=100,mode=802.3ad,updelay=0"
So fix this issue by using more simple but robust method for processing
the options.
Signed-off-by: Kairui Song <kasong(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 3fa696d..abf56c7 100755
--- a/dracut-module-setup.sh
+++ b/dracut-module-setup.sh
@@ -264,7 +264,7 @@ kdump_setup_bond() {
source_ifcfg_file $_netdev
- bondoptions="$(echo :$BONDING_OPTS | sed 's/\s\+/,/')"
+ bondoptions=":$(echo $BONDING_OPTS | tr " " ",")"
echo "$bondoptions" >> ${initdir}/etc/cmdline.d/42bond.conf
}
--
2.21.0
4 years, 1 month
[PATCH 0/2 v3] Limit the size of vmcore-dmesg.txt to 2G
by Lianbo Jiang
[PATCH 1/2] cleanup: move it back from util_lib/elf_info.c
Some vmcore-dmesg code is put into the util_lib, so lets move
it ack and tidy up those code.
[PATCH 2/2] Limit the size of vmcore-dmesg.txt to 2G
With some corrupted vmcore files, the vmcore-dmesg.txt file may
grow forever till the kdump disk becomes full. Lets limit the
size of vmcore-dmesg.txt to avoid such problems.
Lianbo Jiang (2):
cleanup: move it back from util_lib/elf_info.c
Limit the size of vmcore-dmesg.txt to 2G
kexec/arch/arm64/kexec-arm64.c | 2 +-
util_lib/elf_info.c | 73 ++++++++--------------------------
util_lib/include/elf_info.h | 8 +++-
vmcore-dmesg/vmcore-dmesg.c | 54 ++++++++++++++++++++++---
4 files changed, 71 insertions(+), 66 deletions(-)
--
2.17.1
4 years, 1 month
[PATCHv2] kdumpctl: wait a while for network ready if dump target is ssh
by Pingfan Liu
If dump target is ipv6 address, a host should have ipv6 address ready
before starting kdump service. Otherwise, kdump service fails to start due
to the failure "ssh dump_server_ip mkdir -p $SAVE_PATH".
And user can see message like:
"Could not create root@2620:52:0:10da:46a8:42ff:fe23:3272/var/crash"
I observe a long period (about 30s) on some machine before they got ipv6
address dynamiclly, which is never seen on ipv4 host.
Hence kdump service has a dependency on ipv6 address. But there is no good
way to resolve it. One way is asking user to run the cmd "nmcli connection
modify eth0 ipv6.may-fail false". But this will block systemd until ipv6
address is ready. Despite doing so, kdump can try its best (wait 1 minutes
after it starts up) before failure.
How to implement the wait is arguable. It will involve too many technique
details if explicitly waiting on ipv6 address, instead, just lean on 'ssh'
return value to see the availability of network.
Signed-off-by: Pingfan Liu <piliu(a)redhat.com>
---
kdumpctl | 36 ++++++++++++++++++++++++++++++++++--
1 file changed, 34 insertions(+), 2 deletions(-)
diff --git a/kdumpctl b/kdumpctl
index a1a6ee2..60df26b 100755
--- a/kdumpctl
+++ b/kdumpctl
@@ -730,11 +730,43 @@ check_ssh_config()
return 0
}
+# ipv6 host address may takes a long time to be ready.
+# Instead of checking against ipv6 address, we just check the network reachable
+# by the return val of 'ssh'
+check_and_wait_network_ready()
+{
+ local netready="false"
+ local start_time=$(date +%s)
+
+
+ while true; do
+ ssh -q -i $SSH_KEY_LOCATION -o BatchMode=yes $DUMP_TARGET mkdir -p $SAVE_PATH
+ # ssh exits with the exit status of the remote command or with 255 if an error occurred
+ if [ $? -ne 255 ]; then
+ netready="true"
+ break;
+ fi
+ cur=$(date +%s)
+ diff=$( $cur - $start_time )
+ # 60s time out
+ if [ $diff -gt 60 ]; then
+ break;
+ fi
+ sleep 1
+ done
+
+ if [ "$netready" == "false" ]; then
+ return 1
+ fi
+
+ return 0
+}
+
check_ssh_target()
{
local _ret
- ssh -q -i $SSH_KEY_LOCATION -o BatchMode=yes $DUMP_TARGET mkdir -p $SAVE_PATH
- _ret=$?
+
+ _ret=check_and_wait_network_ready()
if [ $_ret -ne 0 ]; then
echo "Could not create $DUMP_TARGET:$SAVE_PATH, you probably need to run \"kdumpctl propagate\"" >&2
return 1
--
2.7.5
4 years, 1 month
[PATCH v2] Limit the size of vmcore-dmesg.txt to no more than 100MB
by Lianbo Jiang
From: Jun Wang <junw99(a)yahoo.com>
With some corrupted vmcore files, the vmcore-dmesg.txt file may grow
forever till the kdump disk becomes full, and also probably causes
the disk error messages as follow:
...
sd 0:0:0:0: [sda] tag#6 FAILED Result: hostbyte=DID_BAD_TARGET driverbyte=DRIVER_OK
sd 0:0:0:0: [sda] tag#6 CDB: Read(10) 28 00 08 06 4c 98 00 00 08 00
blk_update_request: I/O error, dev sda, sector 134630552
sd 0:0:0:0: [sda] tag#7 FAILED Result: hostbyte=DID_BAD_TARGET driverbyte=DRIVER_OK
sd 0:0:0:0: [sda] tag#7 CDB: Read(10) 28 00 08 06 4c 98 00 00 08 00
blk_update_request: I/O error, dev sda, sector 134630552
...
Lets limit the size of vmcore-dmesg.txt to avoid such problems.
Signed-off-by: Jun Wang <junw99(a)yahoo.com>
Signed-off-by: Lianbo Jiang <lijiang(a)redhat.com>
---
Changes since v1:
[1] Add dump_fs path to limit the size of vmcore-dmesg.txt
[2] Add the option 'iflag=fullblock' for the dd command.
dracut-kdump.sh | 4 ++--
kdump-lib-initramfs.sh | 4 ++--
2 files changed, 4 insertions(+), 4 deletions(-)
diff --git a/dracut-kdump.sh b/dracut-kdump.sh
index 2ae1c7c5d70d..ddd96efb5184 100755
--- a/dracut-kdump.sh
+++ b/dracut-kdump.sh
@@ -102,8 +102,8 @@ save_vmcore_dmesg_ssh() {
local _opts="$3"
local _location=$4
- echo "kdump: saving vmcore-dmesg.txt"
- $_dmesg_collector /proc/vmcore | ssh $_opts $_location "dd of=$_path/vmcore-dmesg-incomplete.txt"
+ echo "kdump: saving vmcore-dmesg.txt, up to 100MB"
+ $_dmesg_collector /proc/vmcore | ssh $_opts $_location "dd of=$_path/vmcore-dmesg-incomplete.txt bs=512 count=204800 iflag=fullblock"
_exitcode=$?
if [ $_exitcode -eq 0 ]; then
diff --git a/kdump-lib-initramfs.sh b/kdump-lib-initramfs.sh
index 608dc6efc07e..44f9ae4dfb8f 100755
--- a/kdump-lib-initramfs.sh
+++ b/kdump-lib-initramfs.sh
@@ -137,8 +137,8 @@ save_vmcore_dmesg_fs() {
local _dmesg_collector=$1
local _path=$2
- echo "kdump: saving vmcore-dmesg.txt"
- $_dmesg_collector /proc/vmcore > ${_path}/vmcore-dmesg-incomplete.txt
+ echo "kdump: saving vmcore-dmesg.txt, up to 100MB"
+ $_dmesg_collector /proc/vmcore | dd of=$_path/vmcore-dmesg-incomplete.txt bs=512 count=204800 iflag=fullblock
_exitcode=$?
if [ $_exitcode -eq 0 ]; then
mv ${_path}/vmcore-dmesg-incomplete.txt ${_path}/vmcore-dmesg.txt
--
2.17.1
4 years, 1 month