[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] Rework check_config and warn on any duplicated option
by Kairui Song
Instead of read and parse the kdump.conf multiple times, only read once
and use a single loop to handle the error check, which is faster.
Also check for any duplicated config otion, and error out if there are
duplicated ones.
Now it checks for following errors, most are unchanged from before:
- Any duplicated config options. (New added)
- Deprecated/Invalid kdump config option.
- Duplicated kdump target, will have a different error message of
other duplicated config options.
- Duplicated --mount options in dracut_args.
- Empty config values. All kdump configs should be in
"<config_opt> <config_value>" format.
- Check If raw target is used in fadump mode.
And removed detect of lines start with space, it will not break kdump
anyway.
The performance is measurable better than before for the check_config
function.
Signed-off-by: Kairui Song <kasong(a)redhat.com>
---
kdumpctl | 72 ++++++++++++++++++++++++++------------------------------
1 file changed, 34 insertions(+), 38 deletions(-)
diff --git a/kdumpctl b/kdumpctl
index 2248da4..f191d9a 100755
--- a/kdumpctl
+++ b/kdumpctl
@@ -217,47 +217,34 @@ restore_default_initrd()
check_config()
{
- local nr
-
- nr=$(awk 'BEGIN{cnt=0} /^raw|^ssh[[:blank:]]|^nfs|^ext[234]|^xfs|^btrfs|^minix|^dracut_args .*\-\-mount/{cnt++} END{print cnt}' $KDUMP_CONFIG_FILE)
- [ $nr -gt 1 ] && {
- echo "More than one dump targets specified."
- return 1
- }
-
- # Check if path option is set more than once.
- nr=$(awk 'BEGIN{cnt=0} /^path /{cnt++} END{print cnt}' $KDUMP_CONFIG_FILE)
- [ $nr -gt 1 ] && {
- echo "Mutiple paths specifed in $KDUMP_CONFIG_FILE"
- return 1
- }
-
- nr=$(grep "^dracut_args .*\-\-mount" $KDUMP_CONFIG_FILE | grep -o "\-\-mount" | wc -l)
- [ $nr -gt 1 ] && {
- echo "Multiple mount targets specified in one \"dracut_args\"."
- return 1
- }
-
- # Check if we have any leading spaces (or tabs) before the
- # variable name in the kdump conf file
- if grep -E -q '^[[:blank:]]+[a-z]' $KDUMP_CONFIG_FILE; then
- echo "No whitespaces are allowed before a kdump option name in $KDUMP_CONFIG_FILE"
- return 1
- fi
-
+ local -A _opt_rec
while read config_opt config_val; do
+ if [ -z "$config_val" ]; then
+ echo "Invalid kdump config value for option $config_opt"
+ return 1
+ fi
+
case "$config_opt" in
- \#* | "")
+ dracut_args)
+ if [[ $config_val == *--mount* ]]; then
+ if [ $(echo $config_val | grep -o "\-\-mount" | wc -l) -ne 1 ]; then
+ echo "Multiple mount targets specified in one \"dracut_args\"."
+ return 1
+ fi
+ config_opt=_target
+ fi
;;
- raw|ext2|ext3|ext4|minix|btrfs|xfs|nfs|ssh|sshkey|path|core_collector|kdump_post|kdump_pre|extra_bins|extra_modules|failure_action|default|final_action|force_rebuild|force_no_rebuild|dracut_args|fence_kdump_args|fence_kdump_nodes)
- # remove inline comments after the end of a directive.
- [ -z "$config_val" ] && {
- echo "Invalid kdump config value for option $config_opt."
- return 1;
- }
- if [ -d "/proc/device-tree/ibm,opal/dump" ] && [ "$config_opt" == "raw" ]; then
+ raw)
+ if [ -d "/proc/device-tree/ibm,opal/dump" ]; then
echo "WARNING: Won't capture opalcore when 'raw' dump target is used."
+ return 1
fi
+ config_opt=_target
+ ;;
+ ext[234]|minix|btrfs|xfs|nfs|ssh)
+ config_opt=_target
+ ;;
+ sshkey|path|core_collector|kdump_post|kdump_pre|extra_bins|extra_modules|failure_action|default|final_action|force_rebuild|force_no_rebuild|fence_kdump_args|fence_kdump_nodes)
;;
net|options|link_delay|disk_timeout|debug_mem_level|blacklist)
echo "Deprecated kdump config option: $config_opt. Refer to kdump.conf manpage for alternatives."
@@ -265,14 +252,23 @@ check_config()
;;
*)
echo "Invalid kdump config option $config_opt"
- return 1;
+ return 1
;;
esac
+
+ if [ -n "${_opt_rec[$config_opt]}" ]; then
+ if [ $config_opt == _target ]; then
+ echo "More than one dump targets specified"
+ else
+ echo "Duplicated kdump config value of option $config_opt"
+ fi
+ return 1
+ fi
+ _opt_rec[$config_opt]="$config_val"
done <<< "$(read_strip_comments $KDUMP_CONFIG_FILE)"
check_failure_action_config || return 1
check_final_action_config || return 1
-
check_fence_kdump_config || return 1
return 0
--
2.26.2
3 years, 1 month
[PATCH] kdump-lib.sh: detect secure boot on s390
by Pingfan Liu
On s390, if Secure-IPL is enabled, then "kexec -s -l" is required.
Otherwise kdump kernel can not be loaded.
Signed-off-by: Pingfan Liu <piliu(a)redhat.com>
---
kdump-lib.sh | 7 +++++++
1 file changed, 7 insertions(+)
diff --git a/kdump-lib.sh b/kdump-lib.sh
index e18c473..e24f74f 100755
--- a/kdump-lib.sh
+++ b/kdump-lib.sh
@@ -612,6 +612,7 @@ is_secure_boot_enforced()
return 0
fi
+ # Detect secure boot on x86 and arm64
secure_boot_file=$(find /sys/firmware/efi/efivars -name SecureBoot-* 2>/dev/null)
setup_mode_file=$(find /sys/firmware/efi/efivars -name SetupMode-* 2>/dev/null)
@@ -624,6 +625,12 @@ is_secure_boot_enforced()
fi
fi
+ # Detect secure boot on s390x
+ if [[ -e "/sys/firmware/ipl/has_secure" && "$(cat /sys/firmware/ipl/has_secure)" == "1" \
+ && -e "/sys/firmware/ipl/secure" && "$(cat /sys/firmware/ipl/secure)" == "1" ]]; then
+ return 0
+ fi
+
return 1
}
--
2.7.5
3 years, 1 month
[PATCH v4 0/4] Improve kdump debugging messages for kdump service
by Lianbo Jiang
Sometimes, debugging the kdump service failure becomes very challenging
because there is no complete debugging information, which requires
modification of the options or the scripts like kdumpctl, mkdumprd, etc
to collect the information for troubleshooting.
That means users have to wait for the next failure so that they can
capture the additional information, which could waste valuable time.
This patch series will improve kdump debugging messages and have a
chance to save them to journald or a file. It includes the following
patches:
[1] [PATCH 1/4] introduce the kdump logger from the dracut
[2] [PATCH 2/4] enable the logger for kdump
[3] [PATCH 3/4] kdump.sysconfig: add the kdump logger configurations
[4] [PATCH 4/4] kdumpctl: add the '-d' option to enable the kexec loading
debugging messages
In addition, this patch series won't cause performance degradation,
basically this effect can be ignored. I simply checked the result of
executing the loading command as follow:
[1] before
# time kdumpctl start
Detected change(s) in the following file(s):
/etc/kdump.conf
Rebuilding /boot/initramfs-4.18.0-232.el8.x86_64kdump.img
Tips: If early kdump is enabled, also require rebuilding the system initramfs to make the changes take effect for early kdump.
kexec: loaded kdump kernel
Starting kdump: [OK]
real 0m9.145s
user 0m20.733s
sys 0m1.765s
[2] after
# time kdumpctl start
kdump: Detected change(s) in the following file(s): /etc/kdump.conf
kdump: Rebuilding /boot/initramfs-4.18.0-232.el8.x86_64kdump.img
kdump: Tips: If early kdump is enabled, also require rebuilding the system initramfs to make the changes take effect for early kdump.
kdump: kexec: loaded kdump kernel
kdump: Starting kdump: [OK]
real 0m9.177s
user 0m20.784s
sys 0m1.901s
Changes since v3:
[1] modify the kdump-lib.sh and kdumpctl and improve them.
Lianbo Jiang (4):
introduce the kdump logger from the dracut
enable the logger for kdump
kdump.sysconfig: add the kdump logger configurations
kdumpctl: add the '-d' option to enable the kexec loading debugging
messages
dracut-early-kdump-module-setup.sh | 3 +
dracut-early-kdump.sh | 24 +-
kdump-lib.sh | 23 +-
kdump-logger.sh | 380 +++++++++++++++++++++++++++++
kdump.sysconfig | 21 ++
kdump.sysconfig.aarch64 | 21 ++
kdump.sysconfig.i386 | 21 ++
kdump.sysconfig.ppc64 | 21 ++
kdump.sysconfig.ppc64le | 21 ++
kdump.sysconfig.s390x | 21 ++
kdump.sysconfig.x86_64 | 21 ++
kdumpctl | 241 ++++++++++--------
kexec-tools.spec | 2 +
mkdumprd | 12 +-
14 files changed, 707 insertions(+), 125 deletions(-)
create mode 100755 kdump-logger.sh
--
2.17.1
3 years, 2 months
[PATCH v2] Try not abuse cat
by Kairui Song
Replace $(cat ...) with $(< ...) which help improve the performance.
Signed-off-by: Kairui Song <kasong(a)redhat.com>
---
dracut-module-setup.sh | 6 +++---
kdump-lib.sh | 8 ++++----
kdumpctl | 6 +++---
mkdumprd | 3 +--
4 files changed, 11 insertions(+), 12 deletions(-)
diff --git a/dracut-module-setup.sh b/dracut-module-setup.sh
index a186570..a7e1024 100755
--- a/dracut-module-setup.sh
+++ b/dracut-module-setup.sh
@@ -94,7 +94,7 @@ kdump_setup_dns() {
_dns=$(echo $_nameserver | cut -d' ' -f2)
[ -z "$_dns" ] && continue
- if [ ! -f $_dnsfile ] || [ ! $(cat $_dnsfile | grep -q $_dns) ]; then
+ if [ ! -f $_dnsfile ] || [ ! $(grep -q $_dns $_dnsfile) ]; then
echo "nameserver=$_dns" >> "$_dnsfile"
fi
done < "/etc/resolv.conf"
@@ -239,7 +239,7 @@ kdump_setup_bridge() {
kdump_setup_bond() {
local _netdev=$1
local _dev _mac _slaves _kdumpdev
- for _dev in `cat /sys/class/net/$_netdev/bonding/slaves`; do
+ for _dev in $(< /sys/class/net/$_netdev/bonding/slaves); do
_mac=$(kdump_get_perm_addr $_dev)
_kdumpdev=$(kdump_setup_ifname $_dev)
echo -n " ifname=$_kdumpdev:$_mac" >> ${initdir}/etc/cmdline.d/42bond.conf
@@ -777,7 +777,7 @@ kdump_configure_fence_kdump () {
# Install a random seed used to feed /dev/urandom
# By the time kdump service starts, /dev/uramdom is already fed by systemd
kdump_install_random_seed() {
- local poolsize=`cat /proc/sys/kernel/random/poolsize`
+ local poolsize=$(< /proc/sys/kernel/random/poolsize)
if [ ! -d ${initdir}/var/lib/ ]; then
mkdir -p ${initdir}/var/lib/
diff --git a/kdump-lib.sh b/kdump-lib.sh
index f39f141..31e6cfb 100755
--- a/kdump-lib.sh
+++ b/kdump-lib.sh
@@ -13,7 +13,7 @@ is_fadump_capable()
# Check if firmware-assisted dump is enabled
# if no, fallback to kdump check
if [ -f $FADUMP_ENABLED_SYS_NODE ]; then
- rc=`cat $FADUMP_ENABLED_SYS_NODE`
+ rc=$(< $FADUMP_ENABLED_SYS_NODE)
[ $rc -eq 1 ] && return 0
fi
return 1
@@ -501,7 +501,7 @@ check_crash_mem_reserved()
{
local mem_reserved
- mem_reserved=$(cat /sys/kernel/kexec_crash_size)
+ mem_reserved=$(< /sys/kernel/kexec_crash_size)
if [ $mem_reserved -eq 0 ]; then
echo "No memory reserved for crash kernel"
return 1
@@ -527,7 +527,7 @@ check_current_kdump_status()
return 1
fi
- rc=`cat /sys/kernel/kexec_crash_loaded`
+ rc=$(< /sys/kernel/kexec_crash_loaded)
if [ $rc == 1 ]; then
return 0
else
@@ -734,7 +734,7 @@ prepare_cmdline()
local cmdline id
if [ -z "$1" ]; then
- cmdline=$(cat /proc/cmdline)
+ cmdline=$(< /proc/cmdline)
else
cmdline="$1"
fi
diff --git a/kdumpctl b/kdumpctl
index 2248da4..2e9c429 100755
--- a/kdumpctl
+++ b/kdumpctl
@@ -200,7 +200,7 @@ restore_default_initrd()
if [ -f $DEFAULT_INITRD_BAK ] && [ -f $INITRD_CHECKSUM_LOCATION ]; then
# verify checksum before restoring
backup_checksum=`sha1sum $DEFAULT_INITRD_BAK | awk '{ print $1 }'`
- default_checksum=`cat $INITRD_CHECKSUM_LOCATION | awk '{ print $1 }'`
+ default_checksum=$(awk '{ print $1 }' $INITRD_CHECKSUM_LOCATION)
if [ "$default_checksum" != "$backup_checksum" ]; then
echo "WARNING: checksum mismatch! Can't restore original initrd.."
else
@@ -839,7 +839,7 @@ propagate_ssh_key()
show_reserved_mem()
{
- local mem=$(cat /sys/kernel/kexec_crash_size)
+ local mem=$(< /sys/kernel/kexec_crash_size)
local mem_mb=$(expr $mem / 1024 / 1024)
echo "Reserved "$mem_mb"MB memory for crash kernel"
@@ -848,7 +848,7 @@ show_reserved_mem()
check_current_fadump_status()
{
# Check if firmware-assisted dump has been registered.
- rc=`cat $FADUMP_REGISTER_SYS_NODE`
+ rc=$(< $FADUMP_REGISTER_SYS_NODE)
[ $rc -eq 1 ] && return 0
return 1
}
diff --git a/mkdumprd b/mkdumprd
index 36f71b7..c13b746 100644
--- a/mkdumprd
+++ b/mkdumprd
@@ -330,7 +330,6 @@ for_each_block_target()
}
-
#judge if a specific device with $1 is unresettable
#return false if unresettable.
is_unresettable()
@@ -340,7 +339,7 @@ is_unresettable()
if [ -f "$path" ]
then
- resettable="$(cat $path)"
+ resettable="$(< $path)"
[ $resettable -eq 0 -a "$OVERRIDE_RESETTABLE" -eq 0 ] && {
local device=$(udevadm info --query=all --path=/sys/dev/block/$1 | awk -F= '/DEVNAME/{print $2}')
echo "Error: Can not save vmcore because device $device is unresettable"
--
2.26.2
3 years, 2 months
[PATCH] kdump-lib.sh: Fix boot image cmdline detection
by Kairui Song
Currently the sed call will read in the whole cmdline if BOOT_IMAGE=
parameter doesn't exist. Later code will use a fallback list to
detect valid path so this error is harmless yet, but still fix it to
save a detection iteration.
Signed-off-by: Kairui Song <kasong(a)redhat.com>
---
kdump-lib.sh | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/kdump-lib.sh b/kdump-lib.sh
index e18c473..f39f141 100755
--- a/kdump-lib.sh
+++ b/kdump-lib.sh
@@ -682,7 +682,7 @@ prepare_kdump_bootinfo()
boot_imglist="$KDUMP_IMG-$KDUMP_KERNELVER$KDUMP_IMG_EXT $machine_id/$KDUMP_KERNELVER/$KDUMP_IMG"
# Use BOOT_IMAGE as reference if possible, strip the GRUB root device prefix in (hd0,gpt1) format
- local boot_img="$(cat /proc/cmdline | sed "s/^BOOT_IMAGE=\((\S*)\)\?\(\S*\) .*/\2/")"
+ local boot_img="$(sed -n "s/^BOOT_IMAGE=\((\S*)\)\?\(\S*\) .*/\2/p" /proc/cmdline)"
if [ -n "$boot_img" ]; then
boot_imglist="$boot_img $boot_imglist"
fi
--
2.26.2
3 years, 2 months
Re: [PATCH] Try not abuse cat
by Kairui Song
On Thu, Sep 24, 2020 at 2:49 PM HAGIO KAZUHITO(萩尾 一仁)
<k-hagio-ab(a)nec.com> wrote:
>
> Hello Kairui,
>
> -----Original Message-----
> > Replace $(cat ...) with $(< ...) which help improve the performance.
> >
> > Signed-off-by: Kairui Song <kasong(a)redhat.com>
> > ---
> > dracut-module-setup.sh | 6 +++---
> > kdump-lib.sh | 10 +++++-----
> > kdumpctl | 6 +++---
> > mkdumprd | 3 +--
> > 4 files changed, 12 insertions(+), 13 deletions(-)
> >
> > diff --git a/dracut-module-setup.sh b/dracut-module-setup.sh
> > index a186570..6a13f53 100755
> > --- a/dracut-module-setup.sh
> > +++ b/dracut-module-setup.sh
> > @@ -94,7 +94,7 @@ kdump_setup_dns() {
> > _dns=$(echo $_nameserver | cut -d' ' -f2)
> > [ -z "$_dns" ] && continue
> >
> > - if [ ! -f $_dnsfile ] || [ ! $(cat $_dnsfile | grep -q $_dns) ]; then
> > + if [ ! -f $_dnsfile ] || [ ! $(< $_dnsfile | grep -q $_dns) ]; then
>
> Does this pipeline pattern work expectedly?
>
Hi, thanks very much for catching this issue, I didn't notice this in
my sanity check, the syntax is not working here. For such usage, cat
could be avoided by appending the filename to the grep/awk call. I'll
update the patch.
--
Best Regards,
Kairui Song
3 years, 2 months
[PATCH] Try not abuse cat
by Kairui Song
Replace $(cat ...) with $(< ...) which help improve the performance.
Signed-off-by: Kairui Song <kasong(a)redhat.com>
---
dracut-module-setup.sh | 6 +++---
kdump-lib.sh | 10 +++++-----
kdumpctl | 6 +++---
mkdumprd | 3 +--
4 files changed, 12 insertions(+), 13 deletions(-)
diff --git a/dracut-module-setup.sh b/dracut-module-setup.sh
index a186570..6a13f53 100755
--- a/dracut-module-setup.sh
+++ b/dracut-module-setup.sh
@@ -94,7 +94,7 @@ kdump_setup_dns() {
_dns=$(echo $_nameserver | cut -d' ' -f2)
[ -z "$_dns" ] && continue
- if [ ! -f $_dnsfile ] || [ ! $(cat $_dnsfile | grep -q $_dns) ]; then
+ if [ ! -f $_dnsfile ] || [ ! $(< $_dnsfile | grep -q $_dns) ]; then
echo "nameserver=$_dns" >> "$_dnsfile"
fi
done < "/etc/resolv.conf"
@@ -239,7 +239,7 @@ kdump_setup_bridge() {
kdump_setup_bond() {
local _netdev=$1
local _dev _mac _slaves _kdumpdev
- for _dev in `cat /sys/class/net/$_netdev/bonding/slaves`; do
+ for _dev in $(< /sys/class/net/$_netdev/bonding/slaves); do
_mac=$(kdump_get_perm_addr $_dev)
_kdumpdev=$(kdump_setup_ifname $_dev)
echo -n " ifname=$_kdumpdev:$_mac" >> ${initdir}/etc/cmdline.d/42bond.conf
@@ -777,7 +777,7 @@ kdump_configure_fence_kdump () {
# Install a random seed used to feed /dev/urandom
# By the time kdump service starts, /dev/uramdom is already fed by systemd
kdump_install_random_seed() {
- local poolsize=`cat /proc/sys/kernel/random/poolsize`
+ local poolsize=$(< /proc/sys/kernel/random/poolsize)
if [ ! -d ${initdir}/var/lib/ ]; then
mkdir -p ${initdir}/var/lib/
diff --git a/kdump-lib.sh b/kdump-lib.sh
index e18c473..8bb424c 100755
--- a/kdump-lib.sh
+++ b/kdump-lib.sh
@@ -13,7 +13,7 @@ is_fadump_capable()
# Check if firmware-assisted dump is enabled
# if no, fallback to kdump check
if [ -f $FADUMP_ENABLED_SYS_NODE ]; then
- rc=`cat $FADUMP_ENABLED_SYS_NODE`
+ rc=$(< $FADUMP_ENABLED_SYS_NODE)
[ $rc -eq 1 ] && return 0
fi
return 1
@@ -501,7 +501,7 @@ check_crash_mem_reserved()
{
local mem_reserved
- mem_reserved=$(cat /sys/kernel/kexec_crash_size)
+ mem_reserved=$(< /sys/kernel/kexec_crash_size)
if [ $mem_reserved -eq 0 ]; then
echo "No memory reserved for crash kernel"
return 1
@@ -527,7 +527,7 @@ check_current_kdump_status()
return 1
fi
- rc=`cat /sys/kernel/kexec_crash_loaded`
+ rc=$(< /sys/kernel/kexec_crash_loaded)
if [ $rc == 1 ]; then
return 0
else
@@ -682,7 +682,7 @@ prepare_kdump_bootinfo()
boot_imglist="$KDUMP_IMG-$KDUMP_KERNELVER$KDUMP_IMG_EXT $machine_id/$KDUMP_KERNELVER/$KDUMP_IMG"
# Use BOOT_IMAGE as reference if possible, strip the GRUB root device prefix in (hd0,gpt1) format
- local boot_img="$(cat /proc/cmdline | sed "s/^BOOT_IMAGE=\((\S*)\)\?\(\S*\) .*/\2/")"
+ local boot_img="$(< /proc/cmdline | sed "s/^BOOT_IMAGE=\((\S*)\)\?\(\S*\) .*/\2/")"
if [ -n "$boot_img" ]; then
boot_imglist="$boot_img $boot_imglist"
fi
@@ -734,7 +734,7 @@ prepare_cmdline()
local cmdline id
if [ -z "$1" ]; then
- cmdline=$(cat /proc/cmdline)
+ cmdline=$(< /proc/cmdline)
else
cmdline="$1"
fi
diff --git a/kdumpctl b/kdumpctl
index 2248da4..06afc45 100755
--- a/kdumpctl
+++ b/kdumpctl
@@ -200,7 +200,7 @@ restore_default_initrd()
if [ -f $DEFAULT_INITRD_BAK ] && [ -f $INITRD_CHECKSUM_LOCATION ]; then
# verify checksum before restoring
backup_checksum=`sha1sum $DEFAULT_INITRD_BAK | awk '{ print $1 }'`
- default_checksum=`cat $INITRD_CHECKSUM_LOCATION | awk '{ print $1 }'`
+ default_checksum=$(< $INITRD_CHECKSUM_LOCATION | awk '{ print $1 }')
if [ "$default_checksum" != "$backup_checksum" ]; then
echo "WARNING: checksum mismatch! Can't restore original initrd.."
else
@@ -839,7 +839,7 @@ propagate_ssh_key()
show_reserved_mem()
{
- local mem=$(cat /sys/kernel/kexec_crash_size)
+ local mem=$(< /sys/kernel/kexec_crash_size)
local mem_mb=$(expr $mem / 1024 / 1024)
echo "Reserved "$mem_mb"MB memory for crash kernel"
@@ -848,7 +848,7 @@ show_reserved_mem()
check_current_fadump_status()
{
# Check if firmware-assisted dump has been registered.
- rc=`cat $FADUMP_REGISTER_SYS_NODE`
+ rc=$(< $FADUMP_REGISTER_SYS_NODE)
[ $rc -eq 1 ] && return 0
return 1
}
diff --git a/mkdumprd b/mkdumprd
index 36f71b7..c13b746 100644
--- a/mkdumprd
+++ b/mkdumprd
@@ -330,7 +330,6 @@ for_each_block_target()
}
-
#judge if a specific device with $1 is unresettable
#return false if unresettable.
is_unresettable()
@@ -340,7 +339,7 @@ is_unresettable()
if [ -f "$path" ]
then
- resettable="$(cat $path)"
+ resettable="$(< $path)"
[ $resettable -eq 0 -a "$OVERRIDE_RESETTABLE" -eq 0 ] && {
local device=$(udevadm info --query=all --path=/sys/dev/block/$1 | awk -F= '/DEVNAME/{print $2}')
echo "Error: Can not save vmcore because device $device is unresettable"
--
2.26.2
3 years, 2 months
[PATCH] increase makdumpfile default message level to 7
by Lianbo Jiang
Currently, the makedumpfile option '--message-level' is set to 1 when
dumping the vmcore, it only displays the progress indicator message,
but there are no common message and error message, it is important to
report some additional messages, especially for the error message,
which is very useful for the debugging.
In view of this, let's change the message level to 7 by default.
Signed-off-by: Lianbo Jiang <lijiang(a)redhat.com>
---
kdump-lib-initramfs.sh | 2 +-
kdump.conf | 6 +++---
kdump.conf.5 | 4 ++--
kexec-kdump-howto.txt | 4 ++--
4 files changed, 8 insertions(+), 8 deletions(-)
diff --git a/kdump-lib-initramfs.sh b/kdump-lib-initramfs.sh
index c98a43b473cd..8ef3cd00615a 100755
--- a/kdump-lib-initramfs.sh
+++ b/kdump-lib-initramfs.sh
@@ -4,7 +4,7 @@
KDUMP_PATH="/var/crash"
CORE_COLLECTOR=""
-DEFAULT_CORE_COLLECTOR="makedumpfile -l --message-level 1 -d 31"
+DEFAULT_CORE_COLLECTOR="makedumpfile -l --message-level 7 -d 31"
DMESG_COLLECTOR="/sbin/vmcore-dmesg"
FAILURE_ACTION="systemctl reboot -f"
DATEDIR=`date +%Y-%m-%d-%T`
diff --git a/kdump.conf b/kdump.conf
index 9fc0a4fb7538..e4db52e2db97 100644
--- a/kdump.conf
+++ b/kdump.conf
@@ -62,9 +62,9 @@
# as the initrd will automatically be populated with a
# config file appropriate for the running kernel.
# The default core_collector for raw/ssh dump is:
-# "makedumpfile -F -l --message-level 1 -d 31".
+# "makedumpfile -F -l --message-level 7 -d 31".
# The default core_collector for other targets is:
-# "makedumpfile -l --message-level 1 -d 31".
+# "makedumpfile -l --message-level 7 -d 31".
#
# "makedumpfile -F" will create a flattened vmcore.
# You need to use "makedumpfile -R" to rearrange the dump data to
@@ -169,7 +169,7 @@
#ssh user(a)my.server.com
#sshkey /root/.ssh/kdump_id_rsa
path /var/crash
-core_collector makedumpfile -l --message-level 1 -d 31
+core_collector makedumpfile -l --message-level 7 -d 31
#core_collector scp
#kdump_post /var/crash/scripts/kdump-post.sh
#kdump_pre /var/crash/scripts/kdump-pre.sh
diff --git a/kdump.conf.5 b/kdump.conf.5
index 34c996c76888..1dd371f86d50 100644
--- a/kdump.conf.5
+++ b/kdump.conf.5
@@ -85,9 +85,9 @@ for the running kernel.
.PP
Note 1: About default core collector:
The default core_collector for raw/ssh dump is:
-"makedumpfile -F -l --message-level 1 -d 31".
+"makedumpfile -F -l --message-level 7 -d 31".
The default core_collector for other targets is:
-"makedumpfile -l --message-level 1 -d 31".
+"makedumpfile -l --message-level 7 -d 31".
Even if core_collector option is commented out in kdump.conf, makedumpfile
is the default core collector and kdump uses it internally.
If one does not want makedumpfile as default core_collector, then they
diff --git a/kexec-kdump-howto.txt b/kexec-kdump-howto.txt
index 2209e5a573d3..2750b87e005d 100644
--- a/kexec-kdump-howto.txt
+++ b/kexec-kdump-howto.txt
@@ -696,9 +696,9 @@ About default core collector
----------------------------
Default core_collector for ssh/raw dump is:
-"makedumpfile -F -l --message-level 1 -d 31".
+"makedumpfile -F -l --message-level 7 -d 31".
Default core_collector for other targets is:
-"makedumpfile -l --message-level 1 -d 31".
+"makedumpfile -l --message-level 7 -d 31".
Even if core_collector option is commented out in kdump.conf, makedumpfile
is default core collector and kdump uses it internally.
--
2.17.1
3 years, 2 months
[PATCH v3 0/4] Improve kdump debugging messages for kdump
by Lianbo Jiang
Sometimes, debugging the kdump service failure becomes very challenging
because there is no complete debugging information, which requires
modification of the options or the scripts like kdumpctl, mkdumprd, etc
to collect the information for troubleshooting.
That means users have to wait for the next failure so that they can
capture the additional information, which could waste valuable time.
This patch series will improve kdump debugging messages and have a
chance to save them to journald or a file. It includes the following
patches:
[1] [PATCH 1/4] introduce the kdump logger from the dracut
[2] [PATCH 2/4] enable the logger for kdump
[3] [PATCH 3/4] kdump.sysconfig: add the kdump logger configurations
[4] [PATCH 4/4] kdumpctl: add the '-d' option to enable the kexec loading
debugging messages
In addition, this patch series won't cause performance degradation,
basically this effect can be ignored. I simply checked the result of
executing the loading command as follow:
[1] before
# time kdumpctl start
Detected change(s) in the following file(s):
/etc/kdump.conf
Rebuilding /boot/initramfs-4.18.0-232.el8.x86_64kdump.img
Tips: If early kdump is enabled, also require rebuilding the system initramfs to make the changes take effect for early kdump.
kexec: loaded kdump kernel
Starting kdump: [OK]
real 0m9.145s
user 0m20.733s
sys 0m1.765s
[2] after
# time kdumpctl start
kdump: Detected change(s) in the following file(s): /etc/kdump.conf
kdump: Rebuilding /boot/initramfs-4.18.0-232.el8.x86_64kdump.img
kdump: Tips: If early kdump is enabled, also require rebuilding the system initramfs to make the changes take effect for early kdump.
kdump: kexec: loaded kdump kernel
kdump: Starting kdump: [OK]
real 0m9.177s
user 0m20.784s
sys 0m1.901s
Lianbo Jiang (4):
introduce the kdump logger from the dracut
enable the logger for kdump
kdump.sysconfig: add the kdump logger configurations
kdumpctl: add the '-d' option to enable the kexec loading debugging
messages
dracut-early-kdump-module-setup.sh | 3 +
dracut-early-kdump.sh | 24 +-
kdump-lib.sh | 15 +-
kdump-logger.sh | 380 +++++++++++++++++++++++++++++
kdump.sysconfig | 21 ++
kdump.sysconfig.aarch64 | 21 ++
kdump.sysconfig.i386 | 21 ++
kdump.sysconfig.ppc64 | 21 ++
kdump.sysconfig.ppc64le | 21 ++
kdump.sysconfig.s390x | 21 ++
kdump.sysconfig.x86_64 | 21 ++
kdumpctl | 233 ++++++++++--------
kexec-tools.spec | 2 +
mkdumprd | 12 +-
14 files changed, 698 insertions(+), 118 deletions(-)
create mode 100755 kdump-logger.sh
--
2.17.1
3 years, 2 months