From 36c1159249cc19866dd6404d4c15ea60cba76799 Mon Sep 17 00:00:00 2001 From: Dave Young Date: Thu, 9 Nov 2017 13:42:16 +0800 Subject: [PATCH 01/23] Use absolute path /usr/bin/dracut in mkdumprd Since we call dracut directly on current working directory "." so it is possible to trick root to call fake code. Thus move to use absolute path instead. Signed-off-by: Dave Young Acked-by: Bhupesh Sharma --- mkdumprd | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/mkdumprd b/mkdumprd index 2f71f7b..d91be5d 100644 --- a/mkdumprd +++ b/mkdumprd @@ -17,6 +17,7 @@ SAVE_PATH=$(grep ^path $conf_file| cut -d' ' -f2) [ -z "$SAVE_PATH" ] && SAVE_PATH=$DEFAULT_PATH # strip the duplicated "/" SAVE_PATH=$(echo $SAVE_PATH | tr -s /) +DRACUT_PATH=/usr/bin is_wdt_addition_needed() { local active @@ -457,7 +458,7 @@ if ! is_fadump_capable; then add_dracut_arg "--no-hostonly-default-device" fi -dracut "${dracut_args[@]}" "$@" +${DRACUT_PATH}/dracut "${dracut_args[@]}" "$@" _rc=$? sync exit $_rc From cf2c8da395240e4533fe3bcee675b06ccd81d292 Mon Sep 17 00:00:00 2001 From: Dave Young Date: Thu, 9 Nov 2017 13:43:46 +0800 Subject: [PATCH 02/23] Release 2.0.15-13.1 --- kexec-tools.spec | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/kexec-tools.spec b/kexec-tools.spec index 292b689..dde98e1 100644 --- a/kexec-tools.spec +++ b/kexec-tools.spec @@ -1,6 +1,6 @@ Name: kexec-tools Version: 2.0.15 -Release: 13%{?dist} +Release: 13%{?dist}.1 License: GPLv2 Group: Applications/System Summary: The kexec/kdump userspace component @@ -317,6 +317,9 @@ done %doc %changelog +* Thu Nov 9 2017 Dave Young - 2.0.15-13.1 +- Use absolute path /usr/bin/dracut in mkdumprd + * Wed Sep 6 2017 Dave Young - 2.0.15-13 - dracut-module-setup.sh: eliminate redundant kdump_get_mac_addr call - mkdumprd: use --quiet dracut argument to speedup initramfs build From a4a1ee8267b72bde6b845faf8067d13c139d108a Mon Sep 17 00:00:00 2001 From: Dave Young Date: Thu, 9 Nov 2017 15:30:54 +0800 Subject: [PATCH 03/23] Revert "Use absolute path /usr/bin/dracut in mkdumprd" This reverts commit 36c1159249cc19866dd6404d4c15ea60cba76799. After reading the background of bugzilla: https://bugzilla.redhat.com/show_bug.cgi?id=1510922 It is not a problem actually, sorry for the noise. Although root set different "PATH" can lead to wrong script, but it is different with what the bug described "current working dir" and it is not a problem worth an update --- mkdumprd | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/mkdumprd b/mkdumprd index d91be5d..2f71f7b 100644 --- a/mkdumprd +++ b/mkdumprd @@ -17,7 +17,6 @@ SAVE_PATH=$(grep ^path $conf_file| cut -d' ' -f2) [ -z "$SAVE_PATH" ] && SAVE_PATH=$DEFAULT_PATH # strip the duplicated "/" SAVE_PATH=$(echo $SAVE_PATH | tr -s /) -DRACUT_PATH=/usr/bin is_wdt_addition_needed() { local active @@ -458,7 +457,7 @@ if ! is_fadump_capable; then add_dracut_arg "--no-hostonly-default-device" fi -${DRACUT_PATH}/dracut "${dracut_args[@]}" "$@" +dracut "${dracut_args[@]}" "$@" _rc=$? sync exit $_rc From 5b72833fbed3b4f95f5435ee266ea4e4a5993424 Mon Sep 17 00:00:00 2001 From: Dave Young Date: Thu, 9 Nov 2017 15:32:31 +0800 Subject: [PATCH 04/23] Release 2.0.15-13.2 --- kexec-tools.spec | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/kexec-tools.spec b/kexec-tools.spec index dde98e1..dd37406 100644 --- a/kexec-tools.spec +++ b/kexec-tools.spec @@ -1,6 +1,6 @@ Name: kexec-tools Version: 2.0.15 -Release: 13%{?dist}.1 +Release: 13%{?dist}.2 License: GPLv2 Group: Applications/System Summary: The kexec/kdump userspace component @@ -317,6 +317,9 @@ done %doc %changelog +* Thu Nov 9 2017 Dave Young - 2.0.15-13.2 +- Revert "Use absolute path /usr/bin/dracut in mkdumprd" + * Thu Nov 9 2017 Dave Young - 2.0.15-13.1 - Use absolute path /usr/bin/dracut in mkdumprd From b316bfa8e1da6d0477e8de3b0abe80c91efcb143 Mon Sep 17 00:00:00 2001 From: Dave Young Date: Tue, 21 Nov 2017 13:07:27 +0800 Subject: [PATCH 05/23] Revert "Release 2.0.15-13.2" This reverts commit 5b72833fbed3b4f95f5435ee266ea4e4a5993424. --- kexec-tools.spec | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/kexec-tools.spec b/kexec-tools.spec index dd37406..dde98e1 100644 --- a/kexec-tools.spec +++ b/kexec-tools.spec @@ -1,6 +1,6 @@ Name: kexec-tools Version: 2.0.15 -Release: 13%{?dist}.2 +Release: 13%{?dist}.1 License: GPLv2 Group: Applications/System Summary: The kexec/kdump userspace component @@ -317,9 +317,6 @@ done %doc %changelog -* Thu Nov 9 2017 Dave Young - 2.0.15-13.2 -- Revert "Use absolute path /usr/bin/dracut in mkdumprd" - * Thu Nov 9 2017 Dave Young - 2.0.15-13.1 - Use absolute path /usr/bin/dracut in mkdumprd From 35d31cea92b7bd0fa0aef2334e99bd875e0b4951 Mon Sep 17 00:00:00 2001 From: Dave Young Date: Tue, 21 Nov 2017 13:07:30 +0800 Subject: [PATCH 06/23] Revert "Revert "Use absolute path /usr/bin/dracut in mkdumprd"" This reverts commit a4a1ee8267b72bde6b845faf8067d13c139d108a. --- mkdumprd | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/mkdumprd b/mkdumprd index 2f71f7b..d91be5d 100644 --- a/mkdumprd +++ b/mkdumprd @@ -17,6 +17,7 @@ SAVE_PATH=$(grep ^path $conf_file| cut -d' ' -f2) [ -z "$SAVE_PATH" ] && SAVE_PATH=$DEFAULT_PATH # strip the duplicated "/" SAVE_PATH=$(echo $SAVE_PATH | tr -s /) +DRACUT_PATH=/usr/bin is_wdt_addition_needed() { local active @@ -457,7 +458,7 @@ if ! is_fadump_capable; then add_dracut_arg "--no-hostonly-default-device" fi -dracut "${dracut_args[@]}" "$@" +${DRACUT_PATH}/dracut "${dracut_args[@]}" "$@" _rc=$? sync exit $_rc From 55388d1a2a0e1b93aecca0e962fdc81009c93dca Mon Sep 17 00:00:00 2001 From: Dave Young Date: Tue, 21 Nov 2017 13:07:31 +0800 Subject: [PATCH 07/23] Revert "Release 2.0.15-13.1" This reverts commit cf2c8da395240e4533fe3bcee675b06ccd81d292. --- kexec-tools.spec | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/kexec-tools.spec b/kexec-tools.spec index dde98e1..292b689 100644 --- a/kexec-tools.spec +++ b/kexec-tools.spec @@ -1,6 +1,6 @@ Name: kexec-tools Version: 2.0.15 -Release: 13%{?dist}.1 +Release: 13%{?dist} License: GPLv2 Group: Applications/System Summary: The kexec/kdump userspace component @@ -317,9 +317,6 @@ done %doc %changelog -* Thu Nov 9 2017 Dave Young - 2.0.15-13.1 -- Use absolute path /usr/bin/dracut in mkdumprd - * Wed Sep 6 2017 Dave Young - 2.0.15-13 - dracut-module-setup.sh: eliminate redundant kdump_get_mac_addr call - mkdumprd: use --quiet dracut argument to speedup initramfs build From 2f82313fa3cf1556c840c7de5cce9c5cb4d8fecc Mon Sep 17 00:00:00 2001 From: Dave Young Date: Tue, 21 Nov 2017 13:07:32 +0800 Subject: [PATCH 08/23] Revert "Use absolute path /usr/bin/dracut in mkdumprd" This reverts commit 36c1159249cc19866dd6404d4c15ea60cba76799. --- mkdumprd | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/mkdumprd b/mkdumprd index d91be5d..2f71f7b 100644 --- a/mkdumprd +++ b/mkdumprd @@ -17,7 +17,6 @@ SAVE_PATH=$(grep ^path $conf_file| cut -d' ' -f2) [ -z "$SAVE_PATH" ] && SAVE_PATH=$DEFAULT_PATH # strip the duplicated "/" SAVE_PATH=$(echo $SAVE_PATH | tr -s /) -DRACUT_PATH=/usr/bin is_wdt_addition_needed() { local active @@ -458,7 +457,7 @@ if ! is_fadump_capable; then add_dracut_arg "--no-hostonly-default-device" fi -${DRACUT_PATH}/dracut "${dracut_args[@]}" "$@" +dracut "${dracut_args[@]}" "$@" _rc=$? sync exit $_rc From ed3e1c12488a53173478e96d377a9c0a2fc7fdae Mon Sep 17 00:00:00 2001 From: Dave Young Date: Tue, 21 Nov 2017 13:07:33 +0800 Subject: [PATCH 09/23] Revert "Release 2.0.15-13" This reverts commit 4594c9830dc646a2838bb1c9ea35c2979f328496. --- kexec-tools.spec | 22 +++------------------- 1 file changed, 3 insertions(+), 19 deletions(-) diff --git a/kexec-tools.spec b/kexec-tools.spec index 292b689..f356e32 100644 --- a/kexec-tools.spec +++ b/kexec-tools.spec @@ -1,6 +1,6 @@ Name: kexec-tools Version: 2.0.15 -Release: 13%{?dist} +Release: 12%{?dist} License: GPLv2 Group: Applications/System Summary: The kexec/kdump userspace component @@ -317,22 +317,6 @@ done %doc %changelog -* Wed Sep 6 2017 Dave Young - 2.0.15-13 -- dracut-module-setup.sh: eliminate redundant kdump_get_mac_addr call -- mkdumprd: use --quiet dracut argument to speedup initramfs build -- mkdumprd: fix patterns to modify mount options -- fadump: rebuild default initrd with dump capture capability -- module-setup: remove software iscsi cmdline generated by dracut -- kdumpctl: remove some cmdline inheritage from 1st kernel -- mkdumprd: apply dracut "--hostonly-cmdline" and "--no-hostonly-default-device" -- Change dump_to_rootfs to use "--mount" instead of "root=X" -- kdumpctl: move is_fadump_capable() to kdump-lib.sh -- Revert "kdumpctl: use generated rd.lvm.lv=X" -- Revert "mkdumprd: omit crypt when there is no crypt kdump target" -- Revert "mkdumprd: omit dracut modules in case of no dm target" -- Revert "mkdumprd: omit dracut modules in case of network dumping" -- update bogus date in rpm spec - * Thu Aug 17 2017 Dave Young - 2.0.15-12 - makedumpfile: fix 4.13 kernel larget vmcore bug - Revert "Improve 'cpu add' udev rules" @@ -361,7 +345,7 @@ done * Wed Jul 26 2017 Fedora Release Engineering - 2.0.15-5 - Rebuilt for https://fedoraproject.org/wiki/Fedora_27_Mass_Rebuild -* Wed Jul 19 2017 Dave Young - 2.0.15-4 +* Thu Jul 19 2017 Dave Young - 2.0.15-4 - mkdumprd: remove useless "x-initrd.mount" - kdumpctl: use "apicid" other than "initial apicid" @@ -379,7 +363,7 @@ done * Wed Jun 28 2017 Dave Young - 2.0.15-2 - enable makedumpfile for arm64 -* Fri Jun 23 2017 Dave Young - 2.0.15-1 +* Thu Jun 23 2017 Dave Young - 2.0.15-1 - rebase kexec-tools-2.0.15 * Thu Jun 15 2017 Dave Young - 2.0.14-13 From 552d4d51a6b766fbaaa6916a3b6c2cffbc09368e Mon Sep 17 00:00:00 2001 From: Dave Young Date: Tue, 21 Nov 2017 13:07:34 +0800 Subject: [PATCH 10/23] Revert "dracut-module-setup.sh: eliminate redundant kdump_get_mac_addr call" This reverts commit c05c8980629da24fa7fe19768476f4d622cf9a0b. --- dracut-module-setup.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/dracut-module-setup.sh b/dracut-module-setup.sh index 0c3609f..25bbbe7 100755 --- a/dracut-module-setup.sh +++ b/dracut-module-setup.sh @@ -276,12 +276,12 @@ kdump_setup_znet() { kdump_setup_netdev() { local _netdev=$1 _srcaddr=$2 local _static _proto _ip_conf _ip_opts _ifname_opts - local _netmac=$(kdump_get_mac_addr $_netdev) if [ "$(uname -m)" = "s390x" ]; then kdump_setup_znet $_netdev fi + _netmac=$(kdump_get_mac_addr $_netdev) _static=$(kdump_static_ip $_netdev $_srcaddr) if [ -n "$_static" ]; then _proto=none @@ -310,7 +310,7 @@ kdump_setup_netdev() { elif kdump_is_vlan "$_netdev"; then kdump_setup_vlan "$_netdev" else - _ifname_opts=" ifname=$(kdump_setup_ifname $_netdev):$_netmac" + _ifname_opts=" ifname=$(kdump_setup_ifname $_netdev):$(kdump_get_mac_addr $_netdev)" echo "$_ifname_opts" >> $_ip_conf fi From 201fe8c4425c859547d23ff28b64a7a4b19d8354 Mon Sep 17 00:00:00 2001 From: Dave Young Date: Tue, 21 Nov 2017 13:07:35 +0800 Subject: [PATCH 11/23] Revert "mkdumprd: use --quiet dracut argument to speedup initramfs build" This reverts commit 69ba16a409b1260ac3a5451ec5f3f2eac244b73c. --- mkdumprd | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mkdumprd b/mkdumprd index 2f71f7b..33d107f 100644 --- a/mkdumprd +++ b/mkdumprd @@ -37,7 +37,7 @@ is_wdt_addition_needed [[ $? -eq 0 ]] && WDTCFG="-a watchdog" extra_modules="" -dracut_args=("--quiet" "--hostonly" "--hostonly-cmdline" "--hostonly-i18n" "-o" "plymouth dash resume ifcfg" $WDTCFG) +dracut_args=("--hostonly" "--hostonly-cmdline" "--hostonly-i18n" "-o" "plymouth dash resume ifcfg" $WDTCFG) OVERRIDE_RESETTABLE=0 add_dracut_arg() { From b703267aa5665c8177afaf1908477b0f67c6b44b Mon Sep 17 00:00:00 2001 From: Dave Young Date: Tue, 21 Nov 2017 13:07:36 +0800 Subject: [PATCH 12/23] Revert "mkdumprd: fix patterns to modify mount options" This reverts commit 75ab9ee26aa03ead904890b6c56ab032c26bdad5. --- mkdumprd | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/mkdumprd b/mkdumprd index 33d107f..6df144b 100644 --- a/mkdumprd +++ b/mkdumprd @@ -101,9 +101,8 @@ to_mount() { [ -z "$_options" ] && _options=$(findmnt -k -f -n -r -o OPTIONS $_dev) # with 'noauto' in fstab nfs and non-root disk mount will fail in 2nd # kernel, filter it out here. - _options=$(echo $_options | sed 's/\bnoauto\b//') - #mount fs target as rw in 2nd kernel - _options=$(echo $_options | sed 's/\bro\b/rw/') + _options=$(echo $_options | sed 's/noauto//') + _options=${_options/#ro/rw} #mount fs target as rw in 2nd kernel _mntopts="$_target $_fstype $_options" #for non-nfs _dev converting to use udev persistent name From 2ecbf6a9890867e60d1e39d2be8311607e91d833 Mon Sep 17 00:00:00 2001 From: Dave Young Date: Tue, 21 Nov 2017 13:07:37 +0800 Subject: [PATCH 13/23] Revert "fadump: rebuild default initrd with dump capture capability" This reverts commit 601766a3d9a74e2708578286e6a2afddd8f72b95. --- kdumpctl | 10 ---------- 1 file changed, 10 deletions(-) diff --git a/kdumpctl b/kdumpctl index 7d06efe..1aceacf 100755 --- a/kdumpctl +++ b/kdumpctl @@ -6,7 +6,6 @@ KDUMP_COMMANDLINE="" KEXEC_ARGS="" KDUMP_CONFIG_FILE="/etc/kdump.conf" MKDUMPRD="/sbin/mkdumprd -f" -DRACUT_MODULES_FILE="/usr/lib/dracut/modules.txt" SAVE_PATH=/var/crash SSH_KEY_LOCATION="/root/.ssh/kdump_id_rsa" INITRD_CHECKSUM_LOCATION="/boot/.fadump_initrd_checksum" @@ -651,7 +650,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" local ret system_modified="0" @@ -706,12 +704,6 @@ check_rebuild() #since last build of the image file if [ -f $TARGET_INITRD ]; then image_time=`stat -c "%Y" $TARGET_INITRD 2>/dev/null` - - #in case of fadump mode, check whether the default/target - #initrd is already built with dump capture capability - if [ "$DEFAULT_DUMP_MODE" == "fadump" ]; then - capture_capable_initrd=$(lsinitrd -f $DRACUT_MODULES_FILE $TARGET_INITRD | grep ^kdumpbase$ | wc -l) - fi fi check_system_modified @@ -726,8 +718,6 @@ check_rebuild() if [ $image_time -eq 0 ]; then echo -n "No kdump initial ramdisk found."; echo - elif [ "$capture_capable_initrd" == "0" ]; then - echo -n "Rebuild $TARGET_INITRD with dump capture support"; echo elif [ "$force_rebuild" != "0" ]; then echo -n "Force rebuild $TARGET_INITRD"; echo elif [ "$system_modified" != "0" ]; then From 1be02523ade22cb98077bba7f5b08b84becdabdf Mon Sep 17 00:00:00 2001 From: Dave Young Date: Tue, 21 Nov 2017 13:07:37 +0800 Subject: [PATCH 14/23] Revert "module-setup: remove software iscsi cmdline generated by dracut" This reverts commit 3172bc0ef3d5ca89145a0a23746438a93680da17. --- dracut-module-setup.sh | 4 ---- 1 file changed, 4 deletions(-) diff --git a/dracut-module-setup.sh b/dracut-module-setup.sh index 25bbbe7..ae13337 100755 --- a/dracut-module-setup.sh +++ b/dracut-module-setup.sh @@ -555,10 +555,6 @@ kdump_setup_iscsi_device() { return fi - # Remove software iscsi cmdline generated by 95iscsi, - # and let kdump regenerate here. - rm -f ${initdir}/etc/cmdline.d/95iscsi.conf - tgt_name=$(kdump_iscsi_get_rec_val ${path} "node.name") tgt_ipaddr=$(kdump_iscsi_get_rec_val ${path} "node.conn\[0\].address") From 371d599b0d12d606948ad5a7f0a4e140098ef7a0 Mon Sep 17 00:00:00 2001 From: Dave Young Date: Tue, 21 Nov 2017 13:07:38 +0800 Subject: [PATCH 15/23] Revert "kdumpctl: remove some cmdline inheritage from 1st kernel" This reverts commit 2c9a863fd3f9c89d4b933e5f9f096df886e28c22. --- kdumpctl | 3 --- 1 file changed, 3 deletions(-) diff --git a/kdumpctl b/kdumpctl index 1aceacf..188c000 100755 --- a/kdumpctl +++ b/kdumpctl @@ -199,9 +199,6 @@ prepare_cmdline() # KDUMP_COMMANDLINE_APPEND. cmdline=$(remove_cmdline_param "$cmdline" root) - # With the help of "--hostonly-cmdline", we can avoid some interitage. - cmdline=$(remove_cmdline_param "$cmdline" rd.lvm.lv rd.luks.uuid rd.dm.uuid rd.md.uuid fcoe) - cmdline="${cmdline} ${KDUMP_COMMANDLINE_APPEND}" id=$(get_bootcpu_apicid) From cc319fa32262bda990688d52bcc54f84f62a38ef Mon Sep 17 00:00:00 2001 From: Dave Young Date: Tue, 21 Nov 2017 13:07:39 +0800 Subject: [PATCH 16/23] Revert "mkdumprd: apply dracut "--hostonly-cmdline" and "--no-hostonly-default-device"" This reverts commit e067d77dfc4581e3126ebdb8b297088be9d59fb6. --- kdump-lib.sh | 8 ++++++++ kexec-tools.spec | 2 +- mkdumprd | 4 +--- 3 files changed, 10 insertions(+), 4 deletions(-) diff --git a/kdump-lib.sh b/kdump-lib.sh index d981c4f..19d749f 100755 --- a/kdump-lib.sh +++ b/kdump-lib.sh @@ -186,6 +186,14 @@ get_kdump_targets() kdump_targets="$kdump_targets $_root" fi + # NOTE: + # dracut parses devices from "/etc/fstab" with the "x-initrd.mount" option, + # which will be added as host_devs, it also includes usually simple devices + # (say mounted to /boot, /boot/efi/, etc) plus the root device. Then kdump + # must wait for these devices if initramfs is built with "--hostonly-cmdline". + # + # We don't pass "--hostonly-cmdline" to dracut, so there's no problem. + echo "$kdump_targets" } diff --git a/kexec-tools.spec b/kexec-tools.spec index f356e32..1a37ef9 100644 --- a/kexec-tools.spec +++ b/kexec-tools.spec @@ -47,7 +47,7 @@ Requires(post): systemd-units Requires(preun): systemd-units Requires(postun): systemd-units Requires(pre): coreutils sed zlib -Requires: dracut >= 046-7 +Requires: dracut >= 044-117 Requires: dracut-network >= 044-117 Requires: ethtool BuildRequires: zlib-devel zlib zlib-static elfutils-devel-static glib2-devel bzip2-devel ncurses-devel bison flex lzo-devel snappy-devel diff --git a/mkdumprd b/mkdumprd index 6df144b..5342dac 100644 --- a/mkdumprd +++ b/mkdumprd @@ -37,7 +37,7 @@ is_wdt_addition_needed [[ $? -eq 0 ]] && WDTCFG="-a watchdog" extra_modules="" -dracut_args=("--hostonly" "--hostonly-cmdline" "--hostonly-i18n" "-o" "plymouth dash resume ifcfg" $WDTCFG) +dracut_args=("--hostonly" "--hostonly-i18n" "-o" "plymouth dash resume ifcfg" $WDTCFG) OVERRIDE_RESETTABLE=0 add_dracut_arg() { @@ -452,8 +452,6 @@ if ! is_fadump_capable; then # The 2nd rootfs mount stays behind the normal dump target mount, # so it doesn't affect the logic of check_dump_fs_modified(). is_dump_to_rootfs && add_mount "$(to_dev_name $(get_root_fs_device))" - - add_dracut_arg "--no-hostonly-default-device" fi dracut "${dracut_args[@]}" "$@" From b060f9f6b0216077f85d40ba6fae52f68d81a41a Mon Sep 17 00:00:00 2001 From: Dave Young Date: Tue, 21 Nov 2017 13:07:40 +0800 Subject: [PATCH 17/23] Revert "Change dump_to_rootfs to use "--mount" instead of "root=X"" This reverts commit 31dc60ad20abab2e8276678d0704a8f99875b294. --- kdumpctl | 17 ++++++++++------- mkdumprd | 6 ------ 2 files changed, 10 insertions(+), 13 deletions(-) diff --git a/kdumpctl b/kdumpctl index 188c000..51d586d 100755 --- a/kdumpctl +++ b/kdumpctl @@ -181,29 +181,32 @@ prepare_cmdline() local cmdline id if [ -z "$KDUMP_COMMANDLINE" ]; then - cmdline=$(cat /proc/cmdline) + cmdline=`cat /proc/cmdline` else cmdline=${KDUMP_COMMANDLINE} fi # These params should always be removed - cmdline=$(remove_cmdline_param "$cmdline" crashkernel panic_on_warn) + cmdline=`remove_cmdline_param "$cmdline" crashkernel panic_on_warn` # These params can be removed configurably - cmdline=$(remove_cmdline_param "$cmdline" ${KDUMP_COMMANDLINE_REMOVE}) + cmdline=`remove_cmdline_param "$cmdline" ${KDUMP_COMMANDLINE_REMOVE}` # Always remove "root=X", as we now explicitly generate all kinds - # of dump target mount information including root fs. + # of dump target mount information including root fs. But we can + # not remove it in case of fadump or "default dump_to_rootfs". # # We do this before KDUMP_COMMANDLINE_APPEND, if one really cares # about it(e.g. for debug purpose), then can pass "root=X" using # KDUMP_COMMANDLINE_APPEND. - cmdline=$(remove_cmdline_param "$cmdline" root) + if [ $DEFAULT_DUMP_MODE != "fadump" ] && ! is_dump_to_rootfs; then + cmdline=`remove_cmdline_param "$cmdline" root` + fi cmdline="${cmdline} ${KDUMP_COMMANDLINE_APPEND}" - id=$(get_bootcpu_apicid) + id=`get_bootcpu_apicid` if [ ! -z ${id} ] ; then - cmdline=$(append_cmdline "${cmdline}" disable_cpu_apicid ${id}) + cmdline=`append_cmdline "${cmdline}" disable_cpu_apicid ${id}` fi KDUMP_COMMANDLINE=$cmdline diff --git a/mkdumprd b/mkdumprd index 5342dac..9f375e0 100644 --- a/mkdumprd +++ b/mkdumprd @@ -448,12 +448,6 @@ then add_dracut_arg "--add-drivers" "$extra_modules" fi -if ! is_fadump_capable; then - # The 2nd rootfs mount stays behind the normal dump target mount, - # so it doesn't affect the logic of check_dump_fs_modified(). - is_dump_to_rootfs && add_mount "$(to_dev_name $(get_root_fs_device))" -fi - dracut "${dracut_args[@]}" "$@" _rc=$? sync From 9c5ac7478d6bb05ae18d8918a06385095268be13 Mon Sep 17 00:00:00 2001 From: Dave Young Date: Tue, 21 Nov 2017 13:07:41 +0800 Subject: [PATCH 18/23] Revert "kdumpctl: move is_fadump_capable() to kdump-lib.sh" This reverts commit d5fe9022d004318e441f2a4cd0b9e924af6292c3. --- kdump-lib.sh | 12 ------------ kdumpctl | 12 ++++++++++++ 2 files changed, 12 insertions(+), 12 deletions(-) diff --git a/kdump-lib.sh b/kdump-lib.sh index 19d749f..a33f172 100755 --- a/kdump-lib.sh +++ b/kdump-lib.sh @@ -6,18 +6,6 @@ DEFAULT_PATH="/var/crash/" FENCE_KDUMP_CONFIG_FILE="/etc/sysconfig/fence_kdump" FENCE_KDUMP_SEND="/usr/libexec/fence_kdump_send" -FADUMP_ENABLED_SYS_NODE="/sys/kernel/fadump_enabled" - -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 -eq 1 ] && return 0 - fi - return 1 -} perror_exit() { echo $@ >&2 diff --git a/kdumpctl b/kdumpctl index 51d586d..f172058 100755 --- a/kdumpctl +++ b/kdumpctl @@ -13,6 +13,7 @@ DUMP_TARGET="" DEFAULT_INITRD="" DEFAULT_INITRD_BAK="" TARGET_INITRD="" +FADUMP_ENABLED_SYS_NODE="/sys/kernel/fadump_enabled" FADUMP_REGISTER_SYS_NODE="/sys/kernel/fadump_registered" #kdump shall be the default dump mode DEFAULT_DUMP_MODE="kdump" @@ -892,6 +893,17 @@ handle_mode_switch() fi } +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 -eq 1 ] && return 0 + fi + return 1 +} + check_current_fadump_status() { # Check if firmware-assisted dump has been registered. From 59a87a4011006002b249755b19dbe35b6c7d50c4 Mon Sep 17 00:00:00 2001 From: Dave Young Date: Tue, 21 Nov 2017 13:07:42 +0800 Subject: [PATCH 19/23] Revert "Revert "kdumpctl: use generated rd.lvm.lv=X"" This reverts commit 1bd757bc9642cac081c06b0d0b572a66a013d63a. --- kdumpctl | 47 +++++++++++++++++++++++++++++++++++++++++++++-- 1 file changed, 45 insertions(+), 2 deletions(-) diff --git a/kdumpctl b/kdumpctl index f172058..6a275e8 100755 --- a/kdumpctl +++ b/kdumpctl @@ -175,6 +175,45 @@ check_kdump_cpus() echo " try nr_cpus=$nr_min or larger instead" } +# Generate rd.lvm.lv=X for the kdump targets if any. +generate_lvm_cmdlines() +{ + local lvm_cmdlines="" + + generate_lvm_cmdline() { + local majmin=$1 dev + + [ -d "/sys/dev/block/$majmin/dm" ] || return 0 + dev=/dev/mapper/$(< "/sys/dev/block/$majmin/dm/name") + + vg=$(lvm lvs --rows $dev -o vg_name --separator=* 2>/dev/null | cut -d "*" -f 2) + lv=$(lvm lvs --rows $dev -o lv_name --separator=* 2>/dev/null | cut -d "*" -f 2) + if [ -n "$vg" -a -n "$lv" ]; then + lvm_cmdlines="rd.lvm.lv=$vg/$lv $lvm_cmdlines" + fi + + return 0 + } + + for_each_block_target_all generate_lvm_cmdline + + echo "$lvm_cmdlines" +} + +# $1: function name +for_each_block_target_all() +{ + local dev majmin + + for dev in $(get_kdump_targets); do + [ -b "$dev" ] || continue + majmin=$(get_maj_min $dev) + check_block_and_slaves_all $1 $majmin + done + + return 0 +} + # This function performs a series of edits on the command line. # Store the final result in global $KDUMP_COMMANDLINE. prepare_cmdline() @@ -194,15 +233,19 @@ prepare_cmdline() # Always remove "root=X", as we now explicitly generate all kinds # of dump target mount information including root fs. But we can - # not remove it in case of fadump or "default dump_to_rootfs". + # not remove it in case of "default dump_to_rootfs". # # We do this before KDUMP_COMMANDLINE_APPEND, if one really cares # about it(e.g. for debug purpose), then can pass "root=X" using # KDUMP_COMMANDLINE_APPEND. - if [ $DEFAULT_DUMP_MODE != "fadump" ] && ! is_dump_to_rootfs; then + if ! is_dump_to_rootfs; then cmdline=`remove_cmdline_param "$cmdline" root` fi + # Remove all the inherited rd.lvm.lv=X and generate those as needed. + cmdline=`remove_cmdline_param "$cmdline" rd.lvm.lv` + cmdline="${cmdline} $(generate_lvm_cmdlines)" + cmdline="${cmdline} ${KDUMP_COMMANDLINE_APPEND}" id=`get_bootcpu_apicid` From fed96039e2fade4ba50959ef5df74d10756061df Mon Sep 17 00:00:00 2001 From: Dave Young Date: Tue, 21 Nov 2017 13:07:43 +0800 Subject: [PATCH 20/23] Revert "Revert "mkdumprd: omit crypt when there is no crypt kdump target"" This reverts commit 8250f23c10639faedcd3f3d4015d293a844cd241. --- kdump-lib.sh | 12 ++++++++++++ kdumpctl | 12 ------------ mkdumprd | 15 +++++++++++++++ 3 files changed, 27 insertions(+), 12 deletions(-) diff --git a/kdump-lib.sh b/kdump-lib.sh index a33f172..3f0af91 100755 --- a/kdump-lib.sh +++ b/kdump-lib.sh @@ -6,6 +6,7 @@ DEFAULT_PATH="/var/crash/" FENCE_KDUMP_CONFIG_FILE="/etc/sysconfig/fence_kdump" FENCE_KDUMP_SEND="/usr/libexec/fence_kdump_send" +FADUMP_ENABLED_SYS_NODE="/sys/kernel/fadump_enabled" perror_exit() { echo $@ >&2 @@ -481,3 +482,14 @@ get_dracut_args_target() { echo $1 | grep "\-\-mount" | sed "s/.*--mount .\(.*\)/\1/" | cut -d' ' -f1 } + +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 -eq 1 ] && return 0 + fi + return 1 +} diff --git a/kdumpctl b/kdumpctl index 6a275e8..b7a3105 100755 --- a/kdumpctl +++ b/kdumpctl @@ -13,7 +13,6 @@ DUMP_TARGET="" DEFAULT_INITRD="" DEFAULT_INITRD_BAK="" TARGET_INITRD="" -FADUMP_ENABLED_SYS_NODE="/sys/kernel/fadump_enabled" FADUMP_REGISTER_SYS_NODE="/sys/kernel/fadump_registered" #kdump shall be the default dump mode DEFAULT_DUMP_MODE="kdump" @@ -936,17 +935,6 @@ handle_mode_switch() fi } -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 -eq 1 ] && return 0 - fi - return 1 -} - check_current_fadump_status() { # Check if firmware-assisted dump has been registered. diff --git a/mkdumprd b/mkdumprd index 9f375e0..8a2fe74 100644 --- a/mkdumprd +++ b/mkdumprd @@ -359,11 +359,24 @@ check_crypt() return 1 } +crypt_exists=0 +omit_dracut_modules() +{ + # Skip fadump case + is_fadump_capable && return + + # Omit "crypt", BZ1451717 + if [ "$crypt_exists" == "0" ]; then + add_dracut_arg "--omit" "crypt" + fi +} + if ! check_resettable; then exit 1 fi if ! check_crypt; then + crypt_exists=1 echo "Warning: Encrypted device is in dump path. User will prompted for password during second kernel boot." fi @@ -448,6 +461,8 @@ then add_dracut_arg "--add-drivers" "$extra_modules" fi +omit_dracut_modules + dracut "${dracut_args[@]}" "$@" _rc=$? sync From 14251ce101b1cd7b27059521e4922833bda380b1 Mon Sep 17 00:00:00 2001 From: Dave Young Date: Tue, 21 Nov 2017 13:07:44 +0800 Subject: [PATCH 21/23] Revert "Revert "mkdumprd: omit dracut modules in case of no dm target"" This reverts commit dcffd4759e56169d5f8f1522c84f9fb0a0de7715. --- mkdumprd | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) diff --git a/mkdumprd b/mkdumprd index 8a2fe74..68fe6e8 100644 --- a/mkdumprd +++ b/mkdumprd @@ -359,16 +359,44 @@ check_crypt() return 1 } +is_dm() +{ + if [ -d "/sys/dev/block/$1/dm" ]; then + return 0 + fi + + return 1 +} + crypt_exists=0 omit_dracut_modules() { + local target majmin + local dm_exists + # Skip fadump case is_fadump_capable && return + dm_exists=0 + + for target in $(get_kdump_targets); do + if [ -b "$target" ]; then + majmin=$(get_maj_min $target) + # Check "dm" + check_block_and_slaves is_dm $majmin && dm_exists=1 + fi + done + # Omit "crypt", BZ1451717 if [ "$crypt_exists" == "0" ]; then add_dracut_arg "--omit" "crypt" fi + + # Further omit more modules in case of no dm related target + if [ "$dm_exists" == "0" ]; then + # "dm_exists=0" implies "crypt_exists=0" + add_dracut_arg "--omit" "lvm dm multipath dmraid" + fi } if ! check_resettable; then From ea6bdc43219f296e0cbbd84c7568dc08804558d5 Mon Sep 17 00:00:00 2001 From: Dave Young Date: Tue, 21 Nov 2017 13:07:46 +0800 Subject: [PATCH 22/23] Revert "Revert "mkdumprd: omit dracut modules in case of network dumping"" This reverts commit 2c9128a9715ed012cdea9e2d7cf21d250574bbe6. --- mkdumprd | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/mkdumprd b/mkdumprd index 68fe6e8..d3ecbd6 100644 --- a/mkdumprd +++ b/mkdumprd @@ -372,12 +372,13 @@ crypt_exists=0 omit_dracut_modules() { local target majmin - local dm_exists + local dm_exists network_only # Skip fadump case is_fadump_capable && return dm_exists=0 + network_only=1 for target in $(get_kdump_targets); do if [ -b "$target" ]; then @@ -385,6 +386,9 @@ omit_dracut_modules() # Check "dm" check_block_and_slaves is_dm $majmin && dm_exists=1 fi + + # Check nfs/ssh dumping + [[ "$target" != "nfs" && "$target" != "ssh" ]] && network_only=0 done # Omit "crypt", BZ1451717 @@ -397,6 +401,12 @@ omit_dracut_modules() # "dm_exists=0" implies "crypt_exists=0" add_dracut_arg "--omit" "lvm dm multipath dmraid" fi + + # Further omit more modules in case of nfs/ssh dumping + if [ "$network_only" == "1" ]; then + # "network_only=1" implies "dm_exists=0" + add_dracut_arg "--omit" "iscsi fcoe fcoe-uefi" + fi } if ! check_resettable; then From 666903c385ecc819ccedd902db391f04b0b1898f Mon Sep 17 00:00:00 2001 From: Dave Young Date: Tue, 21 Nov 2017 13:13:10 +0800 Subject: [PATCH 23/23] Release 2.0.15-12.1 Revert a series of patches for dracut new option "--no-hostonly-default-device" since dracut has not backported them to f27. Signed-off-by: Dave Young --- kexec-tools.spec | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/kexec-tools.spec b/kexec-tools.spec index 1a37ef9..a09a8dd 100644 --- a/kexec-tools.spec +++ b/kexec-tools.spec @@ -1,6 +1,6 @@ Name: kexec-tools Version: 2.0.15 -Release: 12%{?dist} +Release: 12%{?dist}.1 License: GPLv2 Group: Applications/System Summary: The kexec/kdump userspace component @@ -317,6 +317,9 @@ done %doc %changelog +* Tue Nov 21 2017 Dave Young - 2.0.15-12.1 +- revert a series of patches to use --no-hostonly-default-device since dracut has not backport the support in f27 + * Thu Aug 17 2017 Dave Young - 2.0.15-12 - makedumpfile: fix 4.13 kernel larget vmcore bug - Revert "Improve 'cpu add' udev rules"