[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] kdump/lib: introduce a script to return recommened mem size
by Pingfan Liu
There is requirement to decide the recommended memory size for the current
system.
Implementing a script to achieve it.
Signed-off-by: Pingfan Liu <piliu(a)redhat.com>
---
kdump-lib-memsz.sh | 66 ++++++++++++++++++++++++++++++++++++++++++++++++++++++
kexec-tools.spec | 2 ++
2 files changed, 68 insertions(+)
create mode 100644 kdump-lib-memsz.sh
diff --git a/kdump-lib-memsz.sh b/kdump-lib-memsz.sh
new file mode 100644
index 0000000..d524a9f
--- /dev/null
+++ b/kdump-lib-memsz.sh
@@ -0,0 +1,66 @@
+#!/bin/sh
+# kdump-api-memsz.sh
+# return recommended size based on current system RAM size
+
+#get system memory size in the unit of GB
+get_system_size()
+{
+ result=$( cat /proc/iomem | grep "System RAM" | awk -F ":" {' print $1 '} | tr [:lower:] [:upper:] | paste -sd+ )
+ result="+$result"
+ # replace '-' with '+0x' and '+' with '-0x'
+ sum=$( echo $result | sed -e 's/-/K0x/g' | sed -e 's/+/-0x/g' | sed -e 's/K/+/g' )
+ size=$(printf "%d\n" $(($sum)))
+ let size=$size/1024/1024/1024
+
+ echo $size
+}
+
+get_recommend_size()
+{
+ local mem_size=$1
+ local _ck_cmdline=$2
+
+ last_sz=""
+ last_unit=""
+
+ IFS=','
+ for i in $_ck_cmdline
+ do
+ end=$( echo $i | awk -F "-" {' print $2 '} | awk -F ":" {' print $1 '} )
+ recommend=$( echo $i | awk -F "-" {' print $2 '} | awk -F ":" {' print $2 '} )
+ size=${end: : -1}
+ unit=${end: -1}
+ if [ $unit == 'T' ]; then
+ let size=$size*1024
+ fi
+ if [ $mem_size -lt $size ]; then
+ echo $recommend
+ return
+ fi
+ done
+ unset IFS
+}
+
+. /lib/kdump/kdump-lib.sh
+
+arch=$( lscpu | grep Architecture | awk -F ":" {' print $2 '} | tr [:lower:] [:upper:] )
+
+if [ $arch == "X86_64" ] || [ $arch == "S390" ]; then
+ ck_cmdline="1G-4G:160M,4G-64G:192M,64G-1T:256M,1T-:512M"
+elif [ $arch == "ARM64" ]; then
+ ck_cmdline="2G-:448M"
+elif [ $arch == "PPC64LE" ]; then
+ if is_fadump_capable; then
+ ck_cmdline="4G-16G:768M,16G-64G:1G,64G-128G:2G,128G-1T:4G,1T-2T:6G,2T-4T:12G,4T-8T:20G,8T-16T:36G,16T-32T:64G,32T-64T:128G,64T-:180G"
+ else
+ ck_cmdline="2G-4G:384M,4G-16G:512M,16G-64G:1G,64G-128G:2G,128G-:4G"
+ fi
+fi
+
+ck_cmdline=$( echo $ck_cmdline | sed -e 's/-:/-102400T:/g' )
+
+sys_mem=$(get_system_size)
+
+result=$( get_recommend_size $sys_mem "$ck_cmdline" )
+
+echo $result
diff --git a/kexec-tools.spec b/kexec-tools.spec
index 623274c..7f982c6 100644
--- a/kexec-tools.spec
+++ b/kexec-tools.spec
@@ -38,6 +38,7 @@ Source28: kdump-udev-throttler
Source29: kdump.sysconfig.aarch64
Source30: 60-kdump.install
Source31: kdump-logger.sh
+Source32: kdump-lib-memsz.sh
#######################################
# These are sources for mkdumpramfs
@@ -192,6 +193,7 @@ install -m 644 %{SOURCE25} $RPM_BUILD_ROOT%{_mandir}/man8/kdumpctl.8
install -m 755 %{SOURCE20} $RPM_BUILD_ROOT%{_prefix}/lib/kdump/kdump-lib.sh
install -m 755 %{SOURCE23} $RPM_BUILD_ROOT%{_prefix}/lib/kdump/kdump-lib-initramfs.sh
install -m 755 %{SOURCE31} $RPM_BUILD_ROOT%{_prefix}/lib/kdump/kdump-logger.sh
+install -m 755 %{SOURCE32} $RPM_BUILD_ROOT%{_prefix}/lib/kdump/kdump-lib-memsz.sh
%ifnarch s390x
install -m 755 %{SOURCE28} $RPM_BUILD_ROOT%{_udevrulesdir}/../kdump-udev-throttler
%endif
--
2.7.5
2 years, 10 months
[PATCH] module-setup.sh: enable vlan on team interface
by Pingfan Liu
Dracut has switch network-legacy to network-manager by default, which makes
vlan on team easy. So it can be enabled.
Testing network topology with two VMs.
VM1
ens2-\ /----> VLAN8 (192.168.120.50)
---> team0
ens3-/ (192.168.122.10)
VM2
ens2-\ /----> VLAN8 (192.168.120.100)
---> team0
ens3-/ (192.168.122.20)
Both of ens2/ens3 in VM1/VM2 are connected to virbr0.
During test, dump target is set as root@192.168.120.100:/var/crash
then crashing in VM1
Signed-off-by: Pingfan Liu <piliu(a)redhat.com>
---
dracut-module-setup.sh | 6 +-----
1 file changed, 1 insertion(+), 5 deletions(-)
diff --git a/dracut-module-setup.sh b/dracut-module-setup.sh
index 911a8b8..aeea497 100755
--- a/dracut-module-setup.sh
+++ b/dracut-module-setup.sh
@@ -283,14 +283,10 @@ kdump_setup_vlan() {
local _netmac="$(kdump_get_mac_addr $_phydev)"
local _kdumpdev
- #Just support vlan over bond, it is not easy
- #to support all other complex setup
+ #Just support vlan over bond and team
if kdump_is_bridge "$_phydev"; then
derror "Vlan over bridge is not supported!"
exit 1
- elif kdump_is_team "$_phydev"; then
- derror "Vlan over team is not supported!"
- exit 1
elif kdump_is_bond "$_phydev"; then
kdump_setup_bond "$_phydev"
echo " vlan=$(kdump_setup_ifname $_netdev):$_phydev" > ${initdir}/etc/cmdline.d/43vlan.conf
--
2.7.5
3 years
[PATCH 0/2] Fix btrfs support and fix a few bind mount corner cases
by Kairui Song
Fedora 33 now have btrfs by default, and kdump is failing.
Currently the get_bind_mount_source function won't work with btrfs, and
in fails sone corner cases. This series fixes the issues.
Kairui Song (2):
Make get_mount_info work with bind mount
kdump-lib: Fix get_bind_mount_source to support btrfs and fstab
kdump-lib-initramfs.sh | 2 +-
kdump-lib.sh | 46 +++++++++++++++++++++++++++---------------
2 files changed, 31 insertions(+), 17 deletions(-)
--
2.28.0
3 years
[PATCH] fadump-howto: update about 'nocma' and 'off' options for
'fadump=' parameter
by Hari Bathini
Along with 'on' option, 'fadump=' kernel parameter also supports
'nocma' & 'off' options. Update about these missing options in the
fadump-howto.txt document.
Signed-off-by: Hari Bathini <hbathini(a)linux.ibm.com>
---
fadump-howto.txt | 12 +++++++++++-
1 file changed, 11 insertions(+), 1 deletion(-)
diff --git a/fadump-howto.txt b/fadump-howto.txt
index c891e37..5360f3d 100644
--- a/fadump-howto.txt
+++ b/fadump-howto.txt
@@ -104,6 +104,11 @@ For the recommended value of X, see 'FADump Memory Requirements' section.
# grubby --args="fadump=on crashkernel=6G" --update-kernel=/boot/vmlinuz-`uname -r`
+By default, FADump reserved memory will be initialized as CMA area to make the
+memory available through CMA allocator on the production kernel. We can opt out
+of this, making reserved memory unavailable to production kernel, by booting the
+linux kernel with 'fadump=nocma' instead of 'fadump=on'.
+
The term 'boot memory' means size of the low memory chunk that is required for
a kernel to boot successfully when booted with restricted memory. By default,
the boot memory size will be the larger of 5% of system RAM or 256MB.
@@ -326,9 +331,14 @@ the original command line completely.
How to disable FADump:
-Remove "fadump=on" from kernel cmdline parameters:
+Remove "fadump=on"/"fadump=nocma" from kernel cmdline parameters OR replace
+it with "fadump=off" kernel cmdline parameter:
# grubby --update-kernel=/boot/vmlinuz-`uname -r` --remove-args="fadump=on"
+or
+ # grubby --update-kernel=/boot/vmlinuz-`uname -r` --remove-args="fadump=nocma"
+OR
+ # grubby --update-kernel=/boot/vmlinuz-`uname -r` --args="fadump=off"
If KDump is to be used as the dump capturing mechanism, update the crashkernel
parameter (Else, remove "crashkernel=" parameter too, using grubby):
3 years
[PATCH v2 0/7] Fix driver detection code and include watchdog-modules
by Kairui Song
Block driver detection now doesn't work for raw targets, this will fix
it. And watchdog driver detection is broken after we enabled the squash
module, this also fixed that problem.
The driver detection code are coupled together so fix them together in
this series.
Patch 7/7 will include watchdog-modules by default, but dracut
haven't make a release containing this module yet, so the last
patch may be merged later.
--
Update from V1:
- Fix a few bugs in the patch
- Set watchdog's pretimeout to 0 in second kernel
Kairui Song (7):
kdumpctl: split the driver detection from fs dection function
Remove a redundant nfs check
Add a helper for detecting watchdog drivers
Fix the watchdog drivers detection code
kdump-lib.sh: Use a more generic helper to detect omitted dracut
module
Set watchdog's pretimeout to zero in kdump kernel
Always include watchdog-modules
dracut-module-setup.sh | 1 +
kdump-lib.sh | 68 +++++++++++-----
kdumpctl | 178 ++++++++++++++---------------------------
3 files changed, 107 insertions(+), 140 deletions(-)
--
2.28.0
3 years
[PATCH v5 0/7] Appending patches for kdump debugging improvement
by Lianbo Jiang
This patchset includes the following patches:
[1] [PATCH 1/7] Add sanity checks for the log levels
[2] [PATCH 2/7] Remove unused log levels for kdump logger
[3] [PATCH 3/7] Appropriately converts logger numeric level to syslog log
level
[4] [PATCH 4/7] Add the rd.kdumploglvl option to control log level in the
second kernel
[5] [PATCH 5/7] Support capitalizing the configuration name of log level
[6] [PATCH 6/7] Update the kdump sysconfig
[7] [PATCH 7/7] Doc: improve the usage documentation of the logger
Changes since v4:
[1] split them into a few patches, make it easily review
[2] capitalizing the configuration name of log levle
[3] update the patch log and documentation accordingly
Lianbo Jiang (7):
Add sanity checks for the log levels
Remove unused log levels for kdump logger
Appropriately converts logger numeric level to syslog log level
Add the rd.kdumploglvl option to control log level in the second
kernel
Support capitalizing the configuration name of log level
Update the kdump sysconfig
Doc: improve the usage documentation of the logger
dracut-module-setup.sh | 1 -
kdump-lib-initramfs.sh | 1 -
kdump-logger.sh | 228 +++++++++++++++++++++-------------------
kdump.sysconfig | 26 ++---
kdump.sysconfig.aarch64 | 26 ++---
kdump.sysconfig.i386 | 26 ++---
kdump.sysconfig.ppc64 | 26 ++---
kdump.sysconfig.ppc64le | 26 ++---
kdump.sysconfig.s390x | 26 ++---
kdump.sysconfig.x86_64 | 26 ++---
kexec-kdump-howto.txt | 109 +++++++++++++------
11 files changed, 289 insertions(+), 232 deletions(-)
--
2.17.1
3 years
[PATCH] Add sanity checks for the log level
by Lianbo Jiang
Let's add sanity checks for the log level in order to avoid
passing illegal log level to the logger.
Signed-off-by: Lianbo Jiang <lijiang(a)redhat.com>
---
kdump-logger.sh | 27 +++++++++++++++++++++++++++
1 file changed, 27 insertions(+)
diff --git a/kdump-logger.sh b/kdump-logger.sh
index c7afa340acfa..a3d674cd07c2 100755
--- a/kdump-logger.sh
+++ b/kdump-logger.sh
@@ -34,15 +34,42 @@
# First of all you have to start with dlog_init() function which initializes
# required variables. Don't call any other logging function before that one!
#
+
+# @brief Check the log level.
+# @retval 1 if something has gone wrong
+# @retval 0 on success.
+#
+check_loglvl()
+{
+ case "$1" in
+ 0|1|2|3|4|5|6)
+ return 0
+ ;;
+ *)
+ return 1
+ ;;
+ esac
+}
+
# @brief Initializes Logger.
# @retval 1 if something has gone wrong
# @retval 0 on success.
#
dlog_init() {
local ret=0; local errmsg
+
[ -z "$kdump_stdloglvl" ] && kdump_stdloglvl=4
[ -z "$kdump_sysloglvl" ] && kdump_sysloglvl=4
[ -z "$kdump_kmsgloglvl" ] && kdump_kmsgloglvl=0
+
+ for loglvl in $kdump_stdloglvl $kdump_kmsgloglvl $kdump_sysloglvl; do
+ check_loglvl $loglvl
+ if [ $? -ne 0 ]; then
+ echo "Illegal log level: $kdump_stdloglvl $kdump_kmsgloglvl $kdump_sysloglvl"
+ return 1
+ fi
+ done
+
# Skip initialization if it's already done.
[ -n "$kdump_maxloglvl" ] && return 0
--
2.17.1
3 years
[PATCH v3 0/2] Remove unused log level and update kdump sysconfig
by Lianbo Jiang
Previously, the range of log level is from 1 to 6, and the TRACE
level and FATAL level are not used, therefore, let's remove these
two log levels and update the kdump sysconfig accordingly.
Nowadays it has only four log levels: error(1), warn(2), info(3)
and debug(4). We have to remap the numeric log level to the logger
priority or syslog log level, which is finished in kdump-logger.sh
module, it is invisible for user.
In addition, kdump uses the different options to control the log
levels for the first kernel and the second kernel.
Changes since v2:
[1] Only split it into two patches, there is no code change.
[suggested by Kairui]
[2] Add the code command for sourcing the dracut-lib.sh
[3] Also modify the patch log accordingly.
Lianbo Jiang (2):
Remove unused log levels for kdump logger
Update kdump sysconfig because of removing unused log levels
dracut-module-setup.sh | 5 +-
kdump-lib-initramfs.sh | 1 -
kdump-logger.sh | 209 +++++++++++++++++-----------------------
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 ++--
10 files changed, 160 insertions(+), 202 deletions(-)
--
2.17.1
3 years
[PATCH v3] Doc: improve the usage documentation of the logger
by Lianbo Jiang
Let's remove some redundant descriptions in the usage documentation
of the logger, and make it clear.
Signed-off-by: Lianbo Jiang <lijiang(a)redhat.com>
---
kexec-kdump-howto.txt | 92 +++++++++++++++++++++++++++++--------------
1 file changed, 62 insertions(+), 30 deletions(-)
diff --git a/kexec-kdump-howto.txt b/kexec-kdump-howto.txt
index 5f57a8428e4f..3ec2f1da82dd 100644
--- a/kexec-kdump-howto.txt
+++ b/kexec-kdump-howto.txt
@@ -888,35 +888,67 @@ Debugging Tips
- Using the logger to output kdump log messages
- Currently, kdump messages are printed with the 'echo' command or redirect
- to console, and which does not support to output kdump messages according
- to the log level.
-
- That is not convenient to debug kdump issues, we usually need to capture
- additional debugging information via the modification of the options or the
- scripts like kdumpctl, mkdumprd, etc. Because there is no complete debugging
- messages, which could waste valuable time.
-
- To cope with this challenging, we introduce the logger to output the kdump
- messages according to the log level, and provide a chance to save logs to
- the journald if the journald service is available, and then dump all logs
- to a file, otherwise dump the logs with the dmesg to a file.
-
- Logging is controlled by following global variables:
- - @var kdump_stdloglvl - logging level to standard error (console output)
- - @var kdump_sysloglvl - logging level to syslog (by logger command)
- - @var kdump_kmsgloglvl - logging level to /dev/kmsg (only for boot-time)
- If any of the variables is not set, this function set it to default:
- - @var kdump_stdloglvl=4 (info)
- - @var kdump_sysloglvl=4 (info)
- - @var kdump_kmsgloglvl=0 (no logging)
-
- Logging levels: fatal(1),error(2),warn(3),info(4),debug(5),trace(6)
-
- We can easily configure the above variables in the /etc/sysconfig/kdump. For
- example:
- kdump_sysloglvl=5
- kdump_stdloglvl=5
+ You can configure the kdump log level in the /etc/sysconfig/kdump.
+ For example:
+
+ kdump_sysloglvl=3
+ kdump_stdloglvl=3
The above configurations indicate that kdump messages will be printed to the
- console and journald if the journald service is enabled.
+ console and journald if the journald service is enabled, and the log level is
+ set to 3(info). This is also the current default log level.
+
+ Logging levels: error(1),warn(2),info(3),debug(4)
+
+ The ERROR level designates error events that might still allow the application
+ to continue running.
+
+ The WARN level designates potentially harmful situations.
+
+ The INFO level designates informational messages that highlight the progress
+ of the application at coarse-grained level.
+
+ The DEBUG level designates fine-grained informational events that are most
+ useful to debug an application.
+
+ At present, the logger works in both the first kernel(kdump service debugging)
+ and the second kernel.
+
+ In the first kernel, you can find the historical logs with the journalctl
+ command and check kdump service debugging information. In addition, the
+ 'kexec -d' debugging messages are also saved to /var/log/kdump.log in the
+ first kernel. For example:
+
+ [root@ibm-z-109 ~]# ls -al /var/log/kdump.log
+ -rw-r--r--. 1 root root 63238 Oct 28 06:40 /var/log/kdump.log
+
+ If you want to get the debugging information of building kdump initramfs, you
+ can enable the '--debug' option for the dracut_args in the /etc/kdump.conf, and
+ then rebuild the kdump initramfs as below:
+
+ # systemctl restart kdump.service
+
+ That will rebuild the kdump initramfs and gerenate some logs to journald, you
+ can find the dracut logs with the journalctl command.
+
+ In the second kernel, kdump will automatically put the kexec-dmesg.log to a same
+ directory with the vmcore, the log file includes the debugging messages like dmesg
+ and journald logs. For example:
+
+ [root@ibm-z-109 ~]# ls -al /var/crash/127.0.0.1-2020-10-28-02\:01\:23/
+ drwxr-xr-x. 2 root root 67 Oct 28 02:02 .
+ drwxr-xr-x. 6 root root 154 Oct 28 02:01 ..
+ -rw-r--r--. 1 root root 21164 Oct 28 02:01 kexec-dmesg.log
+ -rw-------. 1 root root 74238698 Oct 28 02:01 vmcore
+ -rw-r--r--. 1 root root 17532 Oct 28 02:01 vmcore-dmesg.txt
+
+ If you want to get more debugging information in the second kernel, you can add
+ the 'rd.debug' option to the KDUMP_COMMANDLINE_APPEND in the /etc/sysconfig/kdump,
+ and then reload them in order to make the changes take effect.
+
+ In addition, you can also add the 'rd.memdebug=X' option to the KDUMP_COMMANDLINE_APPEND
+ in the /etc/sysconfig/kdump in order to output the additional information about
+ kernel module memory consumption during loading.
+
+ For more details, please refer to the /etc/sysconfig/kdump, or the man page of
+ dracut.cmdline and kdump.conf.
--
2.17.1
3 years