diff --git a/kdump-Restore-only-static-routes-in-kdump-initrd.patch b/kdump-Restore-only-static-routes-in-kdump-initrd.patch new file mode 100644 index 0000000..727ea2b --- /dev/null +++ b/kdump-Restore-only-static-routes-in-kdump-initrd.patch @@ -0,0 +1,130 @@ +From: Petr Tesarik +Date: Thu, 24 May 2018 06:54:28 +0200 +Subject: Restore only static routes in kdump initrd +References: bsc#1093795 +Upstream: merged +Git-commit: c4484c33a5b228d4a1ebe7c99f14c3b7f38f34ef + +All existing routes are now added through the rd.route= dracut +parameter. However, this includes routes that need not or should not +be added explicitly (e.g. installed automatically by the kernel or +dynamically by a routing daemon). + +If possible, use wicked to get configured routes. If not, use the +routing protocol identifier to limit the list. + +Signed-off-by: Petr Tesarik +--- + init/setup-kdump.functions | 86 ++++++++++++++++++++++++++++++++++++++++----- + 1 file changed, 77 insertions(+), 9 deletions(-) + +--- a/init/setup-kdump.functions ++++ b/init/setup-kdump.functions +@@ -518,6 +518,42 @@ kdump_prefix2netmask() { # {{{ + } # }}} + + # ++# Get the IPv4 rd.route= parameters for a given device ++# ++# Parameters: ++# 1) iface current interface name ++# 2) bootif interface name in initrd ++# Output: ++# string that can be used for the rd.route= initrd parameter ++function kdump_ip_routes() # {{{ ++{ ++ local _iface="$1" ++ local _bootif="$2" ++ ++ # remove default routes ++ local _rmdefault='/^default /d' ++ # transform the output of "ip route" into rd.route= ++ local _xform='s/\([^ ]*\)\( via \([^ ]*\)\)\?.*/rd.route=\1:\3/' ++ # add interface name and print ++ local _addintf="s/\$/:${_bootif}/p" ++ ++ # get configured routes using wicked if possible ++ if [ -n "$(type -P wicked)" ] ++ then ++ wicked show-config | \ ++ wicked xpath --reference \ ++ "/interface[name='$_iface']/ipv4:static/route" \ ++ "rd.route=%{destination}:%{?nexthop/gateway}:$_bootif" \ ++ 2>/dev/null ++ else ++ ip route show dev "$_iface" proto boot | \ ++ sed -ne "$_rmdefault;$_xform;$_addintf" ++ ip route show dev "$_iface" proto static | \ ++ sed -ne "$_rmdefault;$_xform;$_addintf" ++ fi ++} # }}} ++ ++# + # Get the IPv4 ip= parameter for a given device + # + # Parameters: +@@ -556,12 +592,47 @@ function kdump_ip_config() # {{{ + + if [ -n "$ipaddr" ] ; then + echo "ip=$ipaddr:$peeraddr:$gwaddr:$netmask:$hostname:$bootif:none" ++ kdump_ip_routes "$iface" "$bootif" ++ fi ++} # }}} ++ ++# ++# Get the IPv6 rd.route= parameters for a given device ++# ++# Parameters: ++# 1) iface current interface name ++# 2) bootif interface name in initrd ++# Output: ++# string that can be used for the rd.route= initrd parameter ++function kdump_ip6_routes() # {{{ ++{ ++ local _iface="$1" ++ local _bootif="$2" + +- routes=$(ip route show dev "$iface" | sed -n 's/\([0-9].*\) via \([^ ]*\).*/\1:\2/p') +- for r in $routes ; do +- echo "rd.route=$r:$bootif" +- done +- fi ++ # remove default routes ++ local _rmdefault='/^default /d' ++ # transform the output of "ip route" into rd.route= ++ local _xform='s/\([^ ]*\)\( via \([^ ]*\)\)\?.*/rd.route=[\1]:[\3]/' ++ # remove gateway if empty ++ local _rmgw='s/\[\]$//' ++ # add interface name and print ++ local _addintf="s/\$/:${_bootif}/p" ++ ++ # get configured routes using wicked if possible ++ if [ -n "$(type -P wicked)" ] ++ then ++ wicked show-config | \ ++ wicked xpath \ ++ --reference "/interface[name='$_iface']/ipv6:static/route" \ ++ "rd.route=[%{destination}]:[%{?nexthop/gateway}]" \ ++ 2>/dev/null | \ ++ sed -ne "$_rmgw;$_addintf" ++ else ++ ip -6 route show dev "$_iface" proto boot | \ ++ sed -ne "$_rmdefault;$_xform;$_rmgw;$_addintf" ++ ip -6 route show dev "$_iface" proto static | \ ++ sed -ne "$_rmdefault;$_xform;$_rmgw;$_addintf" ++ fi + } # }}} + + # +@@ -604,10 +675,7 @@ function kdump_ip6_config() # {{ + echo "ip=$ipaddr:$peeraddr:$gwaddr:$netmask:$hostname:$bootif:none" + done < <(ip -6 address show dev "$iface" permanent scope global) + +- routes=$(ip -6 route show dev "$iface" | sed -n 's/\([0-9a-fA-F:].*\) via \([^ ]*\).*/[\1]:[\2]/p') +- for r in $routes ; do +- echo "rd.route=$r:$bootif" +- done ++ kdump_ip6_routes "$iface" "$bootif" + } # }}} + + # diff --git a/kdump-fallback-re-register-fadump-from-userspace.patch b/kdump-fallback-re-register-fadump-from-userspace.patch new file mode 100644 index 0000000..9903049 --- /dev/null +++ b/kdump-fallback-re-register-fadump-from-userspace.patch @@ -0,0 +1,48 @@ +From 4084339bb6e7c605dab7a48a98b97510f555d343 Mon Sep 17 00:00:00 2001 +From: Hari Bathini +Date: Thu, 27 Sep 2018 17:11:58 +0200 +Subject: Re-register FADUMP from userspace if the kernel cannot do it +Reference: bsc#1108170, LTC#171288, bsc#1094016, LTC#168050 +Upstream: merged +Git-commit: 4084339bb6e7c605dab7a48a98b97510f555d343 + +If the kernel does not allow writing a "1" to fadump_registered, +unregister and register again from userspace. + +Signed-off-by: Hari Bathini +Acked-by: Petr Tesarik +--- + init/load.sh | 21 +++++++++++++-------- + 1 file changed, 13 insertions(+), 8 deletions(-) + +--- a/init/load.sh ++++ b/init/load.sh +@@ -251,15 +251,20 @@ function load_kdump_fadump() + if [ $? -eq 0 ] ; then + msg="Registered fadump" + else +- # For backward compatibility on older kernel that +- # returns -EEXIST/-EINVAL ++ msg="FAILED to register fadump: $output" ++ result=1 ++ ++ # For re-registering on an older kernel that returns -EEXIST/-EINVAL, ++ # if fadump was already registered. + if [ "$(cat $FADUMP_REGISTERED)" == "1" ] ; then +- # TODO: unregiser/register OR warn user to stop/start? +- # Best bet is to update to latest kernel. +- msg="fadump is already registered" +- else +- msg="FAILED to register fadump: $output" +- result=1 ++ echo 0 > "$FADUMP_REGISTERED" ++ output=$( (echo 1 > "$FADUMP_REGISTERED") 2>&1) ++ if [ $? -eq 0 ] ; then ++ msg="Registered fadump" ++ result=0 ++ else ++ msg="FAILED to register fadump: $output" ++ fi + fi + fi + diff --git a/kdump-fix-multipath-user_friendly_names.patch b/kdump-fix-multipath-user_friendly_names.patch new file mode 100644 index 0000000..0122b5f --- /dev/null +++ b/kdump-fix-multipath-user_friendly_names.patch @@ -0,0 +1,30 @@ +From: Petr Tesarik +Date: Thu, 25 Oct 2018 10:02:43 +0200 +Subject: Fix multipath configuration with user_friendly_names and/or aliases +References: bsc#1111207, LTC#171953, bsc#1125218, LTC#175465 +Upstream: merged +Git-commit: 4b4dacfddd456a51c04a878e31d4544223ea9701 + +The setup script incorrectly uses the name of the multipath device +instead of its WWID (which can be retrieved from the device mapper +UUID simply by removing the "mpath-" prefix). + +Signed-off-by: Petr Tesarik +--- + init/setup-kdump.functions | 4 ++-- + 1 file changed, 2 insertions(+), 2 deletions(-) + +--- a/init/setup-kdump.functions ++++ b/init/setup-kdump.functions +@@ -962,9 +962,9 @@ function kdump_map_mpath_wwid() + local f _dir _uuid _wwid _dev + for f in /sys/block/*/dm/uuid ; do + eval "_uuid=\$(<$f)" 2>/dev/null +- [[ "$_uuid" = mpath-* ]] || continue ++ _wwid="${_uuid#mpath-}" ++ [ "$_wwid" != "$_uuid" ] || continue + _dir="${f%/dm/uuid}" +- _wwid=$(<"$_dir"/dm/name) + _dev=$(<"$_dir"/dev) + eval kdump_mpath_wwid_${_dev/:/_}=\$_wwid + done diff --git a/kdump-on-error-option-yesno.patch b/kdump-on-error-option-yesno.patch new file mode 100644 index 0000000..89bc8de --- /dev/null +++ b/kdump-on-error-option-yesno.patch @@ -0,0 +1,48 @@ +From: Lance Wang +Subject: Support yes/no style for KDUMP_CONTINUE_ON_ERROR +References: bsc#1083155 +Upstream: tbd + +The /etc/sysconfig/kdump in latest kdump initrd is generated by +kdumptool. So the value of KDUMP_CONTINUE_ON_ERROR is yes instead +of true. This patch make save_dump.sh support this value. + +Signed-off-by: Lance Wang +Acked-by: Petr Tesarik + +--- + init/save_dump.sh | 22 +++++++++++++--------- + 1 file changed, 13 insertions(+), 9 deletions(-) + +--- a/init/save_dump.sh ++++ b/init/save_dump.sh +@@ -101,16 +101,20 @@ function continue_error() + + echo "Last command failed ($status)." + +- if ! [ "$KDUMP_CONTINUE_ON_ERROR" = "true" -o \ +- "$KDUMP_CONTINUE_ON_ERROR" = "TRUE" ] ; then +- echo +- echo "Something failed. You can try to debug that here." +- echo "Type 'reboot -f' to reboot the system or 'exit' to" +- echo "boot in a normal system that still is running in the" +- echo "kdump environment with restricted memory!" +- bash +- return 1 ++ if [ "$KDUMP_CONTINUE_ON_ERROR" = "yes" -o \ ++ "$KDUMP_CONTINUE_ON_ERROR" = "YES" -o \ ++ "$KDUMP_CONTINUE_ON_ERROR" = "true" -o \ ++ "$KDUMP_CONTINUE_ON_ERROR" = "TRUE" ]; then ++ return 0 + fi ++ ++ echo ++ echo "Something failed. You can try to debug that here." ++ echo "Type 'reboot -f' to reboot the system or 'exit' to" ++ echo "boot in a normal system that still is running in the" ++ echo "kdump environment with restricted memory!" ++ bash ++ return 1 + } + + function rw_fixup() diff --git a/kdump-recover-from-missing-CRASHTIME.patch b/kdump-recover-from-missing-CRASHTIME.patch new file mode 100644 index 0000000..b2c03fd --- /dev/null +++ b/kdump-recover-from-missing-CRASHTIME.patch @@ -0,0 +1,49 @@ +From: Petr Tesarik +Subject: Recover from missing CRASHTIME= in VMCOREINFO +References: bsc#1112387 +Upstream: merged +Git-commit: 0bc94943a1df4d923aa20b9bd1ff01ed2e49d70c + +CRASHTIME= may be missing in Xen Dom0 dumps. +Vmcoreinfo::getLLongValue throws an exception in that case, but then +OSRELEASE will not even be attempted. Consequently, kernel and +system map files are not copied, producing the following message: + +INFO: Don't copy the kernel and System.map because of missing crash kernel release. + +Signed-off-by: Petr Tesarik +--- + kdumptool/savedump.cc | 20 +++++++++++++++----- + 1 file changed, 15 insertions(+), 5 deletions(-) + +--- a/kdumptool/savedump.cc ++++ b/kdumptool/savedump.cc +@@ -469,13 +469,23 @@ void SaveDump::fillVmcoreinfo() + { + Vmcoreinfo vm; + vm.readFromELF(m_dump.c_str()); +- unsigned long long time = vm.getLLongValue("CRASHTIME"); ++ unsigned long long crashtime; + +- m_crashtime = Stringutil::formatUnixTime("%Y-%m-%d %H:%M (%z)", time); ++ try { ++ crashtime = vm.getLLongValue("CRASHTIME"); ++ } catch (const KError &error) { ++ Debug::debug()->dbg("Error getting CRASHTIME: %s", error.what()); ++ crashtime = time(NULL); ++ } ++ m_crashtime = Stringutil::formatUnixTime("%Y-%m-%d %H:%M (%z)", crashtime); + +- // don't overwrite m_crashrelease from command line +- if (m_crashrelease.size() == 0) +- m_crashrelease = vm.getStringValue("OSRELEASE"); ++ try { ++ // don't overwrite m_crashrelease from command line ++ if (m_crashrelease.size() == 0) ++ m_crashrelease = vm.getStringValue("OSRELEASE"); ++ } catch (const KError &error) { ++ Debug::debug()->dbg("Error getting OSRELEASE: %s", error.what()); ++ } + + Debug::debug()->dbg("Using crashtime: %s, crashrelease: %s", + m_crashtime.c_str(), m_crashrelease.c_str()); diff --git a/kdump-use-pbl.patch b/kdump-use-pbl.patch new file mode 100644 index 0000000..355de53 --- /dev/null +++ b/kdump-use-pbl.patch @@ -0,0 +1,100 @@ +Date: Mon Jul 2 18:12:34 2018 +0200 +From: Michal Koutný +Subject: Replace obsolete perl-Bootloader library with a simpler script +References: bsc#1050349 +Upstream: tbd + +Signed-off-by: Michal Koutný +Acked-by: Petr Tesarik + +--- + init/CMakeLists.txt | 1 + init/kdump-bootloader.pl | 48 ----------------------------------------------- + init/load.sh | 14 ++----------- + 3 files changed, 3 insertions(+), 60 deletions(-) + +--- a/init/CMakeLists.txt ++++ b/init/CMakeLists.txt +@@ -65,7 +65,6 @@ INSTALL( + INSTALL( + FILES + ${CMAKE_CURRENT_SOURCE_DIR}/mkdumprd +- ${CMAKE_CURRENT_SOURCE_DIR}/kdump-bootloader.pl + DESTINATION + /usr/sbin + PERMISSIONS +--- a/init/load.sh ++++ b/init/load.sh +@@ -214,18 +214,10 @@ function fadump_bootloader() + local newstate="$1" + + # check if the old configuration is still valid +- boot_opts=$(kdump-bootloader.pl --get) +- nofadump_opts=$(echo "$boot_opts" | remove_from_commandline 'fadump') +- old_opts=$($KDUMPTOOL -F /dev/null -C <(echo "$boot_opts") \ +- dump_config --usage dump --format kernel --nodefault) + if [ "$newstate" = on ] ; then +- curr_opts=$($KDUMPTOOL dump_config --usage dump --format kernel --nodefault) +- if [ "$old_opts" != "$curr_opts" -o \ +- "$boot_opts" = "$nofadump_opts" ] ; then +- kdump-bootloader.pl --update fadump=on "$curr_opts" +- fi +- elif [ "$boot_opts" != "$nofadump_opts" ] ; then +- kdump-bootloader.pl --update ++ pbl --add-option fadump=on --config ++ else ++ pbl --del-option fadump=on --config + fi + } + +--- a/init/kdump-bootloader.pl ++++ /dev/null +@@ -1,48 +0,0 @@ +-#! /usr/bin/perl +- +-use Bootloader::Tools; +- +-Bootloader::Tools::InitLibrary(); +- +-my $grub2; +-my $section; +-if (Bootloader::Tools::GetBootloader() =~ /^(grub2|grub2-efi)$/) { +- $grub2 = true; +- $section = Bootloader::Tools::GetGlobals(); +-} else { +- $grub2 = false; +- $section = Bootloader::Tools::GetDefaultSection(); +-} +- +-if ($ARGV[0] eq "--get") { +- print $section->{"append"}; +-} elsif ($ARGV[0] eq "--update") { +- my $input = $section->{"append"}; +- my $result; +- while (length($input)) { +- $input =~ s/^[[:space:]]+//; +- if ($input =~ s/^("[^"]*"?|[^"[:space:]]+)+//) { +- my $rawparam = $&; +- my $param = $rawparam; +- $param =~ s/"//g; +- $param =~ s/=(.*)//; +- if (! ($param =~ /^KDUMP(TOOL)?_|^MAKEDUMPFILE_|^fadump$/)) { +- $result .= " " if length($result); +- $result .= $rawparam; +- } +- } +- } +- +- shift @ARGV; +- $result .= " " if length($result); +- $result .= join(" ", @ARGV); +- if ($grub2) { +- Bootloader::Tools::SetGlobals("append" => $result); +- } else { +- $section->{"append"} = $result; +- $section->{"__modified"} = 1; +- Bootloader::Tools::SetGlobals(); +- } +-} else { +- die "Need an action (--get or --update)"; +-} diff --git a/kdump.changes b/kdump.changes index b330da9..d3ac508 100644 --- a/kdump.changes +++ b/kdump.changes @@ -1,3 +1,47 @@ +------------------------------------------------------------------- +Wed Mar 20 13:34:40 UTC 2019 - ptesarik@suse.com + +- kdump-fix-multipath-user_friendly_names.patch: Fix multipath + configuration with user_friendly_names and/or aliases + (bsc#1111207, LTC#171953, bsc#1125218, LTC#175465). + +------------------------------------------------------------------- +Wed Mar 20 13:34:16 UTC 2019 - ptesarik@suse.com + +- kdump-recover-from-missing-CRASHTIME.patch: Recover from missing + CRASHTIME= in VMCOREINFO (bsc#1112387). + +------------------------------------------------------------------- +Wed Mar 20 13:26:08 UTC 2019 - ptesarik@suse.com + +- kdump-fallback-re-register-fadump-from-userspace.patch: + Re-register FADUMP from userspace if the kernel cannot do it + (bsc#1108170, LTC#171288, bsc#1094016, LTC#168050) + +------------------------------------------------------------------- +Wed Mar 20 13:21:56 UTC 2019 - ptesarik@suse.com + +- kdump-Restore-only-static-routes-in-kdump-initrd.patch: Restore + only static routes in kdump initrd (bsc#1093795). + +------------------------------------------------------------------- +Wed Mar 20 13:14:45 UTC 2019 - ptesarik@suse.com + +- kdump-on-error-option-yesno.patch: Support yes/no style for + KDUMP_CONTINUE_ON_ERROR (bsc#1083155). + +------------------------------------------------------------------- +Wed Mar 20 13:06:26 UTC 2019 - ptesarik@suse.com + +- kdump-use-pbl.patch: Replace obsolete perl-Bootloader library + with a simpler script (bsc#1050349). + +------------------------------------------------------------------- +Wed Mar 20 12:48:55 UTC 2019 - ptesarik@suse.com + +- Ensure added kdump-early.service is enabled properly after update + (bsc#1021484). + ------------------------------------------------------------------- Thu Mar 7 20:40:39 UTC 2019 - ptesarik@suse.com diff --git a/kdump.spec b/kdump.spec index 676742c..605eb35 100644 --- a/kdump.spec +++ b/kdump.spec @@ -54,6 +54,12 @@ Patch5: %{name}-fadump-fix-network-bring-up.patch Patch6: %{name}-fadump-add-udev-support.patch Patch7: %{name}-turn-off-NUMA-in-kdump-kernel.patch Patch8: %{name}-remove-noefi-and-acpi_rsdp-for-efi-firmware.patch +Patch9: %{name}-use-pbl.patch +Patch10: %{name}-on-error-option-yesno.patch +Patch11: %{name}-Restore-only-static-routes-in-kdump-initrd.patch +Patch12: %{name}-fallback-re-register-fadump-from-userspace.patch +Patch13: %{name}-recover-from-missing-CRASHTIME.patch +Patch14: %{name}-fix-multipath-user_friendly_names.patch BuildRequires: asciidoc BuildRequires: cmake BuildRequires: gcc-c++ @@ -119,6 +125,12 @@ after a crash dump has occured. %patch6 -p1 %patch7 -p1 %patch8 -p1 +%patch9 -p1 +%patch10 -p1 +%patch11 -p1 +%patch12 -p1 +%patch13 -p1 +%patch14 -p1 %build export CFLAGS="%{optflags}" @@ -172,6 +184,10 @@ fi %{fillup_only -n kdump} %service_add_post kdump.service %service_add_post kdump-early.service +# ensure newly added kdump-early.service is-enabled matches prior state +if [ -x /usr/bin/systemctl ] && /usr/bin/systemctl is-enabled kdump.service &>/dev/null ; then + /usr/bin/systemctl reenable kdump.service || : +fi %else %{fillup_and_insserv -n kdump boot.kdump} %endif @@ -211,7 +227,6 @@ rm /var/log/dump >/dev/null 2>&1 || true %doc ChangeLog COPYING README NEWS %{_sbindir}/kdumptool %{_sbindir}/mkdumprd -%{_sbindir}/kdump-bootloader.pl %{_mandir}/man5/kdump.5%{ext_man} %{_mandir}/man7/kdump.7%{ext_man} %{_mandir}/man8/kdumptool.8%{ext_man}