Compare commits

...

23 Commits
rawhide ... f27

Author SHA1 Message Date
Dave Young 666903c385 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 <dyoung@redhat.com>
2017-11-21 13:13:10 +08:00
Dave Young ea6bdc4321 Revert "Revert "mkdumprd: omit dracut modules in case of network dumping""
This reverts commit 2c9128a971.
2017-11-21 13:07:46 +08:00
Dave Young 14251ce101 Revert "Revert "mkdumprd: omit dracut modules in case of no dm target""
This reverts commit dcffd4759e.
2017-11-21 13:07:44 +08:00
Dave Young fed96039e2 Revert "Revert "mkdumprd: omit crypt when there is no crypt kdump target""
This reverts commit 8250f23c10.
2017-11-21 13:07:43 +08:00
Dave Young 59a87a4011 Revert "Revert "kdumpctl: use generated rd.lvm.lv=X""
This reverts commit 1bd757bc96.
2017-11-21 13:07:42 +08:00
Dave Young 9c5ac7478d Revert "kdumpctl: move is_fadump_capable() to kdump-lib.sh"
This reverts commit d5fe9022d0.
2017-11-21 13:07:41 +08:00
Dave Young b060f9f6b0 Revert "Change dump_to_rootfs to use "--mount" instead of "root=X""
This reverts commit 31dc60ad20.
2017-11-21 13:07:40 +08:00
Dave Young cc319fa322 Revert "mkdumprd: apply dracut "--hostonly-cmdline" and "--no-hostonly-default-device""
This reverts commit e067d77dfc.
2017-11-21 13:07:39 +08:00
Dave Young 371d599b0d Revert "kdumpctl: remove some cmdline inheritage from 1st kernel"
This reverts commit 2c9a863fd3.
2017-11-21 13:07:38 +08:00
Dave Young 1be02523ad Revert "module-setup: remove software iscsi cmdline generated by dracut"
This reverts commit 3172bc0ef3.
2017-11-21 13:07:37 +08:00
Dave Young 2ecbf6a989 Revert "fadump: rebuild default initrd with dump capture capability"
This reverts commit 601766a3d9.
2017-11-21 13:07:37 +08:00
Dave Young b703267aa5 Revert "mkdumprd: fix patterns to modify mount options"
This reverts commit 75ab9ee26a.
2017-11-21 13:07:36 +08:00
Dave Young 201fe8c442 Revert "mkdumprd: use --quiet dracut argument to speedup initramfs build"
This reverts commit 69ba16a409.
2017-11-21 13:07:35 +08:00
Dave Young 552d4d51a6 Revert "dracut-module-setup.sh: eliminate redundant kdump_get_mac_addr call"
This reverts commit c05c898062.
2017-11-21 13:07:34 +08:00
Dave Young ed3e1c1248 Revert "Release 2.0.15-13"
This reverts commit 4594c9830d.
2017-11-21 13:07:33 +08:00
Dave Young 2f82313fa3 Revert "Use absolute path /usr/bin/dracut in mkdumprd"
This reverts commit 36c1159249.
2017-11-21 13:07:32 +08:00
Dave Young 55388d1a2a Revert "Release 2.0.15-13.1"
This reverts commit cf2c8da395.
2017-11-21 13:07:31 +08:00
Dave Young 35d31cea92 Revert "Revert "Use absolute path /usr/bin/dracut in mkdumprd""
This reverts commit a4a1ee8267.
2017-11-21 13:07:30 +08:00
Dave Young b316bfa8e1 Revert "Release 2.0.15-13.2"
This reverts commit 5b72833fbe.
2017-11-21 13:07:27 +08:00
Dave Young 5b72833fbe Release 2.0.15-13.2 2017-11-09 15:32:31 +08:00
Dave Young a4a1ee8267 Revert "Use absolute path /usr/bin/dracut in mkdumprd"
This reverts commit 36c1159249.

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
2017-11-09 15:30:54 +08:00
Dave Young cf2c8da395 Release 2.0.15-13.1 2017-11-09 13:47:53 +08:00
Dave Young 36c1159249 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 <dyoung@redhat.com>
Acked-by: Bhupesh Sharma <bhsharma@redhat.com>
2017-11-09 13:46:57 +08:00
5 changed files with 134 additions and 66 deletions

View File

@ -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
@ -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")

View File

@ -8,17 +8,6 @@ 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
exit 1
@ -186,6 +175,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"
}
@ -485,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
}

View File

@ -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"
@ -175,6 +174,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()
@ -182,32 +220,36 @@ 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 "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 ! is_dump_to_rootfs; then
cmdline=`remove_cmdline_param "$cmdline" root`
fi
# 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)
# 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)
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
@ -651,7 +693,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 +747,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 +761,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

View File

@ -1,6 +1,6 @@
Name: kexec-tools
Version: 2.0.15
Release: 13%{?dist}
Release: 12%{?dist}.1
License: GPLv2
Group: Applications/System
Summary: The kexec/kdump userspace component
@ -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
@ -317,21 +317,8 @@ done
%doc
%changelog
* Wed Sep 6 2017 Dave Young <dyoung@redhat.com> - 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
* Tue Nov 21 2017 Dave Young <dyoung@redhat.com> - 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 <dyoung@redhat.com> - 2.0.15-12
- makedumpfile: fix 4.13 kernel larget vmcore bug
@ -361,7 +348,7 @@ done
* Wed Jul 26 2017 Fedora Release Engineering <releng@fedoraproject.org> - 2.0.15-5
- Rebuilt for https://fedoraproject.org/wiki/Fedora_27_Mass_Rebuild
* Wed Jul 19 2017 Dave Young <dyoung@redhat.com> - 2.0.15-4
* Thu Jul 19 2017 Dave Young <dyoung@redhat.com> - 2.0.15-4
- mkdumprd: remove useless "x-initrd.mount"
- kdumpctl: use "apicid" other than "initial apicid"
@ -379,7 +366,7 @@ done
* Wed Jun 28 2017 Dave Young <dyoung@redhat.com> - 2.0.15-2
- enable makedumpfile for arm64
* Fri Jun 23 2017 Dave Young <dyoung@redhat.com> - 2.0.15-1
* Thu Jun 23 2017 Dave Young <dyoung@redhat.com> - 2.0.15-1
- rebase kexec-tools-2.0.15
* Thu Jun 15 2017 Dave Young <dyoung@redhat.com> - 2.0.14-13

View File

@ -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-i18n" "-o" "plymouth dash resume ifcfg" $WDTCFG)
OVERRIDE_RESETTABLE=0
add_dracut_arg() {
@ -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
@ -360,11 +359,62 @@ 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 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
majmin=$(get_maj_min $target)
# 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
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
# 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
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
@ -449,13 +499,7 @@ 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))"
add_dracut_arg "--no-hostonly-default-device"
fi
omit_dracut_modules
dracut "${dracut_args[@]}" "$@"
_rc=$?