[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
[PATCH v2] kexec-kdump-howto: Add note on setting correct value of kptr_restrict
by Baoquan He
kdumpctl fails to load a crash kernel if KASLR is enabled.
The incorrect configuration of the kptr_restrict parameter causes that
the kdumpctl fails to load a crash kernel. The problem occurs when the
Kernel Address Space Layout Randomization (KASLR) mechanism is enabled.
The value of kptr_restrict decides how to expose the content of /proc
files. Inappropriate setting will cause that the /proc/kallsyms file is
being printed as all zeros. This configuration will break the kdump
loading process since it needs access to the conntent of /proc/kallsyms
if KASLR is enabled.
Set kptr_restrict to 1 to avoid the problem described above.
Signed-off-by: Baoquan He <bhe(a)redhat.com>
---
kexec-kdump-howto.txt | 6 ++++++
1 file changed, 6 insertions(+)
diff --git a/kexec-kdump-howto.txt b/kexec-kdump-howto.txt
index 011a19f2ec27..12a9450cf83e 100644
--- a/kexec-kdump-howto.txt
+++ b/kexec-kdump-howto.txt
@@ -91,6 +91,12 @@ This line tells kexec to reserve 64M of ram if the system contains between
512M and 2G of physical memory. If the system contains 2G or more of physical
memory, 128M should be reserved.
+Besides, since kdump needs to access /proc/kallsyms during a kernel
+loading if KASLR is enabled, check /proc/sys/kernel/kptr_restrict to
+make sure that the content of /proc/kallsyms is exposed correctly.
+We recommend to set the value of kptr_restrict to '1'. Otherwise
+capture kernel loading could fail.
+
After making said changes, reboot your system, so that the X MB of memory is
left untouched by the normal system, reserved for the capture kernel. Take note
that the output of 'free -m' will show X MB less memory than without this
--
2.17.2
4 years, 5 months
[PATCH] kexec-kdump-howto: Add note on setting correct value of kptr_restrict
by Baoquan He
kdumpctl fails to load a crash kernel if KASLR is enabled.
The incorrect configuration of the kptr_restrict parameter causes that
the kdumpctl fails to load a crash kernel. The problem occurs when the
Kernel Address Space Layout Randomization (KASLR) mechanism is enabled.
The value of kptr_restrict decides how to expose the content of /proc
files. Inappropriate setting will cause that the /proc/kcore file is
being printed as all zeros. This configuration will break the kdump
loading process since it needs access to the conntent of /proc/kcore if
KASLR is enabled.
Set kptr_restrict to 1 to avoid the problem described above.
Signed-off-by: Baoquan He <bhe(a)redhat.com>
---
kexec-kdump-howto.txt | 5 +++++
1 file changed, 5 insertions(+)
diff --git a/kexec-kdump-howto.txt b/kexec-kdump-howto.txt
index 011a19f..193b4a9 100644
--- a/kexec-kdump-howto.txt
+++ b/kexec-kdump-howto.txt
@@ -91,6 +91,11 @@ This line tells kexec to reserve 64M of ram if the system contains between
512M and 2G of physical memory. If the system contains 2G or more of physical
memory, 128M should be reserved.
+Besides, since kdump needs to access /proc/kcore during a kernel loading
+if KASLR is enabled, check /proc/sys/kernel/kptr_restrict to make sure
+that the content of /proc/kcore is exposed correctly. We recommend to
+set the value of kptr_restrict to '1'.
+
After making said changes, reboot your system, so that the X MB of memory is
left untouched by the normal system, reserved for the capture kernel. Take note
that the output of 'free -m' will show X MB less memory than without this
--
2.17.2
4 years, 5 months
[PATCH 0/2] Add rebuild support and doc reload command
by Kairui Song
Update from V1:
- merge fadump related initramfs backup/restore into setup_initrd
as suggested by Dave and Hari, also only do permission only when
actually trying to rebuild the image.
Kairui Song (2):
kdumpctl: add rebuild support
Update man page for new kdumpctl command: reload / rebuild
kdumpctl | 51 +++++++++++++++++++++++++++++----------------------
kdumpctl.8 | 6 ++++++
2 files changed, 35 insertions(+), 22 deletions(-)
--
2.20.1
4 years, 6 months
[PATCH 0/2] Add rebuild support and doc reload command
by Kairui Song
Kairui Song (2):
kdumpctl: add rebuild support
Update man page for new kdumpctl command: reload / rebuild
kdumpctl | 26 +++++++++++++++++++++++++-
kdumpctl.8 | 6 ++++++
2 files changed, 31 insertions(+), 1 deletion(-)
--
2.20.1
4 years, 6 months
[PATCH] mkdumprd: Improve the config reading logic
by Kairui Song
Seems some dead codes are left here for historical reason, just remove
them, read the config and strip comments only for once.
This improve the speed by a lot (2.6s -> 0.498s for reading a
simple config in my test case, on HDD) and make the code cleaner.
---
mkdumprd | 6 +-----
1 file changed, 1 insertion(+), 5 deletions(-)
diff --git a/mkdumprd b/mkdumprd
index 6fc68fe..a99d5f1 100644
--- a/mkdumprd
+++ b/mkdumprd
@@ -444,13 +444,9 @@ do
add_dracut_arg $config_val
;;
*)
- if [ -n $(echo $config_opt | grep "^#.*$") ]
- then
- continue
- fi
;;
esac
-done < $conf_file
+done <<< "$(grep -v -e "^#" -e "^$" $conf_file)"
handle_default_dump_target
--
2.20.1
4 years, 6 months
[PATCH] kdumpctl: don't always rebuild when extra_modules is set
by Kairui Song
We now have a module list in the initramfs, and combined with
extra_modules we can detect any module update that may require a
initramfs build. As a result we don't have to always rebuild, only
rebuild whe needed. And also cover the case that kernel modules are
updated but initramfs is not updated.
Even we drop the behavior or bebuild initramfs on kernel loaded module
list changed, detecting module file change should always be a good idea
to ensure initramfs is up to date.
Overhead is small, will consume about 0.1s to check for kernel module
update for about 100 modules.
Signed-off-by: Kairui Song <kasong(a)redhat.com>
---
kdumpctl | 42 ++++++++++++++++++++++++++++++++----------
1 file changed, 32 insertions(+), 10 deletions(-)
diff --git a/kdumpctl b/kdumpctl
index 1cfbe31..25a5e3b 100755
--- a/kdumpctl
+++ b/kdumpctl
@@ -476,19 +476,46 @@ check_wdt_modified()
return 1
}
+# Check if loaded kernel module list is changed, and check if any loaded module file is changed.
check_kmodules_modified()
{
+ local _module_file _time_stamp
+ local _modified_modules _added_modules _dropped_modules
+
# always sort again to avoid LANG/LC inconsistent problem
local _old_modules="$(lsinitrd $TARGET_INITRD -f /usr/lib/dracut/loaded-kernel-modules.txt | sort)"
local _new_modules="$(get_loaded_kernel_modules | sort)"
+ local _extra_modules="$(grep ^extra_modules $KDUMP_CONFIG_FILE | sed 's/^extra_modules\s*//')"
- [[ -z $_old_modules ]] && echo "Warning: Previous loaded kernel module list is absent or empty"
+ if [[ -z "$_old_modules" ]] && [[ -n "$_extra_modules" ]]; then
+ echo "Warning: Previous loaded kernel module list is absent or " \
+ "empty, and extra modules is set, forcing rebuild"
+ return 1
+ fi
- local _added_modules=$(comm -13 <(echo "$_old_modules") <(echo "$_new_modules"))
- local _dropped_modules=$(comm -23 <(echo "$_old_modules") <(echo "$_new_modules"))
+ _added_modules=$(comm -13 <(echo "$_old_modules") <(echo "$_new_modules"))
+ _dropped_modules=$(comm -23 <(echo "$_old_modules") <(echo "$_new_modules"))
+
+ # Check for any updated module
+ for _module in $(echo "$_old_modules $_extra_modules" | sort | uniq); do
+ _module_file="$(modinfo -k "$kdump_kver" -n "$_module" 2>/dev/null)"
+ if [[ $? -ne 0 ]]; then
+ # Ignore for now, maybe the module is a builtin,
+ # else dracut will print an error to let the user know
+ :
+ else
+ _time_stamp="$(stat -c "%Y" "$_module_file")"
+ if [ "$_time_stamp" -gt "$image_time" ]; then
+ _modified_modules+="$_module "
+ fi
+ fi
+ done
- if [ "$_old_modules" != "$_new_modules" ]; then
- echo "Detected change(s) of loaded kernel modules list:"
+ if [[ -n "$_modified_modules" ]] || [[ -n "$_added_modules" ]] || [[ -n "$_dropped_modules" ]]; then
+ echo "Detected change(s) of following kernel modules:"
+ [[ -n "$_modified_modules" ]] && for _module in $_modified_modules; do
+ echo " *$_module"
+ done
[[ -n $_added_modules ]] && for _module in $_added_modules; do
echo " +$_module"
done
@@ -538,7 +565,6 @@ check_system_modified()
check_rebuild()
{
- local extra_modules
local capture_capable_initrd="1"
local _force_rebuild force_rebuild="0"
local _force_no_rebuild force_no_rebuild="0"
@@ -578,10 +604,6 @@ check_rebuild()
return 0
fi
- #will rebuild every time if extra_modules are specified
- extra_modules=`grep ^extra_modules $KDUMP_CONFIG_FILE`
- [ -n "$extra_modules" ] && force_rebuild="1"
-
#check to see if dependent files has been modified
#since last build of the image file
if [ -f $TARGET_INITRD ]; then
--
2.20.1
4 years, 6 months
[PATCH v3 0/3] fadump: cleanup network configuration
by Hari Bathini
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. The first patch in this patch-set prefixes all
network related cmdline conf files with 'kdump' for graceful handling.
The second patch adds a dracut cmdline hook in the initrd to remove
network cmdline conf files while booting production kernel. The last
patch reverts an old commit that is no longer relevant with the
change in second patch.
---
Hari Bathini (3):
add kdump prefix to network cmdline config files
fadump: avoid renaming network interface name during regular boot
avoid network interface rename when unnecessary
dracut-kdump-boot.sh | 16 ++++++++++++++++
dracut-module-setup.sh | 31 ++++++++++++++-----------------
kexec-tools.spec | 3 +++
3 files changed, 33 insertions(+), 17 deletions(-)
create mode 100644 dracut-kdump-boot.sh
4 years, 6 months
[PATCH] kdump-lib-initramfs: print the systemd journal when kdump fails
by Pingfan Liu
It is helpful to dump the systemd journal when kdump fails, and save times.
Signed-off-by: Pingfan Liu <piliu(a)redhat.com>
---
kdump-lib-initramfs.sh | 1 +
1 file changed, 1 insertion(+)
diff --git a/kdump-lib-initramfs.sh b/kdump-lib-initramfs.sh
index d6c01d1..bc5d9f4 100755
--- a/kdump-lib-initramfs.sh
+++ b/kdump-lib-initramfs.sh
@@ -174,6 +174,7 @@ kdump_emergency_shell()
do_failure_action()
{
+ journalctl --full --no-pager
echo "Kdump: Executing failure action $FAILURE_ACTION"
eval $FAILURE_ACTION
}
--
2.7.4
4 years, 6 months