Accepting request 877312 from home:ptesarik:branches:Kernel:kdump

- kdump-mounts.cc-Include-sys-ioctl.h.patch: mounts.cc: Include
  <sys/ioctl.h>.
- Update to 0.9.1
  * Add build dependency on libmount
  * Drop build dependency on OpenSSL
  * Build with --stdc=c++11
- Remove patches that have been upstreamed:
  * kdump-block-initrd-parse-etc.service.patch
  * kdump-fadump-avoid-multipath-optimizations.patch
  * kdump-split-cmdline-purpose-wise.patch
  * kdump-fadump-fix-network-bring-up.patch
  * kdump-fadump-add-udev-support.patch
  * kdump-turn-off-NUMA-in-kdump-kernel.patch
  * kdump-remove-noefi-and-acpi_rsdp-for-efi-firmware.patch
  * kdump-Restore-only-static-routes-in-kdump-initrd.patch
  * kdump-fallback-re-register-fadump-from-userspace.patch
  * kdump-recover-from-missing-CRASHTIME.patch
  * kdump-fix-multipath-user_friendly_names.patch
  * kdump-Add-skip_balance-option-to-BTRFS-mounts.patch
  * kdump-kdumprd-Look-for-boot-image-and-boot-Image.patch
  * kdump-savedump-search-also-for-vmlinux.xz.patch
  * kdump-preserve-white-space.patch
  * kdump-Clean-up-the-use-of-current-vs-boot-network-iface.patch
  * kdump-Use-a-custom-namespace-for-physical-NICs.patch
  * kdump-clean-up-kdump-mount-points.patch
  * kdump-skip-mounts-if-no-proc-vmcore.patch
  * kdump-nss-modules.patch
  * kdump-Add-force-option-to-KDUMP_NETCONFIG.patch
  * kdump-Add-fence_kdump_send-when-fence-agents-installed.patch
  * kdump-FENCE_KDUMP_SEND-variable.patch
  * kdump-Document-fence_kdump_send.patch
  * kdump-powerpc-no-reload-on-CPU-removal.patch
  * kdump-prefer-by-path-and-device-mapper.patch
  * kdump-calibrate-Update-values.patch
  * kdump-activate-udev-rules-late-during-boot.patch
  * kdump-make-sure-that-the-udev-runtime-directory-exists.patch
  * kdump-make-sure-that-initrd.target.wants-directory-exists.patch
  * kdump-check-explicit-ip-options.patch
  * kdump-query-systemd-network.service.patch

OBS-URL: https://build.opensuse.org/request/show/877312
OBS-URL: https://build.opensuse.org/package/show/Kernel:kdump/kdump?expand=0&rev=204
This commit is contained in:
Petr Tesařík 2021-03-05 23:15:13 +00:00 committed by Git OBS Bridge
parent 1f145e9ec0
commit 0fe2164e1c
37 changed files with 80 additions and 2041 deletions

View File

@ -1,3 +0,0 @@
version https://git-lfs.github.com/spec/v1
oid sha256:717398896b1d0a9f8cb9edcb1317177edacb41c2caccc17b84b4a21d2252dd01
size 3336207

3
kdump-0.9.1.tar.bz2 Normal file
View File

@ -0,0 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:2bd4a78f909837e438fa5d07a4777d3430dc5d4f95ef09eca9374496f0a360a1
size 3340445

View File

@ -1,44 +0,0 @@
From: Nick Wang <nwang@suse.com>
Date: Wed, 28 Nov 2018 18:07:56 +0800
Subject: Add fence_kdump_send when fence-agents installed.
References: bsc#1108919
Upstream: merged
Git-commit: 93822c5ee738e186a3a70f6d7a6e59bdea4b46b1
Signed-off-by: Petr Tesarik <ptesarik@suse.com>
---
init/module-setup.sh | 5 +++++
init/setup-kdump.functions | 7 +++++++
2 files changed, 12 insertions(+)
--- a/init/module-setup.sh
+++ b/init/module-setup.sh
@@ -25,6 +25,11 @@ kdump_check_net() {
elif [ "${KDUMP_NETCONFIG%:force}" != "$KDUMP_NETCONFIG" ]; then
# always set up network
kdump_neednet=y
+ elif [ -f "/usr/lib/fence_kdump_send" ] &&
+ ( [[ $KDUMP_PRESCRIPT =~ "fence_kdump_send" ]] || \
+ [[ $KDUMP_POSTSCRIPT =~ "fence_kdump_send" ]] ) ; then
+ # setup network when fence_kdump_send included and configured
+ kdump_neednet=y
else
kdump_neednet=
for protocol in "${kdump_Protocol[@]}" ; do
--- a/init/setup-kdump.functions
+++ b/init/setup-kdump.functions
@@ -917,6 +917,13 @@ function kdump_modify_config() #
KDUMP_REQUIRED_PROGRAMS="$KDUMP_REQUIRED_PROGRAMS ssh"
fi
+ # copy fence_kdump_send if exists
+ if [ -f "/usr/lib/fence_kdump_send" ] &&
+ ( [[ $KDUMP_PRESCRIPT =~ "fence_kdump_send" ]] ||
+ [[ $KDUMP_POSTSCRIPT =~ "fence_kdump_send" ]] ) ; then
+ KDUMP_REQUIRED_PROGRAMS="$KDUMP_REQUIRED_PROGRAMS /usr/lib/fence_kdump_send"
+ fi
+
# make sure NSS works somehow
cp /etc/hosts "${dest}/etc"
{ cat <<-EOF

View File

@ -1,109 +0,0 @@
From: Petr Tesarik <ptesarik@suse.com>
Date: Tue, 20 Nov 2018 10:23:28 +0100
Subject: Add ":force" option to KDUMP_NETCONFIG
References: bsc#1108919
Upstream: merged
Git-commit 4e112a28055a57dbcdf9a72c4bdcf586296ec81a
Make it possible to force network setup in kdump initrd by adding a
":force" suffix to KDUMP_NETCONFIG. This is needed to configure
fence_kdump.
Signed-off-by: Petr Tesarik <ptesarik@suse.com>
---
doc/man/kdump.5.txt.in | 6 ++++++
init/module-setup.sh | 37 +++++++++++++++++++++----------------
sysconfig.kdump.in | 6 +++++-
3 files changed, 32 insertions(+), 17 deletions(-)
--- a/doc/man/kdump.5.txt.in
+++ b/doc/man/kdump.5.txt.in
@@ -544,6 +544,12 @@ Auto-detection cannot be used to set up
because of limitations in the implementation of the _ip=_ initrd command line
option.
+Network is configured only if needed, e.g. the dump target is on a remote
+machine, or an email notification should be sent. If network is needed by
+something else, such as a custom script used as KDUMP_PRESCRIPT or
+KDUMP_POSTSCRIPT, add a _:force_ suffix to the network configuration, for
+example "auto:force" or "eth0:dhcp4:force".
+
Use a _netdevice:mode_ string to force a specific network device to be used. A
_netdevice_ is for example "eth0". The _mode_ can be:
--- a/init/module-setup.sh
+++ b/init/module-setup.sh
@@ -19,20 +19,25 @@ kdump_needed() {
}
kdump_check_net() {
- kdump_neednet=
- for protocol in "${kdump_Protocol[@]}" ; do
- if [ "$protocol" != "file" -a "$protocol" != "srcfile" ]; then
- kdump_neednet=y
- fi
- done
+ if [ -z "$KDUMP_NETCONFIG" ]; then
+ # network explicitly disabled in configuration
+ kdump_neednet=
+ elif [ "${KDUMP_NETCONFIG%:force}" != "$KDUMP_NETCONFIG" ]; then
+ # always set up network
+ kdump_neednet=y
+ else
+ kdump_neednet=
+ for protocol in "${kdump_Protocol[@]}" ; do
+ if [ "$protocol" != "file" -a "$protocol" != "srcfile" ]; then
+ kdump_neednet=y
+ fi
+ done
- # network configuration
- if [ -n "$KDUMP_SMTP_SERVER" -a -n "$KDUMP_NOTIFICATION_TO" ]; then
- kdump_neednet=y
+ # network configuration
+ if [ -n "$KDUMP_SMTP_SERVER" -a -n "$KDUMP_NOTIFICATION_TO" ]; then
+ kdump_neednet=y
+ fi
fi
-
- # network explicitly disabled in configuration?
- [ -z "$KDUMP_NETCONFIG" ] && kdump_neednet=
}
kdump_get_fs_type() {
@@ -161,13 +166,13 @@ kdump_cmdline_zfcp() {
kdump_cmdline_ip() {
[ "$kdump_neednet" = y ] || return 0
- if [ "$KDUMP_NETCONFIG" = "auto" ] ; then
+ local _cfg="${KDUMP_NETCONFIG%:force}"
+ if [ "$_cfg" = "auto" ] ; then
kdump_host_if=default
kdump_net_mode=auto
else
- set -- ${KDUMP_NETCONFIG//:/ }
- kdump_host_if=$1
- kdump_net_mode=$2
+ kdump_host_if="${_cfg%%:*}"
+ kdump_net_mode="${_cfg#*:}"
fi
if [ "$kdump_host_if" = "default" ] ; then
--- a/sysconfig.kdump.in
+++ b/sysconfig.kdump.in
@@ -294,9 +294,13 @@ KDUMPTOOL_FLAGS=""
# that contains the network device and the mode (static, dhcp, dhcp6, auto6),
# separated by a colon. Example: "eth0:static" or "eth1:dhcp".
#
-# For static configuration, you have to add the configuration to
+# For static configuration, you may have to add the configuration to
# KDUMP_COMMANDLINE_APPEND.
#
+# By default, network is set up only if needed. Add ":force" to make sure
+# that network is always available (e.g. for use by a custom pre- or
+# post-script).
+#
# See also: kdump(5)
#
KDUMP_NETCONFIG="auto"

View File

@ -1,36 +0,0 @@
From f46c26fcf879f368726acf650c43eacde909dc9d Mon Sep 17 00:00:00 2001
From: Petr Tesarik <ptesarik@suse.com>
Date: Tue, 16 Apr 2019 11:05:18 +0200
Subject: Add skip_balance option to BTRFS mounts
References: bsc#1108255
Upstream: merged
Git-commit: f46c26fcf879f368726acf650c43eacde909dc9d
If a crash happens while a balance operation is being performed on a
target btrfs filesystem, then this balance operation is resumed in
the kdump environment, which is not desirable. Skip it by adding a
'skip_balance' mount option to the kdump initrd.
Signed-off-by: Petr Tesarik <ptesarik@suse.com>
---
init/setup-kdump.functions | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/init/setup-kdump.functions b/init/setup-kdump.functions
index 46b2902..9ff5efc 100644
--- a/init/setup-kdump.functions
+++ b/init/setup-kdump.functions
@@ -764,6 +764,10 @@ function kdump_update_mount() # {{{
mountpoint="/kdump/mnt$i/${mountpoint#/kdump/mnt*/}"
done
+ if [ "$fstype" = "btrfs" ] ; then
+ opts="$opts,skip_balance"
+ fi
+
kdump_mnt[i]="${mountpoint%/}"
kdump_dev[i]="$device"
kdump_fstype[i]="$fstype"
--
2.16.4

View File

@ -1,152 +0,0 @@
From e32374a88bb3b1dc0c5f493d6c1966558d996c4f Mon Sep 17 00:00:00 2001
From: Petr Tesarik <ptesarik@suse.com>
Date: Tue, 27 Nov 2018 14:52:06 +0100
Subject: Clean up the use of current vs. boot network interface names
References: bsc#1094444, bsc#1116463, bsc#1141064
Upstream: merged
Git-commit: e32374a88bb3b1dc0c5f493d6c1966558d996c4f
Strictly differentiate between the interface name as seen during
dracut execution and at boot time (in initrd environment).
Most importantly, it is necessary to store both names for generating
qeth udev rules.
Signed-off-by: Petr Tesarik <ptesarik@suse.com>
---
init/setup-kdump.functions | 51 +++++++++++++++++++++++----------------------
1 file changed, 27 insertions(+), 24 deletions(-)
--- a/init/setup-kdump.functions
+++ b/init/setup-kdump.functions
@@ -426,9 +426,9 @@ function kdump_hwaddr() # {{{
local _type=$(<"/sys/class/net/$_iface/addr_assign_type")
if [ "$_type" -eq 0 ]
then
- cat "/sys/class/net/$kdump_iface/address"
+ cat "/sys/class/net/$_iface/address"
else
- ethtool -P "$kdump_iface" | sed 's/^[^:]*: *//'
+ ethtool -P "$_iface" | sed 's/^[^:]*: *//'
fi
} # }}}
@@ -440,42 +440,43 @@ function kdump_hwaddr() # {{{
# kdump_netif corresponding ifname= initrd parameter added
# kdump_iface device name in initrd
# kdump_kmods additional kernel modules updated
-# kdump_hwif hardware interfaces updated
+# kdump_ifmap hardware network interface map updated
function kdump_ifname_config() # {{{
{
- kdump_iface="$1"
- local ifkind=$(kdump_ifkind "$kdump_iface")
+ local _iface="$1"
+ local _ifkind=$(kdump_ifkind "$_iface")
- if [ -z "$ifkind" ]
+ if [ -z "$_ifkind" ]
then
- kdump_hwif="$kdump_hwif $kdump_iface"
- local _drv=$( readlink "/sys/class/net/$kdump_iface/device/driver" )
+ kdump_iface="$_iface"
+ kdump_ifmap="$kdump_ifmap $_iface:$kdump_iface"
+ local _drv=$( readlink "/sys/class/net/$_iface/device/driver" )
case "$_drv" in
*/qeth)
;;
*)
- local hwaddr=$(kdump_hwaddr "$kdump_iface")
+ local hwaddr=$(kdump_hwaddr "$_iface")
[ -n "$hwaddr" ] && kdump_netif="$kdump_netif ifname=$kdump_iface:$hwaddr"
;;
esac
- local mod="/sys/class/net/$kdump_iface/device/driver/module"
+ local mod="/sys/class/net/$_iface/device/driver/module"
if [ -L "$mod" ]
then
mod=$(readlink "$mod")
kdump_kmods="$kdump_kmods ${mod##*/}"
fi
else
- case "$ifkind" in
+ case "$_ifkind" in
bridge)
- kdump_bridge_config "$kdump_iface"
+ kdump_bridge_config "$_iface"
;;
bond)
- kdump_bond_config "$kdump_iface"
+ kdump_bond_config "$_iface"
;;
vlan)
- kdump_vlan_config "$kdump_iface"
+ kdump_vlan_config "$_iface"
;;
*)
return 1
@@ -1070,13 +1071,13 @@ function kdump_filter_sysctl() #
# Set up a QETH network interface
# Parameters:
# 1) _root: initrd temporary root
-# 2) _iface: interface name
-# Input variables:
-# kdump_hwif hardware network interfaces
+# 2) _iface: current interface name
+# 3) _bootif: interface name in initrd
function kdump_setup_qeth() # {{{
{
local _root="$1"
local _iface="$2"
+ local _bootif="$3"
local _dev=$( readlink "/sys/class/net/$_iface/device" )
_dev="${_dev##*/}"
local _cdev0=$( readlink "/sys/class/net/$_iface/device/cdev0" )
@@ -1113,8 +1114,8 @@ ACTION=="add", SUBSYSTEM=="ccwgroup", KE
ACTION=="add", SUBSYSTEM=="ccwgroup", KERNEL=="$_dev", ATTR{online}="1"
EOF
- cat >"${_root}/etc/udev/rules.d/70-persistent-net-${_iface}.rules" <<EOF
-SUBSYSTEM=="net", ACTION=="add", DRIVERS=="qeth"$_dev_id_match, KERNELS=="$_dev", ATTR{type}=="$_type", NAME="$_iface"
+ cat >"${_root}/etc/udev/rules.d/70-persistent-net-${_bootif}.rules" <<EOF
+SUBSYSTEM=="net", ACTION=="add", DRIVERS=="qeth"$_dev_id_match, KERNELS=="$_dev", ATTR{type}=="$_type", NAME="$_bootif"
EOF
} # }}}
@@ -1123,18 +1124,20 @@ EOF
# Parameters:
# 1) _root: initrd temporary root
# Input variables:
-# kdump_hwif hardware network interfaces
+# kdump_ifmap hardware network interface map
function kdump_setup_hwif() # {{{
{
local _root="$1"
- local _iface _drv
+ local _spec _iface _bootif _drv
- for _iface in $kdump_hwif
+ for _spec in $kdump_ifmap
do
+ _iface="${_spec%:*}"
+ _bootif="${_spec##*:}"
_drv=$( readlink "/sys/class/net/$_iface/device/driver" )
case "$_drv" in
*/qeth)
- kdump_setup_qeth "$_root" "$_iface"
+ kdump_setup_qeth "$_root" "$_iface" "$_bootif"
;;
esac
done
@@ -1149,7 +1152,7 @@ function kdump_setup_hwif() # {{
# Input variables:
# KDUMP_* see kdump_get_config
# kdump_mnt[] mountpoints in kdump environment
-# kdump_hwif hardware network interfaces
+# kdump_ifmap hardware network interface map
# Output variables:
# KDUMP_REQUIRED_PROGRAMS updated as necessary
function kdump_setup_files() # {{{

View File

@ -1,30 +0,0 @@
From: Petr Tesarik <ptesarik@suse.com>
Date: Fri, 30 Nov 2018 09:29:10 +0100
Subject: Document kdump behaviour for fence_kdump_send
References: bsc#1108919
Upstream: merged
Git-commit: dcbe901dbec7d0b5e70014564da5a34f673e2248
Add an explanation paragraph to the manual page.
Signed-off-by: Petr Tesarik <ptesarik@suse.com>
---
doc/man/kdump.5.txt.in | 6 +++++-
1 file changed, 5 insertions(+), 1 deletion(-)
--- a/doc/man/kdump.5.txt.in
+++ b/doc/man/kdump.5.txt.in
@@ -483,7 +483,11 @@ KDUMP_POSTSCRIPT
~~~~~~~~~~~~~~~~
Program that is executed after taking the dump and before the system is
-rebooted. You have to include that program in KDUMP_POSTSCRIPT.
+rebooted. You have to include that program in KDUMP_REQUIRED_PROGRAMS.
+
+As a special case, if KDUMP_POSTSCRIPT contains +/usr/lib/fence_kdump_send+,
+this script is automatically added to the initrd, and network is configured by
+default.
Default: ""

View File

@ -1,52 +0,0 @@
From: Nick Wang <nwang@suse.com>
Date: Fri, 30 Nov 2018 10:03:17 +0800
Subject: Use var for path of fence_kdump_send and remove the unnecessary PRESCRIPT check
References: bsc#1108919
Upstream: merged
Git-commit: f69533d0d8e974b8c27a2c9a651fb9e98c16194b
Signed-off-by: Petr Tesarik <ptesarik@suse.com>
---
init/module-setup.sh | 5 ++---
init/setup-kdump.functions | 8 ++++----
2 files changed, 6 insertions(+), 7 deletions(-)
--- a/init/module-setup.sh
+++ b/init/module-setup.sh
@@ -25,9 +25,8 @@ kdump_check_net() {
elif [ "${KDUMP_NETCONFIG%:force}" != "$KDUMP_NETCONFIG" ]; then
# always set up network
kdump_neednet=y
- elif [ -f "/usr/lib/fence_kdump_send" ] &&
- ( [[ $KDUMP_PRESCRIPT =~ "fence_kdump_send" ]] || \
- [[ $KDUMP_POSTSCRIPT =~ "fence_kdump_send" ]] ) ; then
+ elif [ -f "$FENCE_KDUMP_SEND" ] &&
+ [[ $KDUMP_POSTSCRIPT =~ "$FENCE_KDUMP_SEND" ]] ; then
# setup network when fence_kdump_send included and configured
kdump_neednet=y
else
--- a/init/setup-kdump.functions
+++ b/init/setup-kdump.functions
@@ -10,6 +10,7 @@
#
KDUMP_CONFIG=/etc/sysconfig/kdump
+FENCE_KDUMP_SEND=/usr/lib/fence_kdump_send
#
# Global variables
@@ -918,10 +919,9 @@ function kdump_modify_config() #
fi
# copy fence_kdump_send if exists
- if [ -f "/usr/lib/fence_kdump_send" ] &&
- ( [[ $KDUMP_PRESCRIPT =~ "fence_kdump_send" ]] ||
- [[ $KDUMP_POSTSCRIPT =~ "fence_kdump_send" ]] ) ; then
- KDUMP_REQUIRED_PROGRAMS="$KDUMP_REQUIRED_PROGRAMS /usr/lib/fence_kdump_send"
+ if [ -f "$FENCE_KDUMP_SEND" ] &&
+ [[ $KDUMP_POSTSCRIPT =~ "$FENCE_KDUMP_SEND" ]] ; then
+ KDUMP_REQUIRED_PROGRAMS="$KDUMP_REQUIRED_PROGRAMS $FENCE_KDUMP_SEND"
fi
# make sure NSS works somehow

View File

@ -1,130 +0,0 @@
From: Petr Tesarik <ptesarik@suse.com>
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 <ptesarik@suse.com>
---
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"
} # }}}
#

View File

@ -1,43 +0,0 @@
From c5a6c610e1b3b4ce34a8769b7772a682fb826bda Mon Sep 17 00:00:00 2001
From: Petr Tesarik <ptesarik@suse.com>
Date: Thu, 29 Nov 2018 12:54:57 +0100
Subject: Use a custom namespace for physical NICs
References: bsc#1094444, bsc#1116463, bsc#1141064
Upstream: merged
Git-commit: c5a6c610e1b3b4ce34a8769b7772a682fb826bda
To prevent rename conflicts, use kdumpX as the interface name
instead of the current name.
Signed-off-by: Petr Tesarik <ptesarik@suse.com>
---
init/setup-kdump.functions | 10 +++++++++-
1 file changed, 9 insertions(+), 1 deletion(-)
--- a/init/setup-kdump.functions
+++ b/init/setup-kdump.functions
@@ -11,6 +11,13 @@
KDUMP_CONFIG=/etc/sysconfig/kdump
+#
+# Global variables
+#
+
+# Next network interface number
+kdump_ifnum=0
+
# Extract the device name from a route
#
# Input:
@@ -448,7 +455,8 @@ function kdump_ifname_config() #
if [ -z "$_ifkind" ]
then
- kdump_iface="$_iface"
+ kdump_iface="kdump$kdump_ifnum"
+ kdump_ifnum=$(( $kdump_ifnum + 1 ))
kdump_ifmap="$kdump_ifmap $_iface:$kdump_iface"
local _drv=$( readlink "/sys/class/net/$_iface/device/driver" )

View File

@ -1,45 +0,0 @@
From 3405c3b3b53f35459f425d7cf3c0ffaf759cade4 Mon Sep 17 00:00:00 2001
From: Martin Wilck <mwilck@suse.com>
Date: Mon, 27 Jan 2020 17:30:24 +0100
Subject: [PATCH] kdump: activate udev rules late during boot
The kdump udev rule is very broad in scope and may slow down
booting strongly, especially during the coldplug phase where
"add" events for lots of CPU and memory devices have to be
processed. Therefore, activate this rule (which has the purpose
to support real hotplug rather than coldplug) late in the boot
sequence.
---
CMakeLists.txt | 2 +-
init/kdump.service | 2 ++
2 files changed, 3 insertions(+), 1 deletion(-)
diff --git a/CMakeLists.txt b/CMakeLists.txt
index f16f532..03eb133 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -206,7 +206,7 @@ ADD_CUSTOM_TARGET(
INSTALL(FILES
${CMAKE_CURRENT_BINARY_DIR}/70-kdump.rules
DESTINATION
- /etc/udev/rules.d
+ /usr/lib/kdump
)
#
diff --git a/init/kdump.service b/init/kdump.service
index 997805f..fb19f84 100644
--- a/init/kdump.service
+++ b/init/kdump.service
@@ -5,6 +5,8 @@ After=local-fs.target network.service YaST2-Second-Stage.service YaST2-Firstboot
[Service]
Type=oneshot
ExecStart=/lib/kdump/load.sh --update
+ExecStartPost=-/usr/bin/cp /usr/lib/kdump/70-kdump.rules /run/udev/rules.d/70-kdump.rules
+ExecStopPost=-/usr/bin/rm -f /run/udev/rules.d/70-kdump.rules
ExecStop=/lib/kdump/unload.sh
RemainAfterExit=true
--
2.25.0

View File

@ -1,37 +0,0 @@
From: Petr Tesarik <ptesarik@suse.com>
Date: Fri, 4 May 2018 12:55:44 +0200
Subject: Block initrd-parse-etc.service until dump is saved
References: bsc#1091186
Upstream: merged
Git-commit: ac14396b33a7d507a65999aa7f70668f9cd15e8e
During boot, custom services like kdump-save.service run in parallel
with other generic initrd services up until initrd.target. However,
a reload from real root may change the dependency graph in a way
that prevents kdump-save.service from finishing. Since kdump needs
only the explicitly listed mount points, boot process may pause
while the dump is being saved. In fact, it is preferable to do so,
lest other processes interfere with kdump itself in the restricted
environment.
Signed-off-by: Petr Tesarik <ptesarik@suse.com>
---
init/kdump-save.service.in | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/init/kdump-save.service.in b/init/kdump-save.service.in
index 7879dc2..a4d6a65 100644
--- a/init/kdump-save.service.in
+++ b/init/kdump-save.service.in
@@ -11,7 +11,7 @@
Description=save kernel crash dump
Documentation=man:kdump(7)
RequiresMountsFor=@KDUMP_MOUNTPOINTS@
-Before=initrd-cleanup.service
+Before=initrd-parse-etc.service
ConditionPathExists=/etc/initrd-release
ConditionPathExists=/proc/vmcore
--
2.13.6

View File

@ -1,145 +0,0 @@
From: Petr Tesarik <ptesarik@suse.com>
Date: Tue, 17 Dec 2019 10:49:19 +0100
Subject: calibrate: Update values
References: bsc#1130529
Upstream: merged
Git-commit: 898b9e7fb7f80bd19268678b4abaf74792a3c229
Kernel base image has grown by approx. 20%.
Unpacked initramfs has grown by approx. 50%.
Signed-off-by: Petr Tesarik <ptesarik@suse.com>
---
kdumptool/calibrate.cc | 56 ++++++++++++++++++++++++-------------------------
1 file changed, 28 insertions(+), 28 deletions(-)
--- a/kdumptool/calibrate.cc
+++ b/kdumptool/calibrate.cc
@@ -58,10 +58,10 @@
//
#if defined(__x86_64__)
-# define DEF_RESERVE_KB MB(128)
-# define KERNEL_KB MB(32)
+# define DEF_RESERVE_KB MB(192)
+# define KERNEL_KB MB(38)
# define KERNEL_INIT_KB MB(5)
-# define INIT_KB MB(34)
+# define INIT_KB MB(51)
# define INIT_NET_KB MB(3)
# define SIZE_STRUCT_PAGE 64
# define KDUMP_PHYS_LOAD 0
@@ -69,10 +69,10 @@
# define PERCPU_KB 108
#elif defined(__i386__)
-# define DEF_RESERVE_KB MB(128)
-# define KERNEL_KB MB(28)
+# define DEF_RESERVE_KB MB(192)
+# define KERNEL_KB MB(34)
# define KERNEL_INIT_KB MB(4)
-# define INIT_KB MB(29)
+# define INIT_KB MB(44)
# define INIT_NET_KB MB(2)
# define SIZE_STRUCT_PAGE 36
# define KDUMP_PHYS_LOAD 0
@@ -80,10 +80,10 @@
# define PERCPU_KB 56
#elif defined(__powerpc64__)
-# define DEF_RESERVE_KB MB(256)
-# define KERNEL_KB MB(32)
+# define DEF_RESERVE_KB MB(384)
+# define KERNEL_KB MB(38)
# define KERNEL_INIT_KB MB(5)
-# define INIT_KB MB(58)
+# define INIT_KB MB(87)
# define INIT_NET_KB MB(4)
# define SIZE_STRUCT_PAGE 64
# define KDUMP_PHYS_LOAD MB(128)
@@ -91,10 +91,10 @@
# define PERCPU_KB 172 // FIXME: is it non-linear?
#elif defined(__powerpc__)
-# define DEF_RESERVE_KB MB(128)
-# define KERNEL_KB MB(24)
+# define DEF_RESERVE_KB MB(192)
+# define KERNEL_KB MB(29)
# define KERNEL_INIT_KB MB(5)
-# define INIT_KB MB(34)
+# define INIT_KB MB(51)
# define INIT_NET_KB MB(2)
# define SIZE_STRUCT_PAGE 36
# define KDUMP_PHYS_LOAD MB(128)
@@ -102,10 +102,10 @@
# define PERCPU_KB 0 // TODO !!!
#elif defined(__s390x__)
-# define DEF_RESERVE_KB MB(128)
-# define KERNEL_KB MB(26)
+# define DEF_RESERVE_KB MB(192)
+# define KERNEL_KB MB(31)
# define KERNEL_INIT_KB 512
-# define INIT_KB MB(34)
+# define INIT_KB MB(51)
# define INIT_NET_KB MB(2)
# define SIZE_STRUCT_PAGE 64
# define KDUMP_PHYS_LOAD 0
@@ -115,10 +115,10 @@
# define align_memmap s390x_align_memmap
#elif defined(__s390__)
-# define DEF_RESERVE_KB MB(128)
-# define KERNEL_KB MB(24)
+# define DEF_RESERVE_KB MB(192)
+# define KERNEL_KB MB(29)
# define KERNEL_INIT_KB 512
-# define INIT_KB MB(29)
+# define INIT_KB MB(44)
# define INIT_NET_KB MB(2)
# define SIZE_STRUCT_PAGE 36
# define KDUMP_PHYS_LOAD 0
@@ -128,10 +128,10 @@
# define align_memmap s390_align_memmap
#elif defined(__ia64__)
-# define DEF_RESERVE_KB MB(512)
-# define KERNEL_KB MB(64)
+# define DEF_RESERVE_KB MB(768)
+# define KERNEL_KB MB(77)
# define KERNEL_INIT_KB MB(3)
-# define INIT_KB MB(44)
+# define INIT_KB MB(66)
# define INIT_NET_KB MB(4)
# define SIZE_STRUCT_PAGE 64
# define KDUMP_PHYS_LOAD 0
@@ -139,21 +139,21 @@
# define PERCPU_KB 0 // TODO !!!
#elif defined(__aarch64__)
-# define DEF_RESERVE_KB MB(128)
-# define KERNEL_KB MB(26)
+# define DEF_RESERVE_KB MB(192)
+# define KERNEL_KB MB(31)
# define KERNEL_INIT_KB MB(1)
-# define INIT_KB MB(29)
-# define INIT_NET_KB MB(2)
+# define INIT_KB MB(51)
+# define INIT_NET_KB MB(3)
# define SIZE_STRUCT_PAGE 64
# define KDUMP_PHYS_LOAD 0
# define CAN_REDUCE_CPUS 1
# define PERCPU_KB 0 // TODO !!!
#elif defined(__arm__)
-# define DEF_RESERVE_KB MB(128)
-# define KERNEL_KB MB(24)
+# define DEF_RESERVE_KB MB(192)
+# define KERNEL_KB MB(29)
# define KERNEL_INIT_KB MB(1)
-# define INIT_KB MB(29)
+# define INIT_KB MB(44)
# define INIT_NET_KB MB(2)
# define SIZE_STRUCT_PAGE 36
# define KDUMP_PHYS_LOAD 0

View File

@ -1,62 +0,0 @@
From: Petr Tesarik <ptesarik@suse.com>
Date: Fri Mar 5 11:06:35 2021 +0100
Subject: Do not add network-related dracut options if ip= is set explicitly
References: bsc#1182309
Upstream: merged
Git-commit: bbe9b1281cd6c26ec937c6fee622ad7a84da959d
If the KDUMP_COMMANDLINE or KDUMP_COMMANDLINE_APPEND contain an
explicit ip= option, do not try to add anything automatically,
because it will clash with the admin's intention.
Signed-off-by: Petr Tesarik <ptesarik@suse.com>
---
doc/man/kdump.5.txt.in | 8 ++++++--
init/module-setup.sh | 15 +++++++++++++++
2 files changed, 21 insertions(+), 2 deletions(-)
--- a/doc/man/kdump.5.txt.in
+++ b/doc/man/kdump.5.txt.in
@@ -580,8 +580,12 @@ _netdevice_ is for example "eth0". The _
* use DHCP6 if it has a permanent IPv6 address (IPv4 not set up),
* use IPv6 auto-configuration if it has neither (IPv4 not set up).
-You can set KDUMP_NETCONFIG to "" if you want no network in initrd, i.e. you use
-disk dumping.
+*Note:* If an _ip=_ option is found in KDUMP_COMMANDLINE or
+KDUMP_COMMANDLINE_APPEND, kdump does not add any other _ip=_ or _ifname=_
+options. In other words, the value of KDUMP_NETCONFIG is effectively ignored.
+
+Setting KDUMP_NETCONFIG to "" disables network completely. In this case, kdump
+does not even add the _network_ dracut module to the initrd.
Default: "auto"
--- a/init/module-setup.sh
+++ b/init/module-setup.sh
@@ -168,9 +168,24 @@ kdump_cmdline_zfcp() {
} | sort -u
}
+kdump_ip_set_explicitly() {
+ local _opt
+ for _opt in $KDUMP_COMMANDLINE $KDUMP_COMMANDLINE_APPEND
+ do
+ if [ "${_opt%%=*}" = "ip" -a \
+ "${_opt#*=}" != "$_opt" ]
+ then
+ return 0
+ fi
+ done
+ return 1
+}
+
kdump_cmdline_ip() {
[ "$kdump_neednet" = y ] || return 0
+ kdump_ip_set_explicitly && return 0
+
local _cfg="${KDUMP_NETCONFIG%:force}"
if [ "$_cfg" = "auto" ] ; then
kdump_host_if=default

View File

@ -1,41 +0,0 @@
From: Petr Tesarik <ptesarik@suse.com>
Date: Mon, 2 Sep 2019 10:01:47 +0200
Subject: Make sure that kdump mount points are cleaned up
References: bsc#1102252, bsc#1125011
Upstream: merged
Git-commit 83e48556428339668e6f23e1dccc0196a52d1b68
If the system continues to boot, kdump mount points must be
unmounted before switching to the system root. Otherwise, some
filesystems may remain mounted under the now-unavailable initrd
root, keeping the underlying devices busy during system shutdown.
Signed-off-by: Petr Tesarik <ptesarik@suse.com>
---
init/module-setup.sh | 14 +++++++++++++-
1 file changed, 13 insertions(+), 1 deletion(-)
--- a/init/module-setup.sh
+++ b/init/module-setup.sh
@@ -246,7 +246,19 @@ install() {
gsub(/@KDUMP_MOUNTPOINTS@/, mountpoints)
print
}' "$moddir/kdump-save.service.in" > \
- "$initdir/$systemdsystemunitdir"/kdump-save.service
+ "$initdir/$systemdsystemunitdir"/kdump-save.service
+
+ local _d _mp
+ _d="$initdir/$systemdsystemunitdir"/initrd-switch-root.target.d
+ mkdir -p "$_d"
+ (
+ echo "[Unit]"
+ for _mp in "${kdump_mnt[@]}" ; do
+ echo -n "Conflicts="
+ systemd-escape -p --suffix=mount "$_mp"
+ done
+ ) > "$_d"/kdump.conf
+
ln_r "$systemdsystemunitdir"/kdump-save.service \
"$systemdsystemunitdir"/initrd.target.wants/kdump-save.service
else

View File

@ -1,73 +0,0 @@
From: Hari Bathini <hbathini@linux.ibm.com>
Subject: fadump: add udev event support for fadump
References: bsc#1108170
Upstream: merged
Git-commit: eb5784f6cb8368b346b9b52be66116fc5a47f720
Currently, the udev rules written in kdump package only support reloading
kdump on memory/cpu hot add/remove operation. But this is needed as much
for FADump as well. The rules were not updated to support fadump owing to
lack of support in the kernel for re-registering FADump. This support is
now added to kernel with commit 0823c68b054b ("powerpc/fadump: re-register
firmware-assisted dump if already registered"). Update kdump udev rules
to load fadump on memory/cpu DLPAR operations.
Signed-off-by: Hari Bathini <hbathini@linux.ibm.com>
Signed-off-by: Petr Tesarik <ptesarik@suse.com>
---
70-kdump.rules.in | 3 +++
init/load.sh | 29 ++++++++++++++++-------------
2 files changed, 19 insertions(+), 13 deletions(-)
--- a/70-kdump.rules.in
+++ b/70-kdump.rules.in
@@ -21,6 +21,9 @@ GOTO="kdump_end"
# Reload only if panic kernel is already loaded
LABEL="kdump_try_restart"
PROGRAM="/bin/cat /sys/kernel/kexec_crash_loaded", RESULT!="0", RUN+="/lib/kdump/load-once.sh"
+@if @ARCH@ ppc64 ppc64le
+TEST=="/sys/kernel/fadump_registered", PROGRAM="/bin/cat /sys/kernel/fadump_registered", RESULT!="0", RUN+="/lib/kdump/load-once.sh"
+@endif
LABEL="kdump_end"
@endif
--- a/init/load.sh
+++ b/init/load.sh
@@ -243,21 +243,24 @@ function load_kdump_fadump()
local msg
local result=0
+ local output
- # The kernel fails with EINVAL if registered already
- # (see bnc#814780)
- if [ "$(cat $FADUMP_REGISTERED)" != "1" ] ; then
- local output
-
- output=$( (echo 1 > "$FADUMP_REGISTERED") 2>&1)
- if [ $? -eq 0 ] ; then
- msg="Registered fadump"
- else
- msg="FAILED to register fadump: $output"
- result=1
- fi
+ # Re-registering of FADump is supported in kernel (see bsc#1108170).
+ # So, don't bother about whether FADump was registered already
+ output=$( (echo 1 > "$FADUMP_REGISTERED") 2>&1)
+ if [ $? -eq 0 ] ; then
+ msg="Registered fadump"
else
- msg="fadump is already registered"
+ # For backward compatibility on older kernel that
+ # returns -EEXIST/-EINVAL
+ 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
+ fi
fi
echo "$msg"

View File

@ -1,76 +0,0 @@
From: Hari Bathini <hbathini@linux.ibm.com>
Date: Mon, 20 Aug 2018 16:11:38 +0200
Subject: fadump: avoid multipath optimizations that break regular boot
References: bsc#1101730
Upstream: merged
Git-commit: dc29a820687a3a267c56ad1b125cb670dbd194ad
Since commit 9a3764178a91 ("Blacklist unneeded multipath devices")
multipath devices that are not needed while capturing dump were
blacklisted. This reduces the memory requirements on kdump kernel.
But when this optimization is added to default initrd by including
dump capturing support for FADump, it is observed to mess with the
initialization of such blacklisted multipath devices while booting
the production kernel. To avoid such issues, use this optimization
only while booting a capture kernel.
Signed-off-by: Hari Bathini <hbathini@linux.ibm.com>
Acked-by: Petr Tesarik <ptesarik@suse.com>
---
init/CMakeLists.txt | 1 +
init/kdump-boot.sh | 16 ++++++++++++++++
init/module-setup.sh | 1 +
init/setup-kdump.functions | 2 +-
4 files changed, 19 insertions(+), 1 deletion(-)
create mode 100755 init/kdump-boot.sh
--- a/init/CMakeLists.txt
+++ b/init/CMakeLists.txt
@@ -98,6 +98,7 @@ INSTALL(
INSTALL(
FILES
${CMAKE_CURRENT_SOURCE_DIR}/kdump-root.sh
+ ${CMAKE_CURRENT_SOURCE_DIR}/kdump-boot.sh
${CMAKE_CURRENT_SOURCE_DIR}/module-setup.sh
${CMAKE_CURRENT_SOURCE_DIR}/mount-kdump.sh
DESTINATION
--- /dev/null
+++ b/init/kdump-boot.sh
@@ -0,0 +1,16 @@
+#! /bin/sh
+# -*- mode: shell-script; indent-tabs-mode: nil; sh-basic-offset: 4; -*-
+# ex: ts=8 sw=4 sts=4 et filetype=sh
+
+# An Initrd with dump capturing support can boot a production kernel
+# as well (FADump). In such scenario, apply optimizations only while
+# booting the capture kernel - this is a kernel that
+# a) has a /proc/vmcore file waiting to be saved.
+# b) reboots after saving the dump.
+
+# apply multipath optimizations
+if [ -s /proc/vmcore ]; then
+ # Replace the multipath.conf file with the one optimized for kdump.
+ rm -f /etc/multipath.conf
+ mv /etc/multipath.conf.kdump /etc/multipath.conf
+fi
--- a/init/module-setup.sh
+++ b/init/module-setup.sh
@@ -264,6 +264,7 @@ install() {
kdump_setup_files "$initdir" "$kdump_mpath_wwids"
inst_hook cmdline 50 "$moddir/kdump-root.sh"
+ inst_hook cmdline 50 "$moddir/kdump-boot.sh"
if dracut_module_included "systemd" ; then
inst_binary "$moddir/device-timeout-generator" \
"$systemdutildir"/system-generators/kdump-device-timeout-generator
--- a/init/setup-kdump.functions
+++ b/init/setup-kdump.functions
@@ -1179,7 +1179,7 @@ function kdump_setup_files() # {
#
# create modified multipath.conf
#
- kdump_modify_multipath "$mpathdevs" > "${outdir}/etc/multipath.conf"
+ kdump_modify_multipath "$mpathdevs" > "${outdir}/etc/multipath.conf.kdump"
#
# filter out problematic sysctl settings

View File

@ -1,46 +0,0 @@
From: Hari Bathini <hbathini@linux.ibm.com>
Date: Mon, 20 Aug 2018 16:12:51 +0200
Subject: fadump: fix network bring up issue during default boot
References: bsc#1101730
Upstream: merged
Git-commit: 0ad221c8a81ee812b3afec6a9c873bd5bd1c228b
If ssh is used for dump target, kdump module enforces bringing up the
network (rd.neednet=1). If bringing up the network fails, it drops to
emergency shell. This sounds ok for a kdump kernel as it's only job is
to save dump to the specified dump target and reboot. But in case of
FADump, kdump module, which adds dump capturing support in the initrd,
is added to the regular initrd. If network bring up fails, production
kernel also falls to emergency shell while booting. Considering this
requirement has no relevance in booting a production kerne, that could
have been avoided. Fix it here by enforcing rd.neednet=1 only while
booting a capture kernel.
Signed-off-by: Hari Bathini <hbathini@linux.ibm.com>
Acked-by: Petr Tesarik <ptesarik@suse.com>
---
init/kdump-boot.sh | 8 ++++++--
1 file changed, 6 insertions(+), 2 deletions(-)
--- a/init/kdump-boot.sh
+++ b/init/kdump-boot.sh
@@ -3,8 +3,9 @@
# ex: ts=8 sw=4 sts=4 et filetype=sh
# An Initrd with dump capturing support can boot a production kernel
-# as well (FADump). In such scenario, apply optimizations only while
-# booting the capture kernel - this is a kernel that
+# as well (FADump). In such scenario, apply optimizations and enforce
+# bringing up dump target only while booting the capture kernel - this
+# is a kernel that
# a) has a /proc/vmcore file waiting to be saved.
# b) reboots after saving the dump.
@@ -13,4 +14,7 @@ if [ -s /proc/vmcore ]; then
# Replace the multipath.conf file with the one optimized for kdump.
rm -f /etc/multipath.conf
mv /etc/multipath.conf.kdump /etc/multipath.conf
+else
+ # avoid enforing network bring up while booting production kernel.
+ rm -f /etc/cmdline.d/99kdump-net.conf
fi

View File

@ -1,48 +0,0 @@
From 4084339bb6e7c605dab7a48a98b97510f555d343 Mon Sep 17 00:00:00 2001
From: Hari Bathini <hbathini@linux.ibm.com>
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 <hbathini@linux.ibm.com>
Acked-by: Petr Tesarik <ptesarik@suse.com>
---
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

View File

@ -1,30 +0,0 @@
From: Petr Tesarik <ptesarik@suse.com>
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, bsc#1153601
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 <ptesarik@suse.com>
---
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

View File

@ -1,33 +0,0 @@
From d332bb87cd1d093f8b78ff3d79413d84fa26dea3 Mon Sep 17 00:00:00 2001
From: Petr Tesarik <ptesarik@suse.com>
Date: Fri, 26 Apr 2019 09:27:40 +0200
Subject: kdumprd: Look for /boot/image-* and /boot/Image-*
References: bsc#1132799
Upstream: merged
Git-commit: d332bb87cd1d093f8b78ff3d79413d84fa26dea3
These kernel image names are used on s390(x) and arm*/aarch64,
respectively. Without this change, the path to the kernel must be
given explicitly on the command line if a specific kernel version is
required.
Signed-off-by: Petr Tesarik <ptesarik@suse.com>
---
init/mkdumprd | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
--- a/init/mkdumprd
+++ b/init/mkdumprd
@@ -125,9 +125,9 @@ shift $(($OPTIND -1))
if [ -z "$KERNEL" ] ; then
if [ -n "$KERNELVERSION" ] ; then
KERNEL=/boot/vmlinuz-$KERNELVERSION
- if ! [ -f "$KERNEL" ] ; then
- KERNEL=/boot/vmlinux-$KERNELVERSION
- fi
+ test -f "$KERNEL" || KERNEL=/boot/image-$KERNELVERSION
+ test -f "$KERNEL" || KERNEL=/boot/Image-$KERNELVERSION
+ test -f "$KERNEL" || KERNEL=/boot/vmlinux-$KERNELVERSION
else
output=$(kdumptool find_kernel $find_kernel_args)
KERNEL=$(echo "$output" | grep ^Kernel | cut -f 2)

View File

@ -1,38 +0,0 @@
From: Shung-Hsi Yu <shung-hsi.yu@suse.com>
Date: Wed, 29 Jul 2020 14:40:10 +0800
Subject: Make sure that initrd.target.wants directory exists
Git-repo: https://github.com/openSUSE/kdump.git
Git-commit: 506794bf323ceb27f4796e60e311fad11e6d6986
Patch-mainline: yes
References: bsc#1172670
Creation of symbolic link to kdump-save.service will fail if the directory
doesn't exists, and dump will not be captured because kdump-save.service is
never started.
The user will see the rescue mode prompt when the kernel crashed because
systemd will proceed to initrd-switch-root, which will fail (thus triggering
rescue mode) because kdump initrd does not setup /sysroot properly.
Reference: bsc#1172670
Signed-off-by: Shung-Hsi Yu <shung-hsi.yu@suse.com>
Signed-off-by: Jiri Slaby <jslaby@suse.cz>
---
init/module-setup.sh | 1 +
1 file changed, 1 insertion(+)
diff --git a/init/module-setup.sh b/init/module-setup.sh
index 9c1e6feb..057e5800 100755
--- a/init/module-setup.sh
+++ b/init/module-setup.sh
@@ -281,6 +281,7 @@ install() {
done
) > "$_d"/kdump.conf
+ mkdir -p "$initdir/$systemdsystemunitdir"/initrd.target.wants
ln_r "$systemdsystemunitdir"/kdump-save.service \
"$systemdsystemunitdir"/initrd.target.wants/kdump-save.service
else
--
2.26.2

View File

@ -1,66 +0,0 @@
From c79aa44d58ef29e22516986641970c343cb15cd0 Mon Sep 17 00:00:00 2001
From: Petr Tesarik <ptesarik@suse.com>
Date: Tue, 25 Feb 2020 14:47:02 +0100
Subject: Make sure that the udev runtime directory exists
References: bsc#1164713
Upstream: merged
Git-commit: c79aa44d58ef29e22516986641970c343cb15cd0
Hotplug operations will not work with kdump if the udev runtime
directory does not exist at startup.
While fixing it, move udev rules handling to load.sh / unload.sh.
Signed-off-by: Petr Tesarik <ptesarik@suse.com>
---
init/kdump.service | 2 --
init/load.sh | 3 +++
init/unload.sh | 2 ++
3 files changed, 5 insertions(+), 2 deletions(-)
--- a/init/kdump.service
+++ b/init/kdump.service
@@ -5,8 +5,6 @@ After=local-fs.target network.service Ya
[Service]
Type=oneshot
ExecStart=/lib/kdump/load.sh --update
-ExecStartPost=-/usr/bin/cp /usr/lib/kdump/70-kdump.rules /run/udev/rules.d/70-kdump.rules
-ExecStopPost=-/usr/bin/rm -f /run/udev/rules.d/70-kdump.rules
ExecStop=/lib/kdump/unload.sh
RemainAfterExit=true
--- a/init/load.sh
+++ b/init/load.sh
@@ -7,6 +7,7 @@ KDUMPTOOL=/usr/sbin/kdumptool
KEXEC=/sbin/kexec
FADUMP_ENABLED=/sys/kernel/fadump_enabled
FADUMP_REGISTERED=/sys/kernel/fadump_registered
+UDEV_RULES_DIR=/run/udev/rules.d
#
# Remove an option from the kernel command line
@@ -324,6 +325,8 @@ result=$?
if [ $result = 0 ] ; then
echo 1 > /proc/sys/kernel/panic_on_oops
+ mkdir -p "$UDEV_RULES_DIR"
+ cp /usr/lib/kdump/70-kdump.rules "$UDEV_RULES_DIR"/70-kdump.rules
fi
exit $result
--- a/init/unload.sh
+++ b/init/unload.sh
@@ -6,6 +6,7 @@
KDUMPTOOL=/usr/sbin/kdumptool
KEXEC=/sbin/kexec
FADUMP_REGISTERED=/sys/kernel/fadump_registered
+UDEV_RULES_DIR=/run/udev/rules.d
eval $($KDUMPTOOL dump_config)
@@ -21,4 +22,5 @@ fi
test $? -eq 0 || exit 1
+rm -f "$UDEV_RULES_DIR"/70-kdump.rules
exit 0

View File

@ -0,0 +1,26 @@
From: Petr Tesarik <ptesarik@suse.com>
Date: Fri Mar 5 18:25:14 2021 +0100
Subject: mounts.cc: Include <sys/ioctl.h>
Upstream: merged
Git-commit: 9c47874dadcdb39fbb3cededc46bc32449f42374
Since the code uses ioctl(), it should include the corresponding
header file. This was not found before release, because including
the header file is not necessary with some glibc versions...
Signed-off-by: Petr Tesarik <ptesarik@suse.com>
diff --git a/kdumptool/mounts.cc b/kdumptool/mounts.cc
index 79bf4fc..d792e53 100644
--- a/kdumptool/mounts.cc
+++ b/kdumptool/mounts.cc
@@ -36,6 +36,9 @@
#include <sys/stat.h>
#include <fcntl.h>
+// for ioctl()
+#include <sys/ioctl.h>
+
#include <linux/btrfs.h>
#include "global.h"

View File

@ -1,67 +0,0 @@
From: Petr Tesarik <ptesarik@suse.com>
Date: Thu, 14 Nov 2019 19:13:39 +0100
Subject: Improve the handling of NSS
References: bsc#1021846
Upstream: merged
Git-commit 598d7517ccbbf29dc51e0a9c14146722d2324731
The current code mostly works, but can be improved in two ways:
1. Only the 'hosts' database is really needed in the kdump
environment, and its settings should be copied from the running
system. The openSSH client also needs 'passwd' (and maybe
'group'), but it is not necessary to handle fancy setups (such
as NIS or AD). The client merely requires that UID 0 can be
translated to a user name. The 'file' service is more than
sufficient for that purpose.
2. The NSS configuration file may not contain configuration of all
categories. If configuration for a given category is missing,
glibc will use a default setting, but kdump will not install
the corresponding modules. Fix it by adding the glibc default
to the configuration file explicitly if needed.
Signed-off-by: Petr Tesarik <ptesarik@suse.com>
---
init/setup-kdump.functions | 22 ++++++++++++++++++++--
1 file changed, 20 insertions(+), 2 deletions(-)
--- a/init/setup-kdump.functions
+++ b/init/setup-kdump.functions
@@ -892,8 +892,6 @@ function kdump_modify_config() #
KDUMP_SAVEDIR="${KDUMP_SAVEDIR}file://${kdump_Realpath[i]}"
elif [ "$protocol" != "srcfile" ] ; then
KDUMP_SAVEDIR="${KDUMP_SAVEDIR}${kdump_URL[i]}"
- cp /etc/hosts "${dest}/etc"
- grep '^hosts:' /etc/nsswitch.conf > "${dest}/etc/nsswitch.conf"
fi
#
@@ -919,6 +917,26 @@ function kdump_modify_config() #
KDUMP_REQUIRED_PROGRAMS="$KDUMP_REQUIRED_PROGRAMS ssh"
fi
+ # make sure NSS works somehow
+ cp /etc/hosts "${dest}/etc"
+ { cat <<-EOF
+ passwd: files
+ shadow: files
+ group: files
+EOF
+ grep '^[[:space:]]*hosts:' /etc/nsswitch.conf \
+ || echo 'hosts: dns [!UNAVAIL=return] files'
+ } > "${dest}/etc/nsswitch.conf"
+
+ # install necessary NSS modules
+ local _nssmods=$(
+ sed -e 's/#.*//; s/^[^:]*://; s/\[[^]]*\]//' \
+ "${dest}/etc/nsswitch.conf" \
+ | tr -s '[:space:]' '\n' | sort -u | tr '\n' '|' )
+ _nssmods=${_nssmods#|}
+ _nssmods=${_nssmods%|}
+ inst_libdir_file -n "/libnss_($_nssmods)" 'libnss_*.so*'
+
#
# dump the configuration file, modifying:
# KDUMP_SAVEDIR -> resolved path

View File

@ -1,33 +0,0 @@
From: Petr Tesarik <ptesarik@suse.com>
Date: Fri, 6 Dec 2019 09:54:57 +0100
Subject: powerpc: Do not reload on CPU hot removal
References: bsc#1133407, LTC#176111
Git-commit: d1c4f630f0da0bf43928e3c975f02e832b2df50f
Skipping reload after a CPU goes offline does not have any adverse
impact, as /sys/devices/system/cpu/cpuX nodes are present for all
"possible" CPUs on PPC64.
The udev rule for CPU online operation is still needed. If reload
is skipped and the system crashes on a hot-added CPU, the kdump
kernel fails to get the 'boot_cpuid' after a hot plug and
eventually fails (see early_init_dt_scan_cpus() in
arch/powerpc/kernel/prom.c file).
Signed-off-by: Petr Tesarik <ptesarik@suse.com>
---
70-kdump.rules.in | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
--- a/70-kdump.rules.in
+++ b/70-kdump.rules.in
@@ -13,7 +13,7 @@
SUBSYSTEM=="memory", ACTION=="add|remove", GOTO="kdump_try_restart"
@if @ARCH@ ppc ppc64 ppc64le
-SUBSYSTEM=="cpu", ACTION=="online|offline", GOTO="kdump_try_restart"
+SUBSYSTEM=="cpu", ACTION=="online", GOTO="kdump_try_restart"
@endif
GOTO="kdump_end"

View File

@ -1,86 +0,0 @@
From: Petr Tesarik <ptesarik@suse.com>
Date: Mon, 16 Dec 2019 13:33:19 +0100
Subject: Prefer by-path and device-mapper aliases over kernel names
References: bsc#1101149, LTC#168532
Upsream: merged
Git-commit: f153c9ac3f1baf8d1cf66c901b41f7bff19ff528
Mounting by kernel names (e.g. /dev/sda) is generally broken, since
these names are allocated dynamically by the kernel and may change
after a panic kexec. This issue can be usually avoided by using a
more stable tag in /etc/fstab (e.g. UUID=xyz).
However, there are supported ways to mount a filesystem with no
corresponding line in /etc/fstab, and kdump uses /proc/mounts as
fallback. This file shows the block device using the name that was
given as argument to the mount syscall. This name is usually
translated to the kernel name by libblkid(3). As a result, it does
not reflect the original intention, e.g.:
ezekiel:~ # mount UUID=9A4D-9B2B /mnt/data/
ezekiel:~ # grep /mnt/data /proc/mounts
/dev/sda /mnt/data vfat rw,relatime,fmask=0022,dmask=0022,codepage=437,iocharset=iso8859-1,shortname=mixed,errors=remount-ro 0 0
ezekiel:~ # grep /mnt/data /proc/self/mountinfo
187 94 8:0 / /mnt/data rw,relatime shared:56 - vfat /dev/sda rw,fmask=0022,dmask=0022,codepage=437,iocharset=iso8859-1,shortname=mixed,errors=remount-ro
As the original intention cannot be recovered, it is probably
better to prefer the by-path alias. The semantic of this alias is
closest to the traditional UNIX use of raw block device names: it's
always the drive attached to a known physical connector, regardless
of which medium is inserted.
Signed-off-by: Petr Tesarik <ptesarik@suse.com>
---
init/module-setup.sh | 3 ++-
init/setup-kdump.functions | 27 +++++++++++++++++++++++++++
2 files changed, 29 insertions(+), 1 deletion(-)
--- a/init/module-setup.sh
+++ b/init/module-setup.sh
@@ -90,7 +90,8 @@ kdump_add_mnt() {
mkdir -p "$initdir/etc"
local _passno=2
[ "${kdump_fstype[_idx]}" = nfs ] && _passno=0
- echo "${kdump_dev[_idx]} ${kdump_mnt[_idx]} ${kdump_fstype[_idx]} ${kdump_opts[_idx]} 0 $_passno" >> "$initdir/etc/fstab"
+ _dev=$(kdump_mount_dev "${kdump_dev[_idx]}")
+ echo "$_dev ${kdump_mnt[_idx]} ${kdump_fstype[_idx]} ${kdump_opts[_idx]} 0 $_passno" >> "$initdir/etc/fstab"
}
check() {
--- a/init/setup-kdump.functions
+++ b/init/setup-kdump.functions
@@ -716,6 +716,33 @@ function kdump_get_targets() # {
} # }}}
#
+# Get a block device specification that is suitable for use as the
+# first column in /etc/fstab.
+# Since device node names may change after kexec, more stable symlink
+# are preferred (by-path alias or device mapper name).
+# Parameters:
+# 1) _dev: block device specification
+# Output:
+# block device specification to be used in /etc/fstab
+function kdump_mount_dev() # {{{
+{
+ local _dev="$1"
+
+ if [ ! -L "$_dev" -a -b "$_dev" ] ; then
+ local _symlink
+ for _symlink in $(udevadm info --root --query=symlink "$_dev")
+ do
+ case "$_symlink" in
+ */by-path/*|*/mapper/*)
+ _dev="$_symlink"
+ break
+ esac
+ done
+ fi
+ echo "$_dev"
+} # }}}
+
+#
# Read and normalize /etc/fstab and /proc/mounts (if exists).
# The following transformations are done:
# - initial TABs and SPACEs are removed

View File

@ -1,48 +0,0 @@
From: Petr Tesarik <ptesarik@suse.com>
Date: Tue, Nov 12 2019 14:53:37 +0100
Subject: Preserve white space when removing kernel command line options
References: bsc#1117652
Upstream: merged
Git-commit: 23d593b54a9c97a204ea7412e53c60d3d3852cab
The function was originally designed to remove unwanted options
from the panic kernel command line. It is now also used to check
whether the current command line contains a fadump option or not,
but the check is broken, because remove_from_commandline() may
change the amount (and type) of white space. For example, it
always adds an extra space if the original string ends with a
space.
Modify the function to copy original separators verbatim, except
that any white space preceding the removed option is removed.
Fixes: a4718a2c7b714d0594903fc8dc5ae47252a9b9ba
Signed-off-by: Petr Tesarik <ptesarik@suse.com>
---
init/load.sh | 12 +++++-------
1 file changed, 5 insertions(+), 7 deletions(-)
--- a/init/load.sh
+++ b/init/load.sh
@@ -17,15 +17,13 @@ function remove_from_commandline()
awk 'BEGIN { ORS="" }
{
while(length()) {
- sub(/^[[:space:]]+/,"");
- pstart=match($0,/("[^"]*"?|[^"[:space:]])+/);
- plength=RLENGTH;
- param=substr($0,pstart,plength);
- raw=param;
+ match($0,/^([[:space:]]*)(.*)/,w);
+ match(w[2],/(("[^"]*"?|[^"[:space:]])+)(.*)/,p);
+ raw=p[1];
gsub(/"/,"",raw);
if (raw !~ /^('"$option"')(=|$)/)
- print param " ";
- $0=substr($0,pstart+plength);
+ print w[1] p[1];
+ $0=p[3];
}
print "\n";
}'

View File

@ -1,125 +0,0 @@
From: Petr Tesarik <ptesarik@suse.com>
Date: Fri Mar 5 10:45:03 2021 +0100
Subject: Query systemd network.service to find out if wicked is used
References: bsc#1182309
Upstream: merged
Git-commit: 44a25927a0c234eb1c731b919d16cf282d168138
Even if wicked is installed on a system, network may still be
managed by NetworkManager. Improve the logic by checking the
actual Id of the currently configured network.service.
Signed-off-by: Petr Tesarik <ptesarik@suse.com>
---
init/setup-kdump.functions | 49 ++++++++++++++++++++++++++++++---------------
1 file changed, 33 insertions(+), 16 deletions(-)
--- a/init/setup-kdump.functions
+++ b/init/setup-kdump.functions
@@ -30,6 +30,21 @@ function kdump_route2dev() # {{{
sed -n 's/.* dev \([^ ]*\) *.*/\1/p'
} # }}}
+# Get network manager id
+#
+# Output:
+# network manager identifier ("wicked" or "NetworkManager")
+function kdump_net_manager() # {{{
+{
+ if [ -z "$kdump_cached_net_manager" ] ; then
+ local _id
+ _id=$(systemctl show --property=Id network.service)
+ _id="${_id#Id=}"
+ kdump_cached_net_manager="${_id%.service}"
+ fi
+ echo "$kdump_cached_net_manager"
+} # }}}
+
#
# Get a wicked configuration value for a device
#
@@ -95,17 +110,19 @@ function kdump_netdev_mode() # {
local BOOTPROTO
# get mode using wicked if possible
- if [ -n "$(type -P wicked)" -a \
- "$(kdump_wicked_conf "$ifname" "%{name}")" = "$ifname" ]
+ if [ "$(kdump_net_manager)" = "wicked" ]
then
- local dhcpv4 dhcpv6
- eval $( kdump_wicked_conf "$ifname" \
- "dhcpv4=%{ipv4:dhcp/enabled}" \
- "dhcpv6=%{ipv6:dhcp/enabled}" )
- if [ "$dhcpv4" = true -o "$dhcpv6" = true ] ; then
- BOOTPROTO=dhcp
- else
- BOOTPROTO=static
+ if [ "$(kdump_wicked_conf "$ifname" "%{name}")" = "$ifname" ]
+ then
+ local dhcpv4 dhcpv6
+ eval $( kdump_wicked_conf "$ifname" \
+ "dhcpv4=%{ipv4:dhcp/enabled}" \
+ "dhcpv6=%{ipv6:dhcp/enabled}" )
+ if [ "$dhcpv4" = true -o "$dhcpv6" = true ] ; then
+ BOOTPROTO=dhcp
+ else
+ BOOTPROTO=static
+ fi
fi
fi
@@ -153,7 +170,7 @@ function kdump_ifkind() # {{{
echo ovs-system
# get kind using wicked if possible
- elif [ -n "$(type -P wicked)" ]
+ elif [ "$(kdump_net_manager)" = "wicked" ]
then
local -a elems=(
infiniband
@@ -234,7 +251,7 @@ function kdump_bridge_config() #
local curslaves
# use wicked to read VLAN configuration, if possible
- if [ -n "$(type -P wicked)" ]
+ if [ "$(kdump_net_manager)" = "wicked" ]
then
curslaves=$( kdump_wicked_conf "$bridge" "%{bridge/ports/port/device}" )
fi
@@ -273,7 +290,7 @@ function kdump_bond_config() # {
local curslaves opts
# use wicked to read bonding settings, if possible
- if [ -n "$(type -P wicked)" ]
+ if [ "$(kdump_net_manager)" = "wicked" ]
then
local -a optvars=(
mode arp_interval arp_validate arp_all_targets arp_ip_target
@@ -402,7 +419,7 @@ function kdump_vlan_config() # {
local vid
# use wicked to read VLAN configuration, if possible
- if [ -n "$(type -P wicked)" ]
+ if [ "$(kdump_net_manager)" = "wicked" ]
then
eval $( kdump_wicked_conf "$if" \
"vid=%{vlan/tag}; if=%{vlan/device}" )
@@ -538,7 +555,7 @@ function kdump_ip_routes() # {{{
local _addintf="s/\$/:${_bootif}/p"
# get configured routes using wicked if possible
- if [ -n "$(type -P wicked)" ]
+ if [ "$(kdump_net_manager)" = "wicked" ]
then
wicked show-config | \
wicked xpath --reference \
@@ -619,7 +636,7 @@ function kdump_ip6_routes() # {{
local _addintf="s/\$/:${_bootif}/p"
# get configured routes using wicked if possible
- if [ -n "$(type -P wicked)" ]
+ if [ "$(kdump_net_manager)" = "wicked" ]
then
wicked show-config | \
wicked xpath \

View File

@ -1,49 +0,0 @@
From: Petr Tesarik <ptesarik@suse.com>
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 <ptesarik@suse.com>
---
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());

View File

@ -1,53 +0,0 @@
From 3ea13723f93cc22d163f1f1c8e64ccef3fa32471 Mon Sep 17 00:00:00 2001
From: "Lee, Chun-Yi" <jlee@suse.com>
Date: Tue, 5 Mar 2019 15:06:10 +0800
Subject: Remove noefi and acpi_rsdp for EFI firmware
References: bsc#1123940
Upstream: merged
Git-commit: 3ea13723f93cc22d163f1f1c8e64ccef3fa32471
The noefi and acpi_rsdp can be removed because kernel passes necessary
EFI data for kexec via setup_data since 1fec05336 patch be introduced
in v3.14 kernel. (bsc#1098210)
On the other hand, the MOK (machine owner key) doesn't work with noefi.
It causes that third-party signed kernel modules can not be loaded by
crash kernel. Crash kernel can provide EFI runtime services for loading
MOK after noefi be removed. (bsc#1123940)
The kdump without noefi has been tested on Huawei Kunlun, Intel
minnowboard and KVM-OVMF.
Signed-off-by: Lee, Chun-Yi <jlee@suse.com>
Acked-by: Petr Tesarik <ptesarik@suse.com>
---
init/load.sh | 11 -----------
1 file changed, 11 deletions(-)
--- a/init/load.sh
+++ b/init/load.sh
@@ -5,7 +5,6 @@
KDUMPTOOL=/usr/sbin/kdumptool
KEXEC=/sbin/kexec
-EFI_SYSTAB=/sys/firmware/efi/systab
FADUMP_ENABLED=/sys/kernel/fadump_enabled
FADUMP_REGISTERED=/sys/kernel/fadump_registered
@@ -97,16 +96,6 @@ function build_kdump_commandline()
kernelrelease=$(uname -r)
commandline="$commandline kernelversion=$kernelrelease"
fi
-
- if [ -f /sys/firmware/efi/systab ] ; then
- local acpi_addr
- if grep -q '^ACPI20=' /sys/firmware/efi/systab ; then
- acpi_addr=$(awk -F'=' '/^ACPI20=/ {print $2}' "$EFI_SYSTAB")
- else
- acpi_addr=$(awk -F'=' '/^ACPI=/ {print $2}' "$EFI_SYSTAB")
- fi
- commandline="$commandline noefi acpi_rsdp=$acpi_addr"
- fi
fi
commandline="$commandline $KDUMP_COMMANDLINE_APPEND"

View File

@ -1,54 +0,0 @@
From: Jiri Slaby <jslaby@suse.cz>
Date: Wed, 6 Nov 2019 11:35:50 +0100
Subject: savedump: search also for vmlinux.xz
Patch-mainline: yes
Git-commit: f1ef93a2fd465c6590edddc6dc1fcb3978c7f26b
References: bnc#1155921
See https://bugzilla.suse.com/show_bug.cgi?id=1155921
Signed-off-by: Jiri Slaby <jslaby@suse.cz>
---
kdumptool/savedump.cc | 13 ++++++++++---
1 file changed, 10 insertions(+), 3 deletions(-)
diff --git a/kdumptool/savedump.cc b/kdumptool/savedump.cc
index 282f52e71f66..b8b6be13c3f8 100644
--- a/kdumptool/savedump.cc
+++ b/kdumptool/savedump.cc
@@ -596,7 +596,14 @@ string SaveDump::findKernel()
if (binaryroot.exists())
return binary;
- // 3: vmlinuz (check if ELF file)
+ // 3: vmlinux.xz
+ (binary = "/boot").appendPath("vmlinux-" + m_crashrelease + ".xz");
+ (binaryroot = m_rootdir).appendPath(binary);
+ Debug::debug()->dbg("Trying %s", binaryroot.c_str());
+ if (binaryroot.exists())
+ return binary;
+
+ // 4: vmlinuz (check if ELF file)
(binary = "/boot").appendPath("vmlinuz-" + m_crashrelease);
(binaryroot = m_rootdir).appendPath(binary);
Debug::debug()->dbg("Trying %s", binaryroot.c_str());
@@ -605,14 +612,14 @@ string SaveDump::findKernel()
return binary;
}
- // 4: image
+ // 5: image
(binary = "/boot").appendPath("image-" + m_crashrelease);
(binaryroot = m_rootdir).appendPath(binary);
Debug::debug()->dbg("Trying %s", binaryroot.c_str());
if (binaryroot.exists())
return binary;
- // 5: Image
+ // 6: Image
(binary = "/boot").appendPath("Image-" + m_crashrelease);
(binaryroot = m_rootdir).appendPath(binary);
Debug::debug()->dbg("Trying %s", binaryroot.c_str());
--
2.24.0

View File

@ -1,40 +0,0 @@
From: Petr Tesarik <ptesarik@suse.com>
Date: Mon, 2 Sep 2019 15:27:24 +0200
Subject: Skip kdump-related mounts if there is no /proc/vmcore
References: bsc#1102252, bsc#1125011
Upstream: merged
Git-commit b91c1e16d373e5631ce725acf52db097d8248389
With FADUMP, the same initrd is used for saving a dump and for
normal boot. It is not necessary to mount kdump-related filesystems
on a normal boot, so let's add a systemd condition.
Signed-off-by: Petr Tesarik <ptesarik@suse.com>
---
init/module-setup.sh | 9 +++++++--
1 file changed, 7 insertions(+), 2 deletions(-)
--- a/init/module-setup.sh
+++ b/init/module-setup.sh
@@ -249,13 +249,18 @@ install() {
"$initdir/$systemdsystemunitdir"/kdump-save.service
local _d _mp
+ local _mnt
_d="$initdir/$systemdsystemunitdir"/initrd-switch-root.target.d
mkdir -p "$_d"
(
echo "[Unit]"
for _mp in "${kdump_mnt[@]}" ; do
- echo -n "Conflicts="
- systemd-escape -p --suffix=mount "$_mp"
+ _mnt=$(systemd-escape -p --suffix=mount "$_mp")
+ _d="$initdir/$systemdsystemunitdir/$_mnt".d
+ mkdir -p "$_d"
+ echo -e "[Unit]\nConditionPathExists=/proc/vmcore" \
+ > "$_d"/kdump.conf
+ echo "Conflicts=$_mnt"
done
) > "$_d"/kdump.conf

View File

@ -1,47 +0,0 @@
From: Hari Bathini <hbathini@linux.ibm.com>
Date: Mon, 20 Aug 2018 16:12:46 +0200
Subject: cmdline: split kdump cmdline purpose wise
References: bsc#1101730
Upstream: merged
Git-commit: 56c8821596ee64c400e66002d17449007d1bd5f0
Generate different cmdline files for different purposes. This gives
flexibilty in handling them independently. The subsequent patch uses
this in handling network bringup more gracefully.
Signed-off-by: Hari Bathini <hbathini@linux.ibm.com>
Acked-by: Petr Tesarik <ptesarik@suse.com>
---
init/module-setup.sh | 11 ++++++++---
1 file changed, 8 insertions(+), 3 deletions(-)
--- a/init/module-setup.sh
+++ b/init/module-setup.sh
@@ -205,10 +205,12 @@ kdump_cmdline_ip() {
esac
}
-cmdline() {
+cmdline_zfcp() {
local _arch=$(uname -m)
[ "$_arch" = "s390" -o "$_arch" = "s390x" ] && kdump_cmdline_zfcp
+}
+cmdline_net() {
kdump_cmdline_ip
}
@@ -219,8 +221,11 @@ installkernel() {
install() {
if [[ $hostonly_cmdline == "yes" ]] ; then
- local _cmdline=$(cmdline)
- [ -n "$_cmdline" ] && printf "%s\n" "$_cmdline" >> "${initdir}/etc/cmdline.d/99kdump.conf"
+ local _cmdline=$(cmdline_zfcp)
+ [ -n "$_cmdline" ] && printf "%s\n" "$_cmdline" >> "${initdir}/etc/cmdline.d/99kdump-zfcp.conf"
+
+ _cmdline=$(cmdline_net)
+ [ -n "$_cmdline" ] && printf "%s\n" "$_cmdline" >> "${initdir}/etc/cmdline.d/99kdump-net.conf"
fi
# Get a list of required multipath devices

View File

@ -1,34 +0,0 @@
From: Petr Tesarik <ptesarik@suse.com>
Date: Tue, 25 Sep 2018 09:23:04 +0200
Subject: Turn off NUMA in the kdump kernel
References: bsc#1109784, bsc#1102609
Upstream: merged
Git-commit: 4c0e78b9923f0dbba3ad1bacc2336d91f7b520e5
On NUMA systems, the crashkernel reserved region may get allocated
on a different node than the low region (memory below 4G). With NUMA
optimization turned on, the kernel will prefer node-local pages for
all page allocations, which may unnecessarily deplete the DMA and
DMA32 regions with data that could be allocated from the Normal
zone (which is on a remote node).
It makes little sense to address this corner case in the memory
management system, because nobody would build a machine with almost
all memory on a remote node. So, instead, let's turn off NUMA for
kdump and accept the potential performance hit.
Signed-off-by: Petr Tesarik <ptesarik@suse.com>
---
init/load.sh | 1 +
1 file changed, 1 insertion(+)
--- a/init/load.sh
+++ b/init/load.sh
@@ -73,6 +73,7 @@ function build_kdump_commandline()
fi
# Use deadline for saving the memory footprint
commandline="$commandline elevator=deadline sysrq=yes reset_devices acpi_no_memhotplug cgroup_disable=memory nokaslr"
+ commandline="$commandline numa=off"
commandline="$commandline irqpoll ${nr_cpus}"
commandline="$commandline root=kdump rootflags=bind rd.udev.children-max=8"
case $(uname -i) in

View File

@ -1,3 +1,50 @@
-------------------------------------------------------------------
Fri Mar 5 17:29:57 UTC 2021 - Petr Tesařík <ptesarik@suse.com>
- kdump-mounts.cc-Include-sys-ioctl.h.patch: mounts.cc: Include
<sys/ioctl.h>.
-------------------------------------------------------------------
Fri Mar 5 16:27:03 UTC 2021 - Petr Tesařík <ptesarik@suse.com>
- Update to 0.9.1
* Add build dependency on libmount
* Drop build dependency on OpenSSL
* Build with --stdc=c++11
- Remove patches that have been upstreamed:
* kdump-block-initrd-parse-etc.service.patch
* kdump-fadump-avoid-multipath-optimizations.patch
* kdump-split-cmdline-purpose-wise.patch
* kdump-fadump-fix-network-bring-up.patch
* kdump-fadump-add-udev-support.patch
* kdump-turn-off-NUMA-in-kdump-kernel.patch
* kdump-remove-noefi-and-acpi_rsdp-for-efi-firmware.patch
* kdump-Restore-only-static-routes-in-kdump-initrd.patch
* kdump-fallback-re-register-fadump-from-userspace.patch
* kdump-recover-from-missing-CRASHTIME.patch
* kdump-fix-multipath-user_friendly_names.patch
* kdump-Add-skip_balance-option-to-BTRFS-mounts.patch
* kdump-kdumprd-Look-for-boot-image-and-boot-Image.patch
* kdump-savedump-search-also-for-vmlinux.xz.patch
* kdump-preserve-white-space.patch
* kdump-Clean-up-the-use-of-current-vs-boot-network-iface.patch
* kdump-Use-a-custom-namespace-for-physical-NICs.patch
* kdump-clean-up-kdump-mount-points.patch
* kdump-skip-mounts-if-no-proc-vmcore.patch
* kdump-nss-modules.patch
* kdump-Add-force-option-to-KDUMP_NETCONFIG.patch
* kdump-Add-fence_kdump_send-when-fence-agents-installed.patch
* kdump-FENCE_KDUMP_SEND-variable.patch
* kdump-Document-fence_kdump_send.patch
* kdump-powerpc-no-reload-on-CPU-removal.patch
* kdump-prefer-by-path-and-device-mapper.patch
* kdump-calibrate-Update-values.patch
* kdump-activate-udev-rules-late-during-boot.patch
* kdump-make-sure-that-the-udev-runtime-directory-exists.patch
* kdump-make-sure-that-initrd.target.wants-directory-exists.patch
* kdump-check-explicit-ip-options.patch
* kdump-query-systemd-network.service.patch
------------------------------------------------------------------- -------------------------------------------------------------------
Fri Mar 5 11:02:51 UTC 2021 - Petr Tesařík <ptesarik@suse.com> Fri Mar 5 11:02:51 UTC 2021 - Petr Tesařík <ptesarik@suse.com>

View File

@ -24,7 +24,7 @@
%define dracutlibdir %{_prefix}/lib/dracut %define dracutlibdir %{_prefix}/lib/dracut
Name: kdump Name: kdump
Version: 0.9.0 Version: 0.9.1
Release: 0 Release: 0
Summary: Script for kdump Summary: Script for kdump
License: GPL-2.0-or-later License: GPL-2.0-or-later
@ -33,40 +33,9 @@ URL: https://github.com/openSUSE/kdump
Source: %{name}-%{version}.tar.bz2 Source: %{name}-%{version}.tar.bz2
Source2: %{name}-rpmlintrc Source2: %{name}-rpmlintrc
Patch1: %{name}-fillupdir-fixes.patch Patch1: %{name}-fillupdir-fixes.patch
Patch2: %{name}-block-initrd-parse-etc.service.patch
Patch3: %{name}-fadump-avoid-multipath-optimizations.patch
Patch4: %{name}-split-cmdline-purpose-wise.patch
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 Patch9: %{name}-use-pbl.patch
Patch10: %{name}-on-error-option-yesno.patch Patch10: %{name}-on-error-option-yesno.patch
Patch11: %{name}-Restore-only-static-routes-in-kdump-initrd.patch Patch11: %{name}-mounts.cc-Include-sys-ioctl.h.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
Patch15: %{name}-Add-skip_balance-option-to-BTRFS-mounts.patch
Patch16: %{name}-kdumprd-Look-for-boot-image-and-boot-Image.patch
Patch17: %{name}-savedump-search-also-for-vmlinux.xz.patch
Patch18: %{name}-preserve-white-space.patch
Patch19: %{name}-Clean-up-the-use-of-current-vs-boot-network-iface.patch
Patch20: %{name}-Use-a-custom-namespace-for-physical-NICs.patch
Patch21: %{name}-clean-up-kdump-mount-points.patch
Patch22: %{name}-skip-mounts-if-no-proc-vmcore.patch
Patch23: %{name}-nss-modules.patch
Patch24: %{name}-Add-force-option-to-KDUMP_NETCONFIG.patch
Patch25: %{name}-Add-fence_kdump_send-when-fence-agents-installed.patch
Patch26: %{name}-FENCE_KDUMP_SEND-variable.patch
Patch27: %{name}-Document-fence_kdump_send.patch
Patch28: %{name}-powerpc-no-reload-on-CPU-removal.patch
Patch29: %{name}-prefer-by-path-and-device-mapper.patch
Patch30: %{name}-calibrate-Update-values.patch
Patch31: %{name}-activate-udev-rules-late-during-boot.patch
Patch32: %{name}-make-sure-that-the-udev-runtime-directory-exists.patch
Patch33: %{name}-make-sure-that-initrd.target.wants-directory-exists.patch
Patch34: %{name}-check-explicit-ip-options.patch
Patch35: %{name}-query-systemd-network.service.patch
BuildRequires: asciidoc BuildRequires: asciidoc
BuildRequires: cmake BuildRequires: cmake
BuildRequires: gcc-c++ BuildRequires: gcc-c++
@ -74,7 +43,7 @@ BuildRequires: libblkid-devel
BuildRequires: libcurl-devel BuildRequires: libcurl-devel
BuildRequires: libelf-devel BuildRequires: libelf-devel
BuildRequires: libesmtp-devel BuildRequires: libesmtp-devel
BuildRequires: libopenssl-devel BuildRequires: libmount-devel
BuildRequires: libxslt BuildRequires: libxslt
BuildRequires: pkgconfig BuildRequires: pkgconfig
BuildRequires: zlib-devel BuildRequires: zlib-devel
@ -119,43 +88,12 @@ after a crash dump has occured.
%if 0%{?suse_version} >= 1330 %if 0%{?suse_version} >= 1330
%patch1 -p1 %patch1 -p1
%endif %endif
%patch2 -p1
%patch3 -p1
%patch4 -p1
%patch5 -p1
%patch6 -p1
%patch7 -p1
%patch8 -p1
%patch9 -p1 %patch9 -p1
%patch10 -p1 %patch10 -p1
%patch11 -p1 %patch11 -p1
%patch12 -p1
%patch13 -p1
%patch14 -p1
%patch15 -p1
%patch16 -p1
%patch17 -p1
%patch18 -p1
%patch19 -p1
%patch20 -p1
%patch21 -p1
%patch22 -p1
%patch23 -p1
%patch24 -p1
%patch25 -p1
%patch26 -p1
%patch27 -p1
%patch28 -p1
%patch29 -p1
%patch30 -p1
%patch31 -p1
%patch32 -p1
%patch33 -p1
%patch34 -p1
%patch35 -p1
%build %build
export CXXFLAGS="%{optflags} -std=gnu++98" export CXXFLAGS="%{optflags} -std=c++11"
%cmake %cmake
# for SLE_15 # for SLE_15