2020-10-15 12:45:57 +00:00
|
|
|
#!/bin/bash
|
|
|
|
|
2022-12-14 02:02:00 +00:00
|
|
|
_DRACUT_KDUMP_NM_TMP_DIR="$DRACUT_TMPDIR/$$-DRACUT_KDUMP_NM"
|
2022-11-23 01:42:18 +00:00
|
|
|
|
2022-11-23 01:42:18 +00:00
|
|
|
_save_kdump_netifs() {
|
|
|
|
unique_netifs[$1]=1
|
|
|
|
}
|
|
|
|
|
|
|
|
_get_kdump_netifs() {
|
|
|
|
echo -n "${!unique_netifs[@]}"
|
|
|
|
}
|
|
|
|
|
2021-01-22 08:12:00 +00:00
|
|
|
kdump_module_init() {
|
|
|
|
if ! [[ -d "${initdir}/tmp" ]]; then
|
|
|
|
mkdir -p "${initdir}/tmp"
|
|
|
|
fi
|
2020-10-15 12:45:57 +00:00
|
|
|
|
2022-11-23 01:42:18 +00:00
|
|
|
mkdir -p "$_DRACUT_KDUMP_NM_TMP_DIR"
|
|
|
|
|
2021-01-22 08:12:00 +00:00
|
|
|
. /lib/kdump/kdump-lib.sh
|
|
|
|
}
|
2020-10-15 12:45:57 +00:00
|
|
|
|
|
|
|
check() {
|
|
|
|
[[ $debug ]] && set -x
|
|
|
|
#kdumpctl sets this explicitly
|
2021-11-09 13:42:45 +00:00
|
|
|
if [[ -z $IN_KDUMP ]] || [[ ! -f /etc/kdump.conf ]]; then
|
2020-10-15 12:45:57 +00:00
|
|
|
return 1
|
|
|
|
fi
|
|
|
|
return 0
|
|
|
|
}
|
|
|
|
|
|
|
|
depends() {
|
|
|
|
local _dep="base shutdown"
|
|
|
|
|
2021-01-22 08:12:00 +00:00
|
|
|
kdump_module_init
|
|
|
|
|
2020-11-20 12:35:49 +00:00
|
|
|
add_opt_module() {
|
|
|
|
[[ " $omit_dracutmodules " != *\ $1\ * ]] && _dep="$_dep $1"
|
|
|
|
}
|
|
|
|
|
2021-07-12 08:07:05 +00:00
|
|
|
if is_squash_available; then
|
2020-11-20 12:35:49 +00:00
|
|
|
add_opt_module squash
|
2020-10-15 12:45:57 +00:00
|
|
|
else
|
|
|
|
dwarning "Required modules to build a squashed kdump image is missing!"
|
|
|
|
fi
|
|
|
|
|
2020-11-20 12:35:49 +00:00
|
|
|
if is_wdt_active; then
|
|
|
|
add_opt_module watchdog
|
|
|
|
fi
|
|
|
|
|
|
|
|
if is_ssh_dump_target; then
|
|
|
|
_dep="$_dep ssh-client"
|
|
|
|
fi
|
|
|
|
|
2022-11-09 07:58:30 +00:00
|
|
|
if is_lvm2_thinp_dump_target; then
|
|
|
|
if grep -q lvmthinpool-monitor <<< $(dracut --list-modules); then
|
|
|
|
add_opt_module lvmthinpool-monitor
|
|
|
|
else
|
|
|
|
dwarning "Required lvmthinpool-monitor modules is missing! Please upgrade dracut >= 057."
|
|
|
|
fi
|
|
|
|
fi
|
|
|
|
|
2021-11-09 13:42:45 +00:00
|
|
|
if [[ "$(uname -m)" == "s390x" ]]; then
|
2020-11-20 12:35:49 +00:00
|
|
|
_dep="$_dep znet"
|
|
|
|
fi
|
|
|
|
|
2021-11-09 13:42:45 +00:00
|
|
|
if [[ -n "$(ls -A /sys/class/drm 2> /dev/null)" ]] || [[ -d /sys/module/hyperv_fb ]]; then
|
2020-11-20 12:35:49 +00:00
|
|
|
add_opt_module drm
|
2020-10-15 12:45:57 +00:00
|
|
|
fi
|
|
|
|
|
|
|
|
if is_generic_fence_kdump || is_pcs_fence_kdump; then
|
|
|
|
_dep="$_dep network"
|
|
|
|
fi
|
|
|
|
|
2021-11-09 13:27:55 +00:00
|
|
|
echo "$_dep"
|
2020-10-15 12:45:57 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
kdump_is_bridge() {
|
2021-11-09 13:42:45 +00:00
|
|
|
[[ -d /sys/class/net/"$1"/bridge ]]
|
2020-10-15 12:45:57 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
kdump_is_bond() {
|
2021-11-09 13:42:45 +00:00
|
|
|
[[ -d /sys/class/net/"$1"/bonding ]]
|
2020-10-15 12:45:57 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
kdump_is_team() {
|
2021-11-09 13:42:45 +00:00
|
|
|
[[ -f /usr/bin/teamnl ]] && teamnl "$1" ports &> /dev/null
|
2020-10-15 12:45:57 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
kdump_is_vlan() {
|
2021-11-09 13:42:45 +00:00
|
|
|
[[ -f /proc/net/vlan/"$1" ]]
|
2020-10-15 12:45:57 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
# $1: netdev name
|
|
|
|
source_ifcfg_file() {
|
|
|
|
local ifcfg_file
|
|
|
|
|
2021-05-14 01:30:08 +00:00
|
|
|
dwarning "Network Scripts are deprecated. You are encouraged to set up network by NetworkManager."
|
2021-11-09 13:27:55 +00:00
|
|
|
ifcfg_file=$(get_ifcfg_filename "$1")
|
2021-11-09 13:42:45 +00:00
|
|
|
if [[ -f ${ifcfg_file} ]]; then
|
2021-11-09 13:27:55 +00:00
|
|
|
. "${ifcfg_file}"
|
2020-10-15 12:45:57 +00:00
|
|
|
else
|
|
|
|
dwarning "The ifcfg file of $1 is not found!"
|
|
|
|
fi
|
|
|
|
}
|
|
|
|
|
2021-05-11 05:18:43 +00:00
|
|
|
# $1: repeat times
|
|
|
|
# $2: string to be repeated
|
|
|
|
# $3: separator
|
|
|
|
repeatedly_join_str() {
|
|
|
|
local _count="$1"
|
|
|
|
local _str="$2"
|
|
|
|
local _separator="$3"
|
|
|
|
local i _res
|
|
|
|
|
2021-11-09 13:42:45 +00:00
|
|
|
if [[ $_count -le 0 ]]; then
|
2021-05-11 05:18:43 +00:00
|
|
|
echo -n ""
|
|
|
|
return
|
|
|
|
fi
|
|
|
|
|
|
|
|
i=0
|
|
|
|
_res="$_str"
|
|
|
|
((_count--))
|
|
|
|
|
2021-11-09 13:42:45 +00:00
|
|
|
while [[ $i -lt $_count ]]; do
|
2021-05-11 05:18:43 +00:00
|
|
|
((i++))
|
|
|
|
_res="${_res}${_separator}${_str}"
|
|
|
|
done
|
|
|
|
echo -n "$_res"
|
|
|
|
}
|
|
|
|
|
|
|
|
# $1: prefix
|
|
|
|
# $2: ipv6_flag="-6" indicates it's IPv6
|
|
|
|
# Given a prefix, calculate the netmask (equivalent of "ipcalc -m")
|
|
|
|
# by concatenating three parts,
|
|
|
|
# 1) the groups with all bits set 1
|
|
|
|
# 2) a group with partial bits set to 0
|
|
|
|
# 3) the groups with all bits set to 0
|
|
|
|
cal_netmask_by_prefix() {
|
|
|
|
local _prefix="$1"
|
|
|
|
local _ipv6_flag="$2" _ipv6
|
|
|
|
local _bits_per_octet=8
|
|
|
|
local _count _res _octets_per_group _octets_total _seperator _total_groups
|
|
|
|
local _max_group_value _max_group_value_repr _bits_per_group _tmp _zero_bits
|
|
|
|
|
2021-11-09 13:42:45 +00:00
|
|
|
if [[ $_ipv6_flag == "-6" ]]; then
|
2021-05-11 05:18:43 +00:00
|
|
|
_ipv6=1
|
|
|
|
else
|
|
|
|
_ipv6=0
|
|
|
|
fi
|
|
|
|
|
2021-11-09 13:42:45 +00:00
|
|
|
if [[ $_prefix -lt 0 || $_prefix -gt 128 ]] \
|
|
|
|
|| ( ((!_ipv6)) && [[ $_prefix -gt 32 ]]); then
|
2021-05-11 05:18:43 +00:00
|
|
|
derror "Bad prefix:$_prefix for calculating netmask"
|
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
|
|
|
|
if ((_ipv6)); then
|
|
|
|
_octets_per_group=2
|
|
|
|
_octets_total=16
|
|
|
|
_seperator=":"
|
|
|
|
else
|
|
|
|
_octets_per_group=1
|
|
|
|
_octets_total=4
|
|
|
|
_seperator="."
|
|
|
|
fi
|
|
|
|
|
2021-11-09 13:42:45 +00:00
|
|
|
_total_groups=$((_octets_total / _octets_per_group))
|
2021-05-11 05:18:43 +00:00
|
|
|
_bits_per_group=$((_octets_per_group * _bits_per_octet))
|
|
|
|
_max_group_value=$(((1 << _bits_per_group) - 1))
|
|
|
|
|
|
|
|
if ((_ipv6)); then
|
|
|
|
_max_group_value_repr=$(printf "%x" $_max_group_value)
|
|
|
|
else
|
|
|
|
_max_group_value_repr="$_max_group_value"
|
|
|
|
fi
|
|
|
|
|
2021-11-09 13:42:45 +00:00
|
|
|
_count=$((_prefix / _octets_per_group / _bits_per_octet))
|
2021-05-11 05:18:43 +00:00
|
|
|
_first_part=$(repeatedly_join_str "$_count" "$_max_group_value_repr" "$_seperator")
|
|
|
|
_res="$_first_part"
|
|
|
|
|
2021-11-09 13:42:45 +00:00
|
|
|
_tmp=$((_octets_total * _bits_per_octet - _prefix))
|
2021-11-03 08:19:07 +00:00
|
|
|
_zero_bits=$((_tmp % _bits_per_group))
|
2021-11-09 13:42:45 +00:00
|
|
|
if [[ $_zero_bits -ne 0 ]]; then
|
2021-05-11 05:18:43 +00:00
|
|
|
_second_part=$((_max_group_value >> _zero_bits << _zero_bits))
|
|
|
|
if ((_ipv6)); then
|
|
|
|
_second_part=$(printf "%x" $_second_part)
|
|
|
|
fi
|
|
|
|
((_count++))
|
2021-11-09 13:42:45 +00:00
|
|
|
if [[ -z $_first_part ]]; then
|
2021-05-11 05:18:43 +00:00
|
|
|
_res="$_second_part"
|
|
|
|
else
|
|
|
|
_res="${_first_part}${_seperator}${_second_part}"
|
|
|
|
fi
|
|
|
|
fi
|
|
|
|
|
2021-11-09 13:42:45 +00:00
|
|
|
_count=$((_total_groups - _count))
|
|
|
|
if [[ $_count -eq 0 ]]; then
|
2021-05-11 05:18:43 +00:00
|
|
|
echo -n "$_res"
|
|
|
|
return
|
|
|
|
fi
|
|
|
|
|
2021-11-09 13:42:45 +00:00
|
|
|
if ((_ipv6)) && [[ $_count -gt 1 ]]; then
|
2021-05-11 05:18:43 +00:00
|
|
|
# use condensed notion for IPv6
|
|
|
|
_third_part=":"
|
|
|
|
else
|
|
|
|
_third_part=$(repeatedly_join_str "$_count" "0" "$_seperator")
|
|
|
|
fi
|
|
|
|
|
2021-11-09 13:42:45 +00:00
|
|
|
if [[ -z $_res ]] && ((!_ipv6)); then
|
2021-05-11 05:18:43 +00:00
|
|
|
echo -n "${_third_part}"
|
|
|
|
else
|
|
|
|
echo -n "${_res}${_seperator}${_third_part}"
|
|
|
|
fi
|
|
|
|
}
|
|
|
|
|
2020-10-15 12:45:57 +00:00
|
|
|
kdump_get_mac_addr() {
|
2021-11-09 13:27:55 +00:00
|
|
|
cat "/sys/class/net/$1/address"
|
2020-10-15 12:45:57 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
#Bonding or team master modifies the mac address
|
|
|
|
#of its slaves, we should use perm address
|
|
|
|
kdump_get_perm_addr() {
|
2021-11-03 09:30:56 +00:00
|
|
|
local addr
|
|
|
|
addr=$(ethtool -P "$1" | sed -e 's/Permanent address: //')
|
2021-11-09 13:42:45 +00:00
|
|
|
if [[ -z $addr ]] || [[ $addr == "00:00:00:00:00:00" ]]; then
|
2020-10-15 12:45:57 +00:00
|
|
|
derror "Can't get the permanent address of $1"
|
|
|
|
else
|
|
|
|
echo "$addr"
|
|
|
|
fi
|
|
|
|
}
|
|
|
|
|
2022-11-23 01:42:18 +00:00
|
|
|
apply_nm_initrd_generator_timeouts() {
|
|
|
|
local _timeout_conf
|
|
|
|
|
|
|
|
_timeout_conf=$_DRACUT_KDUMP_NM_TMP_DIR/timeout_conf
|
|
|
|
cat << EOF > "$_timeout_conf"
|
|
|
|
[device-95-kdump]
|
|
|
|
carrier-wait-timeout=30000
|
|
|
|
|
|
|
|
[connection-95-kdump]
|
|
|
|
ipv4.dhcp-timeout=90
|
|
|
|
ipv6.dhcp-timeout=90
|
|
|
|
EOF
|
|
|
|
|
|
|
|
inst "$_timeout_conf" "/etc/NetworkManager/conf.d/95-kdump-timeouts.conf"
|
|
|
|
}
|
|
|
|
|
2022-11-23 01:42:18 +00:00
|
|
|
use_ipv4_or_ipv6() {
|
|
|
|
local _netif=$1 _uuid=$2
|
|
|
|
|
|
|
|
if [[ -v "ipv4_usage[$_netif]" ]]; then
|
|
|
|
nmcli connection modify --temporary "$_uuid" ipv4.may-fail no &> >(ddebug)
|
|
|
|
fi
|
|
|
|
|
|
|
|
if [[ -v "ipv6_usage[$_netif]" ]]; then
|
|
|
|
nmcli connection modify --temporary "$_uuid" ipv6.may-fail no &> >(ddebug)
|
|
|
|
fi
|
|
|
|
|
|
|
|
if [[ -v "ipv4_usage[$_netif]" ]] && [[ ! -v "ipv6_usage[$_netif]" ]]; then
|
|
|
|
nmcli connection modify --temporary "$_uuid" ipv6.method disabled &> >(ddebug)
|
|
|
|
elif [[ ! -v "ipv4_usage[$_netif]" ]] && [[ -v "ipv6_usage[$_netif]" ]]; then
|
|
|
|
nmcli connection modify --temporary "$_uuid" ipv4.method disabled &> >(ddebug)
|
|
|
|
fi
|
|
|
|
}
|
|
|
|
|
2022-11-23 01:42:18 +00:00
|
|
|
_clone_nmconnection() {
|
|
|
|
local _clone_output _name _unique_id
|
|
|
|
|
|
|
|
_unique_id=$1
|
|
|
|
_name=$(nmcli --get-values connection.id connection show "$_unique_id")
|
|
|
|
if _clone_output=$(nmcli connection clone --temporary uuid "$_unique_id" "$_name"); then
|
|
|
|
sed -E -n "s/.* \(.*\) cloned as.*\((.*)\)\.$/\1/p" <<< "$_clone_output"
|
|
|
|
return 0
|
|
|
|
fi
|
|
|
|
|
|
|
|
return 1
|
|
|
|
}
|
|
|
|
|
2022-11-23 01:42:18 +00:00
|
|
|
_match_nmconnection_by_mac() {
|
|
|
|
local _unique_id _dev _mac _mac_field
|
|
|
|
|
|
|
|
_unique_id=$1
|
|
|
|
_dev=$2
|
|
|
|
|
|
|
|
_mac=$(kdump_get_perm_addr "$_dev")
|
|
|
|
[[ $_mac != 'not set' ]] || return
|
|
|
|
_mac_field=$(nmcli --get-values connection.type connection show "$_unique_id").mac-address
|
|
|
|
nmcli connection modify --temporary "$_unique_id" "$_mac_field" "$_mac" &> >(ddebug)
|
|
|
|
nmcli connection modify --temporary "$_unique_id" "connection.interface-name" "" &> >(ddebug)
|
|
|
|
}
|
|
|
|
|
2022-11-23 01:42:18 +00:00
|
|
|
# Clone and modify NM connection profiles
|
|
|
|
#
|
|
|
|
# This function makes use of "nmcli clone" to automatically convert ifcfg-*
|
|
|
|
# files to Networkmanager .nmconnection connection profiles and also modify the
|
|
|
|
# properties of .nmconnection if necessary.
|
|
|
|
clone_and_modify_nmconnection() {
|
|
|
|
local _dev _cloned_nmconnection_file_path _tmp_nmconnection_file_path _old_uuid _uuid
|
|
|
|
|
|
|
|
_dev=$1
|
|
|
|
_nmconnection_file_path=$2
|
|
|
|
|
|
|
|
_old_uuid=$(nmcli --get-values connection.uuid connection show filename "$_nmconnection_file_path")
|
|
|
|
|
|
|
|
if ! _uuid=$(_clone_nmconnection "$_old_uuid"); then
|
|
|
|
derror "Failed to clone $_old_uuid"
|
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
|
2022-11-23 01:42:18 +00:00
|
|
|
use_ipv4_or_ipv6 "$_dev" "$_uuid"
|
|
|
|
|
2022-11-23 01:42:18 +00:00
|
|
|
nmcli connection modify --temporary uuid "$_uuid" connection.wait-device-timeout 60000 &> >(ddebug)
|
2022-11-23 01:42:18 +00:00
|
|
|
# For physical NIC i.e. non-user created NIC, ask NM to match a
|
|
|
|
# connection profile based on MAC address
|
|
|
|
_match_nmconnection_by_mac "$_uuid" "$_dev"
|
|
|
|
|
2023-04-18 07:25:48 +00:00
|
|
|
# If a value contain ":", nmcli by default escape it with "\:" because it
|
|
|
|
# also uses ":" as the delimiter to separate values. In our case, escaping is not needed.
|
|
|
|
_cloned_nmconnection_file_path=$(nmcli --escape no --get-values UUID,FILENAME connection show | sed -n "s/^${_uuid}://p")
|
2022-11-23 01:42:18 +00:00
|
|
|
_tmp_nmconnection_file_path=$_DRACUT_KDUMP_NM_TMP_DIR/$(basename "$_nmconnection_file_path")
|
|
|
|
cp "$_cloned_nmconnection_file_path" "$_tmp_nmconnection_file_path"
|
|
|
|
# change uuid back to old value in case it's refered by other connection
|
|
|
|
# profile e.g. connection.master could be interface name of the master
|
|
|
|
# device or UUID of the master connection.
|
|
|
|
sed -i -E "s/(^uuid=).*$/\1${_old_uuid}/g" "$_tmp_nmconnection_file_path"
|
|
|
|
nmcli connection del "$_uuid" &> >(ddebug)
|
|
|
|
echo -n "$_tmp_nmconnection_file_path"
|
|
|
|
}
|
|
|
|
|
|
|
|
_install_nmconnection() {
|
|
|
|
local _src _nmconnection_name _dst
|
|
|
|
|
|
|
|
_src=$1
|
|
|
|
_nmconnection_name=$(basename "$_src")
|
|
|
|
_dst="/etc/NetworkManager/system-connections/$_nmconnection_name"
|
|
|
|
inst "$_src" "$_dst"
|
|
|
|
}
|
|
|
|
|
|
|
|
kdump_install_nmconnections() {
|
|
|
|
local _netif _nm_conn_path _cloned_nm_path
|
|
|
|
|
|
|
|
while IFS=: read -r _netif _nm_conn_path; do
|
|
|
|
[[ -v "unique_netifs[$_netif]" ]] || continue
|
|
|
|
if _cloned_nm_path=$(clone_and_modify_nmconnection "$_netif" "$_nm_conn_path"); then
|
|
|
|
_install_nmconnection "$_cloned_nm_path"
|
|
|
|
else
|
|
|
|
derror "Failed to install the .nmconnection for $_netif"
|
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
done <<< "$(nmcli -t -f device,filename connection show --active)"
|
2022-11-23 01:42:18 +00:00
|
|
|
|
|
|
|
# Stop dracut 35network-manger to calling nm-initrd-generator.
|
|
|
|
# Note this line of code can be removed after NetworkManager >= 1.35.2
|
|
|
|
# gets released.
|
|
|
|
echo > "${initdir}/usr/libexec/nm-initrd-generator"
|
2022-11-23 01:42:18 +00:00
|
|
|
}
|
|
|
|
|
2022-11-23 01:42:18 +00:00
|
|
|
kdump_install_nm_netif_allowlist() {
|
|
|
|
local _netif _except_netif _netif_allowlist _netif_allowlist_nm_conf
|
|
|
|
|
|
|
|
for _netif in $1; do
|
|
|
|
_per_mac=$(kdump_get_perm_addr "$_netif")
|
|
|
|
if [[ "$_per_mac" != 'not set' ]]; then
|
|
|
|
_except_netif="mac:$_per_mac"
|
|
|
|
else
|
|
|
|
_except_netif="interface-name:$_netif"
|
|
|
|
fi
|
|
|
|
_netif_allowlist="${_netif_allowlist}except:${_except_netif};"
|
|
|
|
done
|
|
|
|
|
|
|
|
_netif_allowlist_nm_conf=$_DRACUT_KDUMP_NM_TMP_DIR/netif_allowlist_nm_conf
|
|
|
|
cat << EOF > "$_netif_allowlist_nm_conf"
|
|
|
|
[device-others]
|
|
|
|
match-device=${_netif_allowlist}
|
|
|
|
managed=false
|
|
|
|
EOF
|
|
|
|
|
|
|
|
inst "$_netif_allowlist_nm_conf" "/etc/NetworkManager/conf.d/10-kdump-netif_allowlist.conf"
|
|
|
|
}
|
|
|
|
|
2022-11-23 01:42:18 +00:00
|
|
|
_get_nic_driver() {
|
|
|
|
ethtool -i "$1" | sed -n -E "s/driver: (.*)/\1/p"
|
|
|
|
}
|
|
|
|
|
2022-12-21 01:27:44 +00:00
|
|
|
_get_hpyerv_physical_driver() {
|
|
|
|
local _physical_nic
|
|
|
|
|
|
|
|
_physical_nic=$(find /sys/class/net/"$1"/ -name 'lower_*' | sed -En "s/\/.*lower_(.*)/\1/p")
|
|
|
|
[[ -n $_physical_nic ]] || return
|
|
|
|
_get_nic_driver "$_physical_nic"
|
|
|
|
}
|
|
|
|
|
2024-05-09 05:41:05 +00:00
|
|
|
_get_physical_function_driver() {
|
|
|
|
local _physfn_dir=/sys/class/net/"$1"/device/physfn
|
|
|
|
|
|
|
|
if [[ -e "$_physfn_dir" ]]; then
|
|
|
|
basename "$(readlink -f "$_physfn_dir"/driver)"
|
|
|
|
fi
|
|
|
|
}
|
|
|
|
|
2022-11-23 01:42:18 +00:00
|
|
|
kdump_install_nic_driver() {
|
|
|
|
local _netif _driver _drivers
|
|
|
|
|
2024-05-09 05:40:43 +00:00
|
|
|
_drivers=('=drivers/net/phy' '=drivers/net/mdio')
|
2022-11-23 01:42:18 +00:00
|
|
|
|
|
|
|
for _netif in $1; do
|
2022-12-22 06:17:05 +00:00
|
|
|
[[ $_netif == lo ]] && continue
|
2022-11-23 01:42:18 +00:00
|
|
|
_driver=$(_get_nic_driver "$_netif")
|
|
|
|
if [[ -z $_driver ]]; then
|
|
|
|
derror "Failed to get the driver of $_netif"
|
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
|
|
|
|
if [[ $_driver == "802.1Q VLAN Support" ]]; then
|
|
|
|
# ethtool somehow doesn't return the driver name for a VLAN NIC
|
|
|
|
_driver=8021q
|
|
|
|
elif [[ $_driver == "team" ]]; then
|
|
|
|
# install the team mode drivers like team_mode_roundrobin.ko as well
|
|
|
|
_driver='=drivers/net/team'
|
2022-12-21 01:27:44 +00:00
|
|
|
elif [[ $_driver == "hv_netvsc" ]]; then
|
|
|
|
# A Hyper-V VM may have accelerated networking
|
|
|
|
# https://learn.microsoft.com/en-us/azure/virtual-network/accelerated-networking-overview
|
|
|
|
# Install the driver of physical NIC as well
|
|
|
|
_drivers+=("$(_get_hpyerv_physical_driver "$_netif")")
|
2022-11-23 01:42:18 +00:00
|
|
|
fi
|
|
|
|
|
|
|
|
_drivers+=("$_driver")
|
2024-05-09 05:41:05 +00:00
|
|
|
# For a Single Root I/O Virtualization (SR-IOV) virtual device,
|
|
|
|
# the driver of physical device needs to be installed as well
|
|
|
|
_drivers+=("$(_get_physical_function_driver "$_netif")")
|
2022-11-23 01:42:18 +00:00
|
|
|
done
|
|
|
|
|
2022-12-22 06:17:05 +00:00
|
|
|
[[ -n ${_drivers[*]} ]] || return
|
2022-11-23 01:42:18 +00:00
|
|
|
instmods "${_drivers[@]}"
|
|
|
|
}
|
|
|
|
|
2020-10-15 12:45:57 +00:00
|
|
|
kdump_setup_bridge() {
|
|
|
|
local _netdev=$1
|
2022-11-23 01:42:18 +00:00
|
|
|
local _dev
|
2021-11-03 07:46:32 +00:00
|
|
|
for _dev in "/sys/class/net/$_netdev/brif/"*; do
|
|
|
|
[[ -e $_dev ]] || continue
|
|
|
|
_dev=${_dev##*/}
|
2020-10-15 12:45:57 +00:00
|
|
|
if kdump_is_bond "$_dev"; then
|
2022-11-23 01:42:18 +00:00
|
|
|
kdump_setup_bond "$_dev" || return 1
|
2020-10-15 12:45:57 +00:00
|
|
|
elif kdump_is_team "$_dev"; then
|
|
|
|
kdump_setup_team "$_dev"
|
|
|
|
elif kdump_is_vlan "$_dev"; then
|
|
|
|
kdump_setup_vlan "$_dev"
|
|
|
|
fi
|
2022-11-23 01:42:18 +00:00
|
|
|
_save_kdump_netifs "$_dev"
|
2020-10-15 12:45:57 +00:00
|
|
|
done
|
|
|
|
}
|
|
|
|
|
|
|
|
kdump_setup_bond() {
|
2021-05-14 01:30:08 +00:00
|
|
|
local _netdev="$1"
|
2022-11-23 01:42:18 +00:00
|
|
|
local _dev
|
2020-10-15 12:45:57 +00:00
|
|
|
|
2022-11-23 01:42:18 +00:00
|
|
|
for _dev in $(< "/sys/class/net/$_netdev/bonding/slaves"); do
|
|
|
|
_save_kdump_netifs "$_dev"
|
|
|
|
done
|
2020-10-15 12:45:57 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
kdump_setup_team() {
|
|
|
|
local _netdev=$1
|
2022-11-23 01:42:18 +00:00
|
|
|
local _dev
|
2021-11-09 13:27:55 +00:00
|
|
|
for _dev in $(teamnl "$_netdev" ports | awk -F':' '{print $2}'); do
|
2022-11-23 01:42:18 +00:00
|
|
|
_save_kdump_netifs "$_dev"
|
2020-10-15 12:45:57 +00:00
|
|
|
done
|
|
|
|
}
|
|
|
|
|
|
|
|
kdump_setup_vlan() {
|
|
|
|
local _netdev=$1
|
2022-11-23 01:42:18 +00:00
|
|
|
local _parent_netif
|
2020-10-15 12:45:57 +00:00
|
|
|
|
2022-11-23 01:42:18 +00:00
|
|
|
_parent_netif="$(awk '/^Device:/{print $2}' /proc/net/vlan/"$_netdev")"
|
2021-11-03 09:30:56 +00:00
|
|
|
|
2020-11-30 11:50:38 +00:00
|
|
|
#Just support vlan over bond and team
|
2022-11-23 01:42:18 +00:00
|
|
|
if kdump_is_bridge "$_parent_netif"; then
|
2020-10-15 12:45:57 +00:00
|
|
|
derror "Vlan over bridge is not supported!"
|
|
|
|
exit 1
|
2022-11-23 01:42:18 +00:00
|
|
|
elif kdump_is_bond "$_parent_netif"; then
|
|
|
|
kdump_setup_bond "$_parent_netif" || return 1
|
|
|
|
elif kdump_is_team "$_parent_netif"; then
|
|
|
|
kdump_setup_team "$_parent_netif" || return 1
|
2020-10-15 12:45:57 +00:00
|
|
|
fi
|
2022-11-23 01:42:18 +00:00
|
|
|
|
|
|
|
_save_kdump_netifs "$_parent_netif"
|
2020-10-15 12:45:57 +00:00
|
|
|
}
|
|
|
|
|
2022-11-23 01:42:33 +00:00
|
|
|
_find_znet_nmconnection() {
|
|
|
|
LANG=C grep -s -E -i -l \
|
|
|
|
"^s390-subchannels=([0-9]\.[0-9]\.[a-f0-9]+;){0,2}" \
|
|
|
|
"$1"/*.nmconnection | LC_ALL=C sed -e "$2"
|
2021-06-08 05:27:04 +00:00
|
|
|
}
|
|
|
|
|
Support setting up Open vSwitch (Ovs) Bridge network
Resolves: https://issues.redhat.com/browse/RHEL-33465
Conflict: C9S misses the following two commits,
- 1397006 ("dracut-module-setup: Remove remove_cpu_online_rule() since PowerPC uses nr_cpus")
- 73c9eb7 ("dracut-module-setup: remove old s390 network device config (#1937048)")
Upstream Status: git@github.com:rhkdump/kdump-utils.git
commit 224d3102c54749eae98bfa1af8932aade8e4d2da
Author: Coiby Xu <coxu@redhat.com>
Date: Mon Apr 22 15:02:42 2024 +0800
Support setting up Open vSwitch (Ovs) Bridge network
Resolves: https://issues.redhat.com/browse/RHEL-33465
This patch supports setting up an Ovs bridge in kdump initrd. An Ovs
bridge is similar to a classic Linux bridge but we use ovs-vsctl to find
out the Ethernet device (having the MAC address as the bridge) added to
an Ovs bridge. Once we copy all the needed NetworkManager (NM) connection
profiles to kdump initrd and all the necessary files, NM will create an Ovs bridge
automatically in kdump initrd.
In the case of OpenShift Container Platform (OCP),
ovs-configuration.service [1] is responsible for setting up an Ovs bridge.
In theory, we can also try to bring up the original physical network
interface before ovs-configuration.service. But this approach is
cumbersome because it breaks our assumption that we should bring up the
same network in kdump intrd as in 1st kernel (establishing the same network
in kdump initrd only needs to copy the needed NM connection profiles
thus we don't need to learn how different network setup work under the
hood).
How to test this patch with the help of configure-ovs.sh?
=========================================================
1. Extract configure-ovs.sh from [2]
2. Install necessary packages for configure-ovs.sh
dnf install openvswitch -yq
dnf install NetworkManager-ovs nmap-ncat -yq
systemctl enable --now openvswitch
# restart NM so the ovs plugin can be activated
systemctl restart NetworkManager
3. Assume the network interface used for creating an Ovs bridge is
"ens2", use configure-ovs.sh to create an Ovs bridge,
interface=ens2
mkdir -p /etc/ovnk
echo $interface > /etc/ovnk/iface_default_hint
bash configure-ovs.sh OVNKubernetes
4. (Optional) If you want to make the created Ovs bridge survive a
reboot, simply make the created NM connections created by
configure-ovs.sh persist,
cp /run/NetworkManager/system-connections/ovs-* /etc/NetworkManager/system-connections/
If you need to create an Ovs bridge on top of a bonding network, use the
following commands for step 3,
nmcli con add type bond ifname bond0
nmcli con add type ethernet ifname eth0 master bond0
nmcli con add type ethernet ifname eth1 master bond0
echo bond0 > /etc/ovnk/iface_default_hint
bash configure-ovs.sh OVNKubernetes
Note
1. For RHEL, openvswitch3.3 may be installed so we need to get the
package name by "rpm -qf /usr/lib/systemd/system/openvswitch.service"
2. For RHEL9, openvswitch package needs to installed from another repo,
cat << 'EOF' > /etc/yum.repos.d/ovs.repo
[rhosp-rhel-9-fdp-cdn]
name=Red Hat Enterprise Linux Fast Datapath $releasever - $basearch cdn
baseurl=http://rhsm-pulp.corp.redhat.com/content/dist/layered/rhel9/$basearch/fast-datapath/os/
enabled=1
gpgcheck=0
EOF
dnf install openvswitch3.3 -yq
3. We instruct ovsdb-server to ignore NM connection files changes by
"--ovsdb-server-options='--disable-file-column-diff'". In the
future, this may not be needed if we simply copy all active NM
connection profiles to kdump initrd without changing them after
coming up with different solutions for the following cases,
1. Some environments like some Azure machine doesn't use persistent
NIC name. Current solution is to modify a NM connection
profile to match a device by MAC address, for details check
commit 568623e)
2. If a NIC has an IPv4 or IPv6 address, set the corresponding
may-fail property to no. Otherwise, dumping vmcore over IPv6
could fail because only IPv4 network is ready or vice versa. Current
solution is to disable IPv6 if only IPv4 is used and vice versa,
for details check commit 9dfcacf,
3. Some NICs need longer connection.wait-device-timeout otherwise
the connection will fail to be established (commit 6b586a9).
[1] https://github.com/openshift/machine-config-operator/blob/master/templates/common/_base/units/ovs-configuration.service.yaml
[2] https://github.com/openshift/machine-config-operator/blob/master/templates/common/_base/files/configure-ovs-network.yaml
Signed-off-by: Coiby Xu <coxu@redhat.com>
Signed-off-by: Coiby Xu <coxu@redhat.com>
2024-07-29 09:21:41 +00:00
|
|
|
kdump_setup_ovs() {
|
|
|
|
local _netdev="$1"
|
|
|
|
local _dev _phy_if
|
|
|
|
|
|
|
|
_phy_if=$(ovs_find_phy_if "$_netdev")
|
|
|
|
|
|
|
|
if kdump_is_bridge "$_phy_if"; then
|
|
|
|
kdump_setup_vlan "$_phy_if"
|
|
|
|
elif kdump_is_bond "$_phy_if"; then
|
|
|
|
kdump_setup_bond "$_phy_if" || return 1
|
|
|
|
elif kdump_is_team "$_phy_if"; then
|
|
|
|
derror "Ovs bridge over team is not supported!"
|
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
|
|
|
|
_save_kdump_netifs "$_phy_if"
|
|
|
|
}
|
|
|
|
|
2022-11-23 01:42:33 +00:00
|
|
|
# setup s390 znet
|
|
|
|
#
|
|
|
|
# Note part of code is extracted from ccw_init provided by s390utils
|
2020-10-15 12:45:57 +00:00
|
|
|
kdump_setup_znet() {
|
2022-11-23 01:42:33 +00:00
|
|
|
local _config_file _unique_name _NM_conf_dir
|
|
|
|
local __sed_discard_ignored_files='/\(~\|\.bak\|\.old\|\.orig\|\.rpmnew\|\.rpmorig\|\.rpmsave\)$/d'
|
2021-05-14 01:30:08 +00:00
|
|
|
|
2022-11-23 01:42:33 +00:00
|
|
|
if [[ "$(uname -m)" != "s390x" ]]; then
|
|
|
|
return
|
|
|
|
fi
|
2021-05-14 01:30:08 +00:00
|
|
|
|
2022-11-23 01:42:33 +00:00
|
|
|
_NM_conf_dir="/etc/NetworkManager/system-connections"
|
|
|
|
|
|
|
|
_config_file=$(_find_znet_nmconnection "$initdir/$_NM_conf_dir" "$__sed_discard_ignored_files")
|
|
|
|
if [[ -n "$_config_file" ]]; then
|
|
|
|
ddebug "$_config_file has already contained the znet config"
|
|
|
|
return
|
2021-05-14 01:30:08 +00:00
|
|
|
fi
|
2020-10-15 12:45:57 +00:00
|
|
|
|
2022-11-23 01:42:33 +00:00
|
|
|
_config_file=$(LANG=C grep -s -E -i -l \
|
|
|
|
"^[[:space:]]*SUBCHANNELS=['\"]?([0-9]\.[0-9]\.[a-f0-9]+,){0,2}" \
|
|
|
|
/etc/sysconfig/network-scripts/ifcfg-* \
|
|
|
|
| LC_ALL=C sed -e "$__sed_discard_ignored_files")
|
|
|
|
|
|
|
|
if [[ -z "$_config_file" ]]; then
|
|
|
|
_config_file=$(_find_znet_nmconnection "$_NM_conf_dir" "$__sed_discard_ignored_files")
|
|
|
|
fi
|
|
|
|
|
|
|
|
if [[ -n "$_config_file" ]]; then
|
|
|
|
_unique_name=$(cat /proc/sys/kernel/random/uuid)
|
|
|
|
nmcli connection clone --temporary "$_config_file" "$_unique_name" &> >(ddebug)
|
|
|
|
nmcli connection modify --temporary "$_unique_name" connection.autoconnect false
|
|
|
|
inst "/run/NetworkManager/system-connections/${_unique_name}.nmconnection" "${_NM_conf_dir}/${_unique_name}.nmconnection"
|
|
|
|
nmcli connection del "$_unique_name" &> >(ddebug)
|
2021-05-14 01:30:08 +00:00
|
|
|
fi
|
2020-10-15 12:45:57 +00:00
|
|
|
|
|
|
|
}
|
|
|
|
|
2021-11-09 13:42:45 +00:00
|
|
|
kdump_get_remote_ip() {
|
2021-11-03 09:30:56 +00:00
|
|
|
local _remote _remote_temp
|
|
|
|
_remote=$(get_remote_host "$1")
|
2021-11-09 13:27:55 +00:00
|
|
|
if is_hostname "$_remote"; then
|
|
|
|
_remote_temp=$(getent ahosts "$_remote" | grep -v : | head -n 1)
|
2021-11-09 13:42:45 +00:00
|
|
|
if [[ -z $_remote_temp ]]; then
|
2021-11-09 13:27:55 +00:00
|
|
|
_remote_temp=$(getent ahosts "$_remote" | head -n 1)
|
2020-10-15 12:45:57 +00:00
|
|
|
fi
|
2021-11-09 13:27:55 +00:00
|
|
|
_remote=$(echo "$_remote_temp" | awk '{print $1}')
|
2020-10-15 12:45:57 +00:00
|
|
|
fi
|
2021-11-09 13:27:55 +00:00
|
|
|
echo "$_remote"
|
2020-10-15 12:45:57 +00:00
|
|
|
}
|
|
|
|
|
Support setting up Open vSwitch (Ovs) Bridge network
Resolves: https://issues.redhat.com/browse/RHEL-33465
Conflict: C9S misses the following two commits,
- 1397006 ("dracut-module-setup: Remove remove_cpu_online_rule() since PowerPC uses nr_cpus")
- 73c9eb7 ("dracut-module-setup: remove old s390 network device config (#1937048)")
Upstream Status: git@github.com:rhkdump/kdump-utils.git
commit 224d3102c54749eae98bfa1af8932aade8e4d2da
Author: Coiby Xu <coxu@redhat.com>
Date: Mon Apr 22 15:02:42 2024 +0800
Support setting up Open vSwitch (Ovs) Bridge network
Resolves: https://issues.redhat.com/browse/RHEL-33465
This patch supports setting up an Ovs bridge in kdump initrd. An Ovs
bridge is similar to a classic Linux bridge but we use ovs-vsctl to find
out the Ethernet device (having the MAC address as the bridge) added to
an Ovs bridge. Once we copy all the needed NetworkManager (NM) connection
profiles to kdump initrd and all the necessary files, NM will create an Ovs bridge
automatically in kdump initrd.
In the case of OpenShift Container Platform (OCP),
ovs-configuration.service [1] is responsible for setting up an Ovs bridge.
In theory, we can also try to bring up the original physical network
interface before ovs-configuration.service. But this approach is
cumbersome because it breaks our assumption that we should bring up the
same network in kdump intrd as in 1st kernel (establishing the same network
in kdump initrd only needs to copy the needed NM connection profiles
thus we don't need to learn how different network setup work under the
hood).
How to test this patch with the help of configure-ovs.sh?
=========================================================
1. Extract configure-ovs.sh from [2]
2. Install necessary packages for configure-ovs.sh
dnf install openvswitch -yq
dnf install NetworkManager-ovs nmap-ncat -yq
systemctl enable --now openvswitch
# restart NM so the ovs plugin can be activated
systemctl restart NetworkManager
3. Assume the network interface used for creating an Ovs bridge is
"ens2", use configure-ovs.sh to create an Ovs bridge,
interface=ens2
mkdir -p /etc/ovnk
echo $interface > /etc/ovnk/iface_default_hint
bash configure-ovs.sh OVNKubernetes
4. (Optional) If you want to make the created Ovs bridge survive a
reboot, simply make the created NM connections created by
configure-ovs.sh persist,
cp /run/NetworkManager/system-connections/ovs-* /etc/NetworkManager/system-connections/
If you need to create an Ovs bridge on top of a bonding network, use the
following commands for step 3,
nmcli con add type bond ifname bond0
nmcli con add type ethernet ifname eth0 master bond0
nmcli con add type ethernet ifname eth1 master bond0
echo bond0 > /etc/ovnk/iface_default_hint
bash configure-ovs.sh OVNKubernetes
Note
1. For RHEL, openvswitch3.3 may be installed so we need to get the
package name by "rpm -qf /usr/lib/systemd/system/openvswitch.service"
2. For RHEL9, openvswitch package needs to installed from another repo,
cat << 'EOF' > /etc/yum.repos.d/ovs.repo
[rhosp-rhel-9-fdp-cdn]
name=Red Hat Enterprise Linux Fast Datapath $releasever - $basearch cdn
baseurl=http://rhsm-pulp.corp.redhat.com/content/dist/layered/rhel9/$basearch/fast-datapath/os/
enabled=1
gpgcheck=0
EOF
dnf install openvswitch3.3 -yq
3. We instruct ovsdb-server to ignore NM connection files changes by
"--ovsdb-server-options='--disable-file-column-diff'". In the
future, this may not be needed if we simply copy all active NM
connection profiles to kdump initrd without changing them after
coming up with different solutions for the following cases,
1. Some environments like some Azure machine doesn't use persistent
NIC name. Current solution is to modify a NM connection
profile to match a device by MAC address, for details check
commit 568623e)
2. If a NIC has an IPv4 or IPv6 address, set the corresponding
may-fail property to no. Otherwise, dumping vmcore over IPv6
could fail because only IPv4 network is ready or vice versa. Current
solution is to disable IPv6 if only IPv4 is used and vice versa,
for details check commit 9dfcacf,
3. Some NICs need longer connection.wait-device-timeout otherwise
the connection will fail to be established (commit 6b586a9).
[1] https://github.com/openshift/machine-config-operator/blob/master/templates/common/_base/units/ovs-configuration.service.yaml
[2] https://github.com/openshift/machine-config-operator/blob/master/templates/common/_base/files/configure-ovs-network.yaml
Signed-off-by: Coiby Xu <coxu@redhat.com>
Signed-off-by: Coiby Xu <coxu@redhat.com>
2024-07-29 09:21:41 +00:00
|
|
|
# Find the physical interface of Open vSwitch (Ovs) bridge
|
|
|
|
#
|
|
|
|
# The physical network interface has the same MAC address as the Ovs bridge
|
|
|
|
ovs_find_phy_if() {
|
|
|
|
local _mac _dev
|
|
|
|
_mac=$(kdump_get_mac_addr $1)
|
|
|
|
|
|
|
|
for _dev in $(ovs-vsctl list-ifaces $1); do
|
|
|
|
if [[ $_mac == $(</sys/class/net/$_dev/address) ]]; then
|
|
|
|
echo -n "$_dev"
|
|
|
|
return
|
|
|
|
fi
|
|
|
|
done
|
|
|
|
|
|
|
|
return 1
|
|
|
|
}
|
|
|
|
|
|
|
|
# Tell if a network interface is an Open vSwitch (Ovs) bridge
|
|
|
|
kdump_is_ovs_bridge() {
|
|
|
|
[[ $(_get_nic_driver $1) == openvswitch ]]
|
|
|
|
}
|
|
|
|
|
2022-11-23 01:42:18 +00:00
|
|
|
# Collect netifs needed by kdump
|
2020-10-15 12:45:57 +00:00
|
|
|
# $1: destination host
|
2022-11-23 01:42:18 +00:00
|
|
|
kdump_collect_netif_usage() {
|
2022-11-23 01:42:18 +00:00
|
|
|
local _destaddr _srcaddr _route _netdev
|
2020-10-15 12:45:57 +00:00
|
|
|
|
2021-11-09 13:27:55 +00:00
|
|
|
_destaddr=$(kdump_get_remote_ip "$1")
|
2023-04-18 07:26:17 +00:00
|
|
|
|
|
|
|
if ! _route=$(kdump_get_ip_route "$_destaddr"); then
|
|
|
|
derror "Bad kdump network destination: $_destaddr"
|
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
|
2020-10-15 12:45:57 +00:00
|
|
|
_srcaddr=$(kdump_get_ip_route_field "$_route" "src")
|
|
|
|
_netdev=$(kdump_get_ip_route_field "$_route" "dev")
|
|
|
|
|
|
|
|
if kdump_is_bridge "$_netdev"; then
|
|
|
|
kdump_setup_bridge "$_netdev"
|
|
|
|
elif kdump_is_bond "$_netdev"; then
|
2022-11-23 01:42:18 +00:00
|
|
|
kdump_setup_bond "$_netdev" || return 1
|
2020-10-15 12:45:57 +00:00
|
|
|
elif kdump_is_team "$_netdev"; then
|
|
|
|
kdump_setup_team "$_netdev"
|
|
|
|
elif kdump_is_vlan "$_netdev"; then
|
|
|
|
kdump_setup_vlan "$_netdev"
|
Support setting up Open vSwitch (Ovs) Bridge network
Resolves: https://issues.redhat.com/browse/RHEL-33465
Conflict: C9S misses the following two commits,
- 1397006 ("dracut-module-setup: Remove remove_cpu_online_rule() since PowerPC uses nr_cpus")
- 73c9eb7 ("dracut-module-setup: remove old s390 network device config (#1937048)")
Upstream Status: git@github.com:rhkdump/kdump-utils.git
commit 224d3102c54749eae98bfa1af8932aade8e4d2da
Author: Coiby Xu <coxu@redhat.com>
Date: Mon Apr 22 15:02:42 2024 +0800
Support setting up Open vSwitch (Ovs) Bridge network
Resolves: https://issues.redhat.com/browse/RHEL-33465
This patch supports setting up an Ovs bridge in kdump initrd. An Ovs
bridge is similar to a classic Linux bridge but we use ovs-vsctl to find
out the Ethernet device (having the MAC address as the bridge) added to
an Ovs bridge. Once we copy all the needed NetworkManager (NM) connection
profiles to kdump initrd and all the necessary files, NM will create an Ovs bridge
automatically in kdump initrd.
In the case of OpenShift Container Platform (OCP),
ovs-configuration.service [1] is responsible for setting up an Ovs bridge.
In theory, we can also try to bring up the original physical network
interface before ovs-configuration.service. But this approach is
cumbersome because it breaks our assumption that we should bring up the
same network in kdump intrd as in 1st kernel (establishing the same network
in kdump initrd only needs to copy the needed NM connection profiles
thus we don't need to learn how different network setup work under the
hood).
How to test this patch with the help of configure-ovs.sh?
=========================================================
1. Extract configure-ovs.sh from [2]
2. Install necessary packages for configure-ovs.sh
dnf install openvswitch -yq
dnf install NetworkManager-ovs nmap-ncat -yq
systemctl enable --now openvswitch
# restart NM so the ovs plugin can be activated
systemctl restart NetworkManager
3. Assume the network interface used for creating an Ovs bridge is
"ens2", use configure-ovs.sh to create an Ovs bridge,
interface=ens2
mkdir -p /etc/ovnk
echo $interface > /etc/ovnk/iface_default_hint
bash configure-ovs.sh OVNKubernetes
4. (Optional) If you want to make the created Ovs bridge survive a
reboot, simply make the created NM connections created by
configure-ovs.sh persist,
cp /run/NetworkManager/system-connections/ovs-* /etc/NetworkManager/system-connections/
If you need to create an Ovs bridge on top of a bonding network, use the
following commands for step 3,
nmcli con add type bond ifname bond0
nmcli con add type ethernet ifname eth0 master bond0
nmcli con add type ethernet ifname eth1 master bond0
echo bond0 > /etc/ovnk/iface_default_hint
bash configure-ovs.sh OVNKubernetes
Note
1. For RHEL, openvswitch3.3 may be installed so we need to get the
package name by "rpm -qf /usr/lib/systemd/system/openvswitch.service"
2. For RHEL9, openvswitch package needs to installed from another repo,
cat << 'EOF' > /etc/yum.repos.d/ovs.repo
[rhosp-rhel-9-fdp-cdn]
name=Red Hat Enterprise Linux Fast Datapath $releasever - $basearch cdn
baseurl=http://rhsm-pulp.corp.redhat.com/content/dist/layered/rhel9/$basearch/fast-datapath/os/
enabled=1
gpgcheck=0
EOF
dnf install openvswitch3.3 -yq
3. We instruct ovsdb-server to ignore NM connection files changes by
"--ovsdb-server-options='--disable-file-column-diff'". In the
future, this may not be needed if we simply copy all active NM
connection profiles to kdump initrd without changing them after
coming up with different solutions for the following cases,
1. Some environments like some Azure machine doesn't use persistent
NIC name. Current solution is to modify a NM connection
profile to match a device by MAC address, for details check
commit 568623e)
2. If a NIC has an IPv4 or IPv6 address, set the corresponding
may-fail property to no. Otherwise, dumping vmcore over IPv6
could fail because only IPv4 network is ready or vice versa. Current
solution is to disable IPv6 if only IPv4 is used and vice versa,
for details check commit 9dfcacf,
3. Some NICs need longer connection.wait-device-timeout otherwise
the connection will fail to be established (commit 6b586a9).
[1] https://github.com/openshift/machine-config-operator/blob/master/templates/common/_base/units/ovs-configuration.service.yaml
[2] https://github.com/openshift/machine-config-operator/blob/master/templates/common/_base/files/configure-ovs-network.yaml
Signed-off-by: Coiby Xu <coxu@redhat.com>
Signed-off-by: Coiby Xu <coxu@redhat.com>
2024-07-29 09:21:41 +00:00
|
|
|
elif kdump_is_ovs_bridge "$_netdev"; then
|
|
|
|
has_ovs_bridge=yes
|
|
|
|
kdump_setup_ovs "$_netdev"
|
2020-10-15 12:45:57 +00:00
|
|
|
fi
|
2022-11-23 01:42:18 +00:00
|
|
|
_save_kdump_netifs "$_netdev"
|
2020-10-15 12:45:57 +00:00
|
|
|
|
bash scripts: replace '[ ]' with '[[ ]]' for bash scripts
upstream: fedora
resolves: bz2003832
conflict:
function load_kdump_kernel_key() not presented in rhel9,
so related patch hunk are removed.
commit 70978c00e5a573f0901ac404067eaea2c6536370
Author: Kairui Song <kasong@redhat.com>
Date: Wed Sep 8 17:20:51 2021 +0800
bash scripts: replace '[ ]' with '[[ ]]' for bash scripts
kdumpctl, mkdumprd, *-module-setup.sh only target bash, since they
only run in first kernel and depend on dracut, and dracut depends
on bash. So use '[[ ]]' to replace '[ ]'.
This is a batch update done with following command:
`sed -i -e 's/\(\s\)\[\s\([^]]*\)\s\]/\1\[\[\ \2 \]\]/g' kdumpctl, mkdumprd, *-module-setup.sh`
and replaced [ ... -a ... ] with [[ ... ]] && [[ ... ]] manually.
See https://tldp.org/LDP/abs/html/testconstructs.html for more details
on '[[ ]]', it's more versatile, safer, and slightly faster than '[ ]'.
This will also help shfmt to clean up the code in later commits.
Signed-off-by: Kairui Song <kasong@redhat.com>
Acked-by: Philipp Rudo <prudo@redhat.com>
Signed-off-by: Tao Liu <ltao@redhat.com>
2021-11-09 13:13:59 +00:00
|
|
|
if [[ ! -f ${initdir}/etc/cmdline.d/50neednet.conf ]]; then
|
2020-10-15 12:45:57 +00:00
|
|
|
# network-manager module needs this parameter
|
2021-11-09 13:27:55 +00:00
|
|
|
echo "rd.neednet" >> "${initdir}/etc/cmdline.d/50neednet.conf"
|
2020-10-15 12:45:57 +00:00
|
|
|
fi
|
|
|
|
|
2022-11-23 01:42:18 +00:00
|
|
|
if [[ ! -f ${initdir}/etc/cmdline.d/60kdumpip.conf ]]; then
|
|
|
|
echo "kdump_remote_ip=$_destaddr" > "${initdir}/etc/cmdline.d/60kdumpip.conf"
|
2022-11-23 01:42:18 +00:00
|
|
|
fi
|
|
|
|
|
|
|
|
if is_ipv6_address "$_srcaddr"; then
|
|
|
|
ipv6_usage[$_netdev]=1
|
|
|
|
else
|
|
|
|
ipv4_usage[$_netdev]=1
|
|
|
|
fi
|
|
|
|
}
|
|
|
|
|
2023-12-05 10:01:01 +00:00
|
|
|
kdump_install_resolv_conf() {
|
|
|
|
local _resolv_conf=/etc/resolv.conf _nm_conf_dir=/etc/NetworkManager/conf.d
|
|
|
|
|
|
|
|
# Some users may choose to manage /etc/resolve.conf manually [1]
|
|
|
|
# by setting dns=none or use a symbolic link resolve.conf [2].
|
|
|
|
# So resolve.conf should be installed to kdump initrd as well. To prevent
|
|
|
|
# NM frome overwritting the user-configured resolve.conf in kdump initrd,
|
|
|
|
# also set dns=none for NM.
|
|
|
|
#
|
|
|
|
# Note:
|
|
|
|
# 1. When resolv.conf is managed by systemd-resolved.service, it could also be a
|
|
|
|
# symbolic link. So exclude this case by teling if systemd-resolved is enabled.
|
|
|
|
#
|
|
|
|
# 2. It's harmless to blindly copy /etc/resolve.conf to the initrd because
|
|
|
|
# by default in initramfs this file will be overwritten by
|
|
|
|
# NetworkManager. If user manages it via a symbolic link, it's still
|
|
|
|
# preserved because NM won't touch a symbolic link file.
|
|
|
|
#
|
|
|
|
# [1] https://bugzilla.gnome.org/show_bug.cgi?id=690404
|
|
|
|
# [2] https://access.redhat.com/documentation/en-us/red_hat_enterprise_linux/8/html/configuring_and_managing_networking/manually-configuring-the-etc-resolv-conf-file_configuring-and-managing-networking
|
2023-12-26 04:46:10 +00:00
|
|
|
systemctl -q is-enabled systemd-resolved 2> /dev/null && return 0
|
2023-12-05 10:01:01 +00:00
|
|
|
inst "$_resolv_conf"
|
|
|
|
if NetworkManager --print-config | grep -qs "^dns=none"; then
|
2023-12-26 04:46:10 +00:00
|
|
|
printf "[main]\ndns=none\n" > "${initdir}/${_nm_conf_dir}"/90-dns-none.conf
|
2023-12-05 10:01:01 +00:00
|
|
|
fi
|
|
|
|
}
|
|
|
|
|
Support setting up Open vSwitch (Ovs) Bridge network
Resolves: https://issues.redhat.com/browse/RHEL-33465
Conflict: C9S misses the following two commits,
- 1397006 ("dracut-module-setup: Remove remove_cpu_online_rule() since PowerPC uses nr_cpus")
- 73c9eb7 ("dracut-module-setup: remove old s390 network device config (#1937048)")
Upstream Status: git@github.com:rhkdump/kdump-utils.git
commit 224d3102c54749eae98bfa1af8932aade8e4d2da
Author: Coiby Xu <coxu@redhat.com>
Date: Mon Apr 22 15:02:42 2024 +0800
Support setting up Open vSwitch (Ovs) Bridge network
Resolves: https://issues.redhat.com/browse/RHEL-33465
This patch supports setting up an Ovs bridge in kdump initrd. An Ovs
bridge is similar to a classic Linux bridge but we use ovs-vsctl to find
out the Ethernet device (having the MAC address as the bridge) added to
an Ovs bridge. Once we copy all the needed NetworkManager (NM) connection
profiles to kdump initrd and all the necessary files, NM will create an Ovs bridge
automatically in kdump initrd.
In the case of OpenShift Container Platform (OCP),
ovs-configuration.service [1] is responsible for setting up an Ovs bridge.
In theory, we can also try to bring up the original physical network
interface before ovs-configuration.service. But this approach is
cumbersome because it breaks our assumption that we should bring up the
same network in kdump intrd as in 1st kernel (establishing the same network
in kdump initrd only needs to copy the needed NM connection profiles
thus we don't need to learn how different network setup work under the
hood).
How to test this patch with the help of configure-ovs.sh?
=========================================================
1. Extract configure-ovs.sh from [2]
2. Install necessary packages for configure-ovs.sh
dnf install openvswitch -yq
dnf install NetworkManager-ovs nmap-ncat -yq
systemctl enable --now openvswitch
# restart NM so the ovs plugin can be activated
systemctl restart NetworkManager
3. Assume the network interface used for creating an Ovs bridge is
"ens2", use configure-ovs.sh to create an Ovs bridge,
interface=ens2
mkdir -p /etc/ovnk
echo $interface > /etc/ovnk/iface_default_hint
bash configure-ovs.sh OVNKubernetes
4. (Optional) If you want to make the created Ovs bridge survive a
reboot, simply make the created NM connections created by
configure-ovs.sh persist,
cp /run/NetworkManager/system-connections/ovs-* /etc/NetworkManager/system-connections/
If you need to create an Ovs bridge on top of a bonding network, use the
following commands for step 3,
nmcli con add type bond ifname bond0
nmcli con add type ethernet ifname eth0 master bond0
nmcli con add type ethernet ifname eth1 master bond0
echo bond0 > /etc/ovnk/iface_default_hint
bash configure-ovs.sh OVNKubernetes
Note
1. For RHEL, openvswitch3.3 may be installed so we need to get the
package name by "rpm -qf /usr/lib/systemd/system/openvswitch.service"
2. For RHEL9, openvswitch package needs to installed from another repo,
cat << 'EOF' > /etc/yum.repos.d/ovs.repo
[rhosp-rhel-9-fdp-cdn]
name=Red Hat Enterprise Linux Fast Datapath $releasever - $basearch cdn
baseurl=http://rhsm-pulp.corp.redhat.com/content/dist/layered/rhel9/$basearch/fast-datapath/os/
enabled=1
gpgcheck=0
EOF
dnf install openvswitch3.3 -yq
3. We instruct ovsdb-server to ignore NM connection files changes by
"--ovsdb-server-options='--disable-file-column-diff'". In the
future, this may not be needed if we simply copy all active NM
connection profiles to kdump initrd without changing them after
coming up with different solutions for the following cases,
1. Some environments like some Azure machine doesn't use persistent
NIC name. Current solution is to modify a NM connection
profile to match a device by MAC address, for details check
commit 568623e)
2. If a NIC has an IPv4 or IPv6 address, set the corresponding
may-fail property to no. Otherwise, dumping vmcore over IPv6
could fail because only IPv4 network is ready or vice versa. Current
solution is to disable IPv6 if only IPv4 is used and vice versa,
for details check commit 9dfcacf,
3. Some NICs need longer connection.wait-device-timeout otherwise
the connection will fail to be established (commit 6b586a9).
[1] https://github.com/openshift/machine-config-operator/blob/master/templates/common/_base/units/ovs-configuration.service.yaml
[2] https://github.com/openshift/machine-config-operator/blob/master/templates/common/_base/files/configure-ovs-network.yaml
Signed-off-by: Coiby Xu <coxu@redhat.com>
Signed-off-by: Coiby Xu <coxu@redhat.com>
2024-07-29 09:21:41 +00:00
|
|
|
kdump_install_ovs_deps() {
|
|
|
|
[[ $has_ovs_bridge == yes ]] || return 0
|
|
|
|
inst_multiple -o $(rpm -ql NetworkManager-ovs) $(rpm -ql $(rpm -qf /usr/lib/systemd/system/openvswitch.service)) /sbin/sysctl /usr/bin/uuidgen /usr/bin/hostname /usr/bin/touch /usr/bin/expr /usr/bin/id /usr/bin/install /usr/bin/setpriv /usr/bin/nice /usr/bin/df
|
|
|
|
# 1. Overwrite the copied /etc/sysconfig/openvswitch so
|
|
|
|
# ovsdb-server.service can run as the default user root.
|
|
|
|
# /etc/sysconfig/openvswitch by default intructs ovsdb-server.service to
|
|
|
|
# run as USER=openvswitch, However openvswitch doesn't have the permission
|
|
|
|
# to write to /tmp in kdump initrd and ovsdb-server.servie will fail
|
|
|
|
# with the error "ovs-ctl[1190]: ovsdb-server: failed to create temporary
|
|
|
|
# file (Permission denied)". So run ovsdb-server.service as root instead
|
|
|
|
#
|
|
|
|
# 2. Bypass the error "referential integrity violation: Table Port column
|
|
|
|
# interfaces row" caused by we changing the connection profiles
|
|
|
|
echo "OPTIONS=\"--ovsdb-server-options='--disable-file-column-diff'\"" >"${initdir}/etc/sysconfig/openvswitch"
|
|
|
|
|
|
|
|
KDUMP_DROP_IN_DIR="${initdir}/etc/systemd/system/nm-initrd.service.d"
|
|
|
|
mkdir -p "$KDUMP_DROP_IN_DIR"
|
|
|
|
printf "[Unit]\nAfter=openvswitch.service\n" >$KDUMP_DROP_IN_DIR/01-after-ovs.conf
|
|
|
|
|
|
|
|
$SYSTEMCTL -q --root "$initdir" enable openvswitch.service
|
|
|
|
$SYSTEMCTL -q --root "$initdir" add-wants basic.target openvswitch.service
|
|
|
|
}
|
|
|
|
|
2022-11-23 01:42:18 +00:00
|
|
|
# Setup dracut to bring up network interface that enable
|
|
|
|
# initramfs accessing giving destination
|
|
|
|
kdump_install_net() {
|
|
|
|
local _netifs
|
|
|
|
|
|
|
|
_netifs=$(_get_kdump_netifs)
|
|
|
|
if [[ -n "$_netifs" ]]; then
|
|
|
|
kdump_install_nmconnections
|
|
|
|
apply_nm_initrd_generator_timeouts
|
2022-11-23 01:42:33 +00:00
|
|
|
kdump_setup_znet
|
2022-11-23 01:42:18 +00:00
|
|
|
kdump_install_nm_netif_allowlist "$_netifs"
|
2022-11-23 01:42:18 +00:00
|
|
|
kdump_install_nic_driver "$_netifs"
|
2023-12-05 10:01:01 +00:00
|
|
|
kdump_install_resolv_conf
|
Support setting up Open vSwitch (Ovs) Bridge network
Resolves: https://issues.redhat.com/browse/RHEL-33465
Conflict: C9S misses the following two commits,
- 1397006 ("dracut-module-setup: Remove remove_cpu_online_rule() since PowerPC uses nr_cpus")
- 73c9eb7 ("dracut-module-setup: remove old s390 network device config (#1937048)")
Upstream Status: git@github.com:rhkdump/kdump-utils.git
commit 224d3102c54749eae98bfa1af8932aade8e4d2da
Author: Coiby Xu <coxu@redhat.com>
Date: Mon Apr 22 15:02:42 2024 +0800
Support setting up Open vSwitch (Ovs) Bridge network
Resolves: https://issues.redhat.com/browse/RHEL-33465
This patch supports setting up an Ovs bridge in kdump initrd. An Ovs
bridge is similar to a classic Linux bridge but we use ovs-vsctl to find
out the Ethernet device (having the MAC address as the bridge) added to
an Ovs bridge. Once we copy all the needed NetworkManager (NM) connection
profiles to kdump initrd and all the necessary files, NM will create an Ovs bridge
automatically in kdump initrd.
In the case of OpenShift Container Platform (OCP),
ovs-configuration.service [1] is responsible for setting up an Ovs bridge.
In theory, we can also try to bring up the original physical network
interface before ovs-configuration.service. But this approach is
cumbersome because it breaks our assumption that we should bring up the
same network in kdump intrd as in 1st kernel (establishing the same network
in kdump initrd only needs to copy the needed NM connection profiles
thus we don't need to learn how different network setup work under the
hood).
How to test this patch with the help of configure-ovs.sh?
=========================================================
1. Extract configure-ovs.sh from [2]
2. Install necessary packages for configure-ovs.sh
dnf install openvswitch -yq
dnf install NetworkManager-ovs nmap-ncat -yq
systemctl enable --now openvswitch
# restart NM so the ovs plugin can be activated
systemctl restart NetworkManager
3. Assume the network interface used for creating an Ovs bridge is
"ens2", use configure-ovs.sh to create an Ovs bridge,
interface=ens2
mkdir -p /etc/ovnk
echo $interface > /etc/ovnk/iface_default_hint
bash configure-ovs.sh OVNKubernetes
4. (Optional) If you want to make the created Ovs bridge survive a
reboot, simply make the created NM connections created by
configure-ovs.sh persist,
cp /run/NetworkManager/system-connections/ovs-* /etc/NetworkManager/system-connections/
If you need to create an Ovs bridge on top of a bonding network, use the
following commands for step 3,
nmcli con add type bond ifname bond0
nmcli con add type ethernet ifname eth0 master bond0
nmcli con add type ethernet ifname eth1 master bond0
echo bond0 > /etc/ovnk/iface_default_hint
bash configure-ovs.sh OVNKubernetes
Note
1. For RHEL, openvswitch3.3 may be installed so we need to get the
package name by "rpm -qf /usr/lib/systemd/system/openvswitch.service"
2. For RHEL9, openvswitch package needs to installed from another repo,
cat << 'EOF' > /etc/yum.repos.d/ovs.repo
[rhosp-rhel-9-fdp-cdn]
name=Red Hat Enterprise Linux Fast Datapath $releasever - $basearch cdn
baseurl=http://rhsm-pulp.corp.redhat.com/content/dist/layered/rhel9/$basearch/fast-datapath/os/
enabled=1
gpgcheck=0
EOF
dnf install openvswitch3.3 -yq
3. We instruct ovsdb-server to ignore NM connection files changes by
"--ovsdb-server-options='--disable-file-column-diff'". In the
future, this may not be needed if we simply copy all active NM
connection profiles to kdump initrd without changing them after
coming up with different solutions for the following cases,
1. Some environments like some Azure machine doesn't use persistent
NIC name. Current solution is to modify a NM connection
profile to match a device by MAC address, for details check
commit 568623e)
2. If a NIC has an IPv4 or IPv6 address, set the corresponding
may-fail property to no. Otherwise, dumping vmcore over IPv6
could fail because only IPv4 network is ready or vice versa. Current
solution is to disable IPv6 if only IPv4 is used and vice versa,
for details check commit 9dfcacf,
3. Some NICs need longer connection.wait-device-timeout otherwise
the connection will fail to be established (commit 6b586a9).
[1] https://github.com/openshift/machine-config-operator/blob/master/templates/common/_base/units/ovs-configuration.service.yaml
[2] https://github.com/openshift/machine-config-operator/blob/master/templates/common/_base/files/configure-ovs-network.yaml
Signed-off-by: Coiby Xu <coxu@redhat.com>
Signed-off-by: Coiby Xu <coxu@redhat.com>
2024-07-29 09:21:41 +00:00
|
|
|
kdump_install_ovs_deps
|
2020-10-15 12:45:57 +00:00
|
|
|
fi
|
|
|
|
}
|
|
|
|
|
|
|
|
# install etc/kdump/pre.d and /etc/kdump/post.d
|
|
|
|
kdump_install_pre_post_conf() {
|
bash scripts: replace '[ ]' with '[[ ]]' for bash scripts
upstream: fedora
resolves: bz2003832
conflict:
function load_kdump_kernel_key() not presented in rhel9,
so related patch hunk are removed.
commit 70978c00e5a573f0901ac404067eaea2c6536370
Author: Kairui Song <kasong@redhat.com>
Date: Wed Sep 8 17:20:51 2021 +0800
bash scripts: replace '[ ]' with '[[ ]]' for bash scripts
kdumpctl, mkdumprd, *-module-setup.sh only target bash, since they
only run in first kernel and depend on dracut, and dracut depends
on bash. So use '[[ ]]' to replace '[ ]'.
This is a batch update done with following command:
`sed -i -e 's/\(\s\)\[\s\([^]]*\)\s\]/\1\[\[\ \2 \]\]/g' kdumpctl, mkdumprd, *-module-setup.sh`
and replaced [ ... -a ... ] with [[ ... ]] && [[ ... ]] manually.
See https://tldp.org/LDP/abs/html/testconstructs.html for more details
on '[[ ]]', it's more versatile, safer, and slightly faster than '[ ]'.
This will also help shfmt to clean up the code in later commits.
Signed-off-by: Kairui Song <kasong@redhat.com>
Acked-by: Philipp Rudo <prudo@redhat.com>
Signed-off-by: Tao Liu <ltao@redhat.com>
2021-11-09 13:13:59 +00:00
|
|
|
if [[ -d /etc/kdump/pre.d ]]; then
|
2020-10-15 12:45:57 +00:00
|
|
|
for file in /etc/kdump/pre.d/*; do
|
2021-11-09 13:42:45 +00:00
|
|
|
if [[ -x $file ]]; then
|
2021-11-09 13:27:55 +00:00
|
|
|
dracut_install "$file"
|
bash scripts: replace '[ ]' with '[[ ]]' for bash scripts
upstream: fedora
resolves: bz2003832
conflict:
function load_kdump_kernel_key() not presented in rhel9,
so related patch hunk are removed.
commit 70978c00e5a573f0901ac404067eaea2c6536370
Author: Kairui Song <kasong@redhat.com>
Date: Wed Sep 8 17:20:51 2021 +0800
bash scripts: replace '[ ]' with '[[ ]]' for bash scripts
kdumpctl, mkdumprd, *-module-setup.sh only target bash, since they
only run in first kernel and depend on dracut, and dracut depends
on bash. So use '[[ ]]' to replace '[ ]'.
This is a batch update done with following command:
`sed -i -e 's/\(\s\)\[\s\([^]]*\)\s\]/\1\[\[\ \2 \]\]/g' kdumpctl, mkdumprd, *-module-setup.sh`
and replaced [ ... -a ... ] with [[ ... ]] && [[ ... ]] manually.
See https://tldp.org/LDP/abs/html/testconstructs.html for more details
on '[[ ]]', it's more versatile, safer, and slightly faster than '[ ]'.
This will also help shfmt to clean up the code in later commits.
Signed-off-by: Kairui Song <kasong@redhat.com>
Acked-by: Philipp Rudo <prudo@redhat.com>
Signed-off-by: Tao Liu <ltao@redhat.com>
2021-11-09 13:13:59 +00:00
|
|
|
elif [[ $file != "/etc/kdump/pre.d/*" ]]; then
|
2021-11-09 13:42:45 +00:00
|
|
|
echo "$file is not executable"
|
2020-10-15 12:45:57 +00:00
|
|
|
fi
|
|
|
|
done
|
|
|
|
fi
|
|
|
|
|
bash scripts: replace '[ ]' with '[[ ]]' for bash scripts
upstream: fedora
resolves: bz2003832
conflict:
function load_kdump_kernel_key() not presented in rhel9,
so related patch hunk are removed.
commit 70978c00e5a573f0901ac404067eaea2c6536370
Author: Kairui Song <kasong@redhat.com>
Date: Wed Sep 8 17:20:51 2021 +0800
bash scripts: replace '[ ]' with '[[ ]]' for bash scripts
kdumpctl, mkdumprd, *-module-setup.sh only target bash, since they
only run in first kernel and depend on dracut, and dracut depends
on bash. So use '[[ ]]' to replace '[ ]'.
This is a batch update done with following command:
`sed -i -e 's/\(\s\)\[\s\([^]]*\)\s\]/\1\[\[\ \2 \]\]/g' kdumpctl, mkdumprd, *-module-setup.sh`
and replaced [ ... -a ... ] with [[ ... ]] && [[ ... ]] manually.
See https://tldp.org/LDP/abs/html/testconstructs.html for more details
on '[[ ]]', it's more versatile, safer, and slightly faster than '[ ]'.
This will also help shfmt to clean up the code in later commits.
Signed-off-by: Kairui Song <kasong@redhat.com>
Acked-by: Philipp Rudo <prudo@redhat.com>
Signed-off-by: Tao Liu <ltao@redhat.com>
2021-11-09 13:13:59 +00:00
|
|
|
if [[ -d /etc/kdump/post.d ]]; then
|
2020-10-15 12:45:57 +00:00
|
|
|
for file in /etc/kdump/post.d/*; do
|
2021-11-09 13:42:45 +00:00
|
|
|
if [[ -x $file ]]; then
|
2021-11-09 13:27:55 +00:00
|
|
|
dracut_install "$file"
|
bash scripts: replace '[ ]' with '[[ ]]' for bash scripts
upstream: fedora
resolves: bz2003832
conflict:
function load_kdump_kernel_key() not presented in rhel9,
so related patch hunk are removed.
commit 70978c00e5a573f0901ac404067eaea2c6536370
Author: Kairui Song <kasong@redhat.com>
Date: Wed Sep 8 17:20:51 2021 +0800
bash scripts: replace '[ ]' with '[[ ]]' for bash scripts
kdumpctl, mkdumprd, *-module-setup.sh only target bash, since they
only run in first kernel and depend on dracut, and dracut depends
on bash. So use '[[ ]]' to replace '[ ]'.
This is a batch update done with following command:
`sed -i -e 's/\(\s\)\[\s\([^]]*\)\s\]/\1\[\[\ \2 \]\]/g' kdumpctl, mkdumprd, *-module-setup.sh`
and replaced [ ... -a ... ] with [[ ... ]] && [[ ... ]] manually.
See https://tldp.org/LDP/abs/html/testconstructs.html for more details
on '[[ ]]', it's more versatile, safer, and slightly faster than '[ ]'.
This will also help shfmt to clean up the code in later commits.
Signed-off-by: Kairui Song <kasong@redhat.com>
Acked-by: Philipp Rudo <prudo@redhat.com>
Signed-off-by: Tao Liu <ltao@redhat.com>
2021-11-09 13:13:59 +00:00
|
|
|
elif [[ $file != "/etc/kdump/post.d/*" ]]; then
|
2020-10-15 12:45:57 +00:00
|
|
|
echo "$file is not executable"
|
|
|
|
fi
|
|
|
|
done
|
|
|
|
fi
|
|
|
|
}
|
|
|
|
|
2021-11-09 13:42:45 +00:00
|
|
|
default_dump_target_install_conf() {
|
2020-10-15 12:45:57 +00:00
|
|
|
local _target _fstype
|
|
|
|
local _mntpoint _save_path
|
|
|
|
|
|
|
|
is_user_configured_dump_target && return
|
|
|
|
|
2021-11-09 13:27:55 +00:00
|
|
|
_save_path=$(get_bind_mount_source "$(get_save_path)")
|
|
|
|
_target=$(get_target_from_path "$_save_path")
|
|
|
|
_mntpoint=$(get_mntpoint_from_target "$_target")
|
2020-10-15 12:45:57 +00:00
|
|
|
|
2021-11-09 13:27:55 +00:00
|
|
|
_fstype=$(get_fs_type_from_target "$_target")
|
|
|
|
if is_fs_type_nfs "$_fstype"; then
|
2022-11-23 01:42:18 +00:00
|
|
|
kdump_collect_netif_usage "$_target"
|
2020-10-15 12:45:57 +00:00
|
|
|
_fstype="nfs"
|
|
|
|
else
|
2021-11-09 13:27:55 +00:00
|
|
|
_target=$(kdump_get_persistent_dev "$_target")
|
2020-10-15 12:45:57 +00:00
|
|
|
fi
|
|
|
|
|
2021-11-09 13:27:55 +00:00
|
|
|
echo "$_fstype $_target" >> "${initdir}/tmp/$$-kdump.conf"
|
2020-10-15 12:45:57 +00:00
|
|
|
|
|
|
|
# don't touch the path under root mount
|
2021-11-09 13:42:45 +00:00
|
|
|
if [[ $_mntpoint != "/" ]]; then
|
2020-10-15 12:45:57 +00:00
|
|
|
_save_path=${_save_path##"$_mntpoint"}
|
|
|
|
fi
|
|
|
|
|
|
|
|
#erase the old path line, then insert the parsed path
|
2021-11-09 13:27:55 +00:00
|
|
|
sed -i "/^path/d" "${initdir}/tmp/$$-kdump.conf"
|
|
|
|
echo "path $_save_path" >> "${initdir}/tmp/$$-kdump.conf"
|
2020-10-15 12:45:57 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
#install kdump.conf and what user specifies in kdump.conf
|
|
|
|
kdump_install_conf() {
|
|
|
|
local _opt _val _pdev
|
2021-11-03 07:12:31 +00:00
|
|
|
|
|
|
|
kdump_read_conf > "${initdir}/tmp/$$-kdump.conf"
|
2020-10-15 12:45:57 +00:00
|
|
|
|
2021-11-09 13:42:45 +00:00
|
|
|
while read -r _opt _val; do
|
2020-10-15 12:45:57 +00:00
|
|
|
# remove inline comments after the end of a directive.
|
|
|
|
case "$_opt" in
|
2021-11-09 13:42:45 +00:00
|
|
|
raw)
|
|
|
|
_pdev=$(persistent_policy="by-id" kdump_get_persistent_dev "$_val")
|
|
|
|
sed -i -e "s#^${_opt}[[:space:]]\+$_val#$_opt $_pdev#" "${initdir}/tmp/$$-kdump.conf"
|
|
|
|
;;
|
2022-10-26 02:24:57 +00:00
|
|
|
ext[234] | xfs | btrfs | minix | virtiofs)
|
2021-11-09 13:42:45 +00:00
|
|
|
_pdev=$(kdump_get_persistent_dev "$_val")
|
|
|
|
sed -i -e "s#^${_opt}[[:space:]]\+$_val#$_opt $_pdev#" "${initdir}/tmp/$$-kdump.conf"
|
|
|
|
;;
|
|
|
|
ssh | nfs)
|
2022-11-23 01:42:18 +00:00
|
|
|
kdump_collect_netif_usage "$_val"
|
2021-11-09 13:42:45 +00:00
|
|
|
;;
|
|
|
|
dracut_args)
|
|
|
|
if [[ $(get_dracut_args_fstype "$_val") == nfs* ]]; then
|
2022-11-23 01:42:18 +00:00
|
|
|
kdump_collect_netif_usage "$(get_dracut_args_target "$_val")"
|
2021-11-09 13:42:45 +00:00
|
|
|
fi
|
|
|
|
;;
|
|
|
|
kdump_pre | kdump_post | extra_bins)
|
2021-11-09 14:49:08 +00:00
|
|
|
# shellcheck disable=SC2086
|
|
|
|
dracut_install $_val
|
2021-11-09 13:42:45 +00:00
|
|
|
;;
|
|
|
|
core_collector)
|
|
|
|
dracut_install "${_val%%[[:blank:]]*}"
|
|
|
|
;;
|
2020-10-15 12:45:57 +00:00
|
|
|
esac
|
2021-11-03 07:12:31 +00:00
|
|
|
done <<< "$(kdump_read_conf)"
|
2020-10-15 12:45:57 +00:00
|
|
|
|
|
|
|
kdump_install_pre_post_conf
|
|
|
|
|
|
|
|
default_dump_target_install_conf
|
|
|
|
|
2021-11-09 13:42:45 +00:00
|
|
|
kdump_configure_fence_kdump "${initdir}/tmp/$$-kdump.conf"
|
2020-10-15 12:45:57 +00:00
|
|
|
inst "${initdir}/tmp/$$-kdump.conf" "/etc/kdump.conf"
|
2021-11-09 13:27:55 +00:00
|
|
|
rm -f "${initdir}/tmp/$$-kdump.conf"
|
2020-10-15 12:45:57 +00:00
|
|
|
}
|
|
|
|
|
2021-04-19 15:00:10 +00:00
|
|
|
# Default sysctl parameters should suffice for kdump kernel.
|
|
|
|
# Remove custom configurations sysctl.conf & sysctl.d/*
|
|
|
|
remove_sysctl_conf() {
|
|
|
|
|
2020-10-15 12:45:57 +00:00
|
|
|
# As custom configurations like vm.min_free_kbytes can lead
|
|
|
|
# to OOM issues in kdump kernel, avoid them
|
|
|
|
rm -f "${initdir}/etc/sysctl.conf"
|
|
|
|
rm -rf "${initdir}/etc/sysctl.d"
|
|
|
|
rm -rf "${initdir}/run/sysctl.d"
|
|
|
|
rm -rf "${initdir}/usr/lib/sysctl.d"
|
|
|
|
}
|
|
|
|
|
|
|
|
kdump_iscsi_get_rec_val() {
|
|
|
|
|
|
|
|
local result
|
|
|
|
|
|
|
|
# The open-iscsi 742 release changed to using flat files in
|
|
|
|
# /var/lib/iscsi.
|
|
|
|
|
2021-11-09 13:27:55 +00:00
|
|
|
result=$(/sbin/iscsiadm --show -m session -r "$1" | grep "^${2} = ")
|
2020-10-15 12:45:57 +00:00
|
|
|
result=${result##* = }
|
2021-11-09 13:27:55 +00:00
|
|
|
echo "$result"
|
2020-10-15 12:45:57 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
kdump_get_iscsi_initiator() {
|
|
|
|
local _initiator
|
|
|
|
local initiator_conf="/etc/iscsi/initiatorname.iscsi"
|
|
|
|
|
2021-11-09 13:42:45 +00:00
|
|
|
[[ -f $initiator_conf ]] || return 1
|
2020-10-15 12:45:57 +00:00
|
|
|
|
2021-11-03 08:22:51 +00:00
|
|
|
while read -r _initiator; do
|
2021-11-09 13:42:45 +00:00
|
|
|
[[ -z ${_initiator%%#*} ]] && continue # Skip comment lines
|
2020-10-15 12:45:57 +00:00
|
|
|
|
|
|
|
case $_initiator in
|
|
|
|
InitiatorName=*)
|
|
|
|
initiator=${_initiator#InitiatorName=}
|
|
|
|
echo "rd.iscsi.initiator=${initiator}"
|
2021-11-09 13:42:45 +00:00
|
|
|
return 0
|
|
|
|
;;
|
2020-10-15 12:45:57 +00:00
|
|
|
*) ;;
|
|
|
|
esac
|
|
|
|
done < ${initiator_conf}
|
|
|
|
|
|
|
|
return 1
|
|
|
|
}
|
|
|
|
|
|
|
|
# Figure out iBFT session according to session type
|
|
|
|
is_ibft() {
|
2021-11-09 13:42:45 +00:00
|
|
|
[[ "$(kdump_iscsi_get_rec_val "$1" "node.discovery_type")" == fw ]]
|
2020-10-15 12:45:57 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
kdump_setup_iscsi_device() {
|
|
|
|
local path=$1
|
2021-11-09 13:42:45 +00:00
|
|
|
local tgt_name
|
|
|
|
local tgt_ipaddr
|
|
|
|
local username
|
|
|
|
local password
|
|
|
|
local userpwd_str
|
|
|
|
local username_in
|
|
|
|
local password_in
|
|
|
|
local userpwd_in_str
|
|
|
|
local netroot_str
|
|
|
|
local initiator_str
|
2020-10-15 12:45:57 +00:00
|
|
|
local netroot_conf="${initdir}/etc/cmdline.d/50iscsi.conf"
|
|
|
|
local initiator_conf="/etc/iscsi/initiatorname.iscsi"
|
|
|
|
|
|
|
|
dinfo "Found iscsi component $1"
|
|
|
|
|
|
|
|
# Check once before getting explicit values, so we can bail out early,
|
|
|
|
# e.g. in case of pure-hardware(all-offload) iscsi.
|
2021-11-09 13:42:45 +00:00
|
|
|
if ! /sbin/iscsiadm -m session -r "$path" &> /dev/null; then
|
2020-10-15 12:45:57 +00:00
|
|
|
return 1
|
|
|
|
fi
|
|
|
|
|
2021-11-09 13:27:55 +00:00
|
|
|
if is_ibft "$path"; then
|
2020-10-15 12:45:57 +00:00
|
|
|
return
|
|
|
|
fi
|
|
|
|
|
|
|
|
# Remove software iscsi cmdline generated by 95iscsi,
|
|
|
|
# and let kdump regenerate here.
|
2021-11-09 13:27:55 +00:00
|
|
|
rm -f "${initdir}/etc/cmdline.d/95iscsi.conf"
|
2020-10-15 12:45:57 +00:00
|
|
|
|
2021-11-09 13:27:55 +00:00
|
|
|
tgt_name=$(kdump_iscsi_get_rec_val "$path" "node.name")
|
|
|
|
tgt_ipaddr=$(kdump_iscsi_get_rec_val "$path" "node.conn\[0\].address")
|
2020-10-15 12:45:57 +00:00
|
|
|
|
|
|
|
# get and set username and password details
|
2021-11-09 13:27:55 +00:00
|
|
|
username=$(kdump_iscsi_get_rec_val "$path" "node.session.auth.username")
|
2021-11-09 13:42:45 +00:00
|
|
|
[[ $username == "<empty>" ]] && username=""
|
2021-11-09 13:27:55 +00:00
|
|
|
password=$(kdump_iscsi_get_rec_val "$path" "node.session.auth.password")
|
2021-11-09 13:42:45 +00:00
|
|
|
[[ $password == "<empty>" ]] && password=""
|
2021-11-09 13:27:55 +00:00
|
|
|
username_in=$(kdump_iscsi_get_rec_val "$path" "node.session.auth.username_in")
|
2021-11-09 13:42:45 +00:00
|
|
|
[[ -n $username ]] && userpwd_str="$username:$password"
|
2020-10-15 12:45:57 +00:00
|
|
|
|
|
|
|
# get and set incoming username and password details
|
2021-11-09 13:42:45 +00:00
|
|
|
[[ $username_in == "<empty>" ]] && username_in=""
|
2021-11-09 13:27:55 +00:00
|
|
|
password_in=$(kdump_iscsi_get_rec_val "$path" "node.session.auth.password_in")
|
2021-11-09 13:42:45 +00:00
|
|
|
[[ $password_in == "<empty>" ]] && password_in=""
|
2020-10-15 12:45:57 +00:00
|
|
|
|
2021-11-09 13:42:45 +00:00
|
|
|
[[ -n $username_in ]] && userpwd_in_str=":$username_in:$password_in"
|
2020-10-15 12:45:57 +00:00
|
|
|
|
2022-11-23 01:42:18 +00:00
|
|
|
kdump_collect_netif_usage "$tgt_ipaddr"
|
2020-10-15 12:45:57 +00:00
|
|
|
|
|
|
|
# prepare netroot= command line
|
|
|
|
# FIXME: Do we need to parse and set other parameters like protocol, port
|
|
|
|
# iscsi_iface_name, netdev_name, LUN etc.
|
|
|
|
|
2021-11-09 13:27:55 +00:00
|
|
|
if is_ipv6_address "$tgt_ipaddr"; then
|
2020-10-15 12:45:57 +00:00
|
|
|
tgt_ipaddr="[$tgt_ipaddr]"
|
|
|
|
fi
|
|
|
|
netroot_str="netroot=iscsi:${userpwd_str}${userpwd_in_str}@$tgt_ipaddr::::$tgt_name"
|
|
|
|
|
2021-11-09 13:27:55 +00:00
|
|
|
[[ -f $netroot_conf ]] || touch "$netroot_conf"
|
2020-10-15 12:45:57 +00:00
|
|
|
|
|
|
|
# If netroot target does not exist already, append.
|
2021-11-09 13:27:55 +00:00
|
|
|
if ! grep -q "$netroot_str" "$netroot_conf"; then
|
2021-11-09 13:42:45 +00:00
|
|
|
echo "$netroot_str" >> "$netroot_conf"
|
|
|
|
dinfo "Appended $netroot_str to $netroot_conf"
|
2020-10-15 12:45:57 +00:00
|
|
|
fi
|
|
|
|
|
|
|
|
# Setup initator
|
2021-11-09 13:35:45 +00:00
|
|
|
if ! initiator_str=$(kdump_get_iscsi_initiator); then
|
|
|
|
derror "Failed to get initiator name"
|
|
|
|
return 1
|
|
|
|
fi
|
2020-10-15 12:45:57 +00:00
|
|
|
|
|
|
|
# If initiator details do not exist already, append.
|
2021-11-09 13:27:55 +00:00
|
|
|
if ! grep -q "$initiator_str" "$netroot_conf"; then
|
2021-11-09 13:42:45 +00:00
|
|
|
echo "$initiator_str" >> "$netroot_conf"
|
|
|
|
dinfo "Appended $initiator_str to $netroot_conf"
|
2020-10-15 12:45:57 +00:00
|
|
|
fi
|
|
|
|
}
|
|
|
|
|
2021-11-09 13:42:45 +00:00
|
|
|
kdump_check_iscsi_targets() {
|
2020-10-15 12:45:57 +00:00
|
|
|
# If our prerequisites are not met, fail anyways.
|
2021-11-09 13:42:45 +00:00
|
|
|
type -P iscsistart > /dev/null || return 1
|
2020-10-15 12:45:57 +00:00
|
|
|
|
2022-11-25 05:57:32 +00:00
|
|
|
kdump_check_setup_iscsi() {
|
2020-10-15 12:45:57 +00:00
|
|
|
local _dev
|
|
|
|
_dev=$1
|
|
|
|
|
|
|
|
[[ -L /sys/dev/block/$_dev ]] || return
|
2021-11-03 07:47:34 +00:00
|
|
|
cd "$(readlink -f "/sys/dev/block/$_dev")" || return 1
|
2020-10-15 12:45:57 +00:00
|
|
|
until [[ -d sys || -d iscsi_session ]]; do
|
|
|
|
cd ..
|
|
|
|
done
|
|
|
|
[[ -d iscsi_session ]] && kdump_setup_iscsi_device "$PWD"
|
2022-11-25 05:57:32 +00:00
|
|
|
}
|
2020-10-15 12:45:57 +00:00
|
|
|
|
|
|
|
[[ $hostonly ]] || [[ $mount_needs ]] && {
|
|
|
|
for_each_host_dev_and_slaves_all kdump_check_setup_iscsi
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
# hostname -a is deprecated, do it by ourself
|
|
|
|
get_alias() {
|
|
|
|
local ips
|
|
|
|
local entries
|
|
|
|
local alias_set
|
|
|
|
|
|
|
|
ips=$(hostname -I)
|
2021-11-09 13:42:45 +00:00
|
|
|
for ip in $ips; do
|
|
|
|
# in /etc/hosts, alias can come at the 2nd column
|
|
|
|
if entries=$(grep "$ip" /etc/hosts | awk '{ $1=""; print $0 }'); then
|
|
|
|
alias_set="$alias_set $entries"
|
|
|
|
fi
|
2020-10-15 12:45:57 +00:00
|
|
|
done
|
|
|
|
|
2021-11-09 13:27:55 +00:00
|
|
|
echo "$alias_set"
|
2020-10-15 12:45:57 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
is_localhost() {
|
2021-11-03 09:30:56 +00:00
|
|
|
local hostnames
|
|
|
|
local shortnames
|
|
|
|
local aliasname
|
2020-10-15 12:45:57 +00:00
|
|
|
local nodename=$1
|
|
|
|
|
2021-11-03 09:30:56 +00:00
|
|
|
hostnames=$(hostname -A)
|
|
|
|
shortnames=$(hostname -A -s)
|
|
|
|
aliasname=$(get_alias)
|
2020-10-15 12:45:57 +00:00
|
|
|
hostnames="$hostnames $shortnames $aliasname"
|
|
|
|
|
|
|
|
for name in ${hostnames}; do
|
2021-11-09 13:42:45 +00:00
|
|
|
if [[ $name == "$nodename" ]]; then
|
2020-10-15 12:45:57 +00:00
|
|
|
return 0
|
|
|
|
fi
|
|
|
|
done
|
|
|
|
return 1
|
|
|
|
}
|
|
|
|
|
|
|
|
# retrieves fence_kdump nodes from Pacemaker cluster configuration
|
|
|
|
get_pcs_fence_kdump_nodes() {
|
|
|
|
local nodes
|
|
|
|
|
|
|
|
pcs cluster sync > /dev/null 2>&1 && pcs cluster cib-upgrade > /dev/null 2>&1
|
|
|
|
# get cluster nodes from cluster cib, get interface and ip address
|
2021-11-03 08:24:01 +00:00
|
|
|
nodelist=$(pcs cluster cib | xmllint --xpath "/cib/status/node_state/@uname" -)
|
2020-10-15 12:45:57 +00:00
|
|
|
|
|
|
|
# nodelist is formed as 'uname="node1" uname="node2" ... uname="nodeX"'
|
|
|
|
# we need to convert each to node1, node2 ... nodeX in each iteration
|
|
|
|
for node in ${nodelist}; do
|
|
|
|
# convert $node from 'uname="nodeX"' to 'nodeX'
|
2021-11-09 13:27:55 +00:00
|
|
|
eval "$node"
|
|
|
|
nodename="$uname"
|
2020-10-15 12:45:57 +00:00
|
|
|
# Skip its own node name
|
2021-11-09 13:27:55 +00:00
|
|
|
if is_localhost "$nodename"; then
|
2020-10-15 12:45:57 +00:00
|
|
|
continue
|
|
|
|
fi
|
|
|
|
nodes="$nodes $nodename"
|
|
|
|
done
|
|
|
|
|
2021-11-09 13:27:55 +00:00
|
|
|
echo "$nodes"
|
2020-10-15 12:45:57 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
# retrieves fence_kdump args from config file
|
|
|
|
get_pcs_fence_kdump_args() {
|
bash scripts: replace '[ ]' with '[[ ]]' for bash scripts
upstream: fedora
resolves: bz2003832
conflict:
function load_kdump_kernel_key() not presented in rhel9,
so related patch hunk are removed.
commit 70978c00e5a573f0901ac404067eaea2c6536370
Author: Kairui Song <kasong@redhat.com>
Date: Wed Sep 8 17:20:51 2021 +0800
bash scripts: replace '[ ]' with '[[ ]]' for bash scripts
kdumpctl, mkdumprd, *-module-setup.sh only target bash, since they
only run in first kernel and depend on dracut, and dracut depends
on bash. So use '[[ ]]' to replace '[ ]'.
This is a batch update done with following command:
`sed -i -e 's/\(\s\)\[\s\([^]]*\)\s\]/\1\[\[\ \2 \]\]/g' kdumpctl, mkdumprd, *-module-setup.sh`
and replaced [ ... -a ... ] with [[ ... ]] && [[ ... ]] manually.
See https://tldp.org/LDP/abs/html/testconstructs.html for more details
on '[[ ]]', it's more versatile, safer, and slightly faster than '[ ]'.
This will also help shfmt to clean up the code in later commits.
Signed-off-by: Kairui Song <kasong@redhat.com>
Acked-by: Philipp Rudo <prudo@redhat.com>
Signed-off-by: Tao Liu <ltao@redhat.com>
2021-11-09 13:13:59 +00:00
|
|
|
if [[ -f $FENCE_KDUMP_CONFIG_FILE ]]; then
|
2021-11-09 13:27:55 +00:00
|
|
|
. "$FENCE_KDUMP_CONFIG_FILE"
|
|
|
|
echo "$FENCE_KDUMP_OPTS"
|
2020-10-15 12:45:57 +00:00
|
|
|
fi
|
|
|
|
}
|
|
|
|
|
|
|
|
get_generic_fence_kdump_nodes() {
|
|
|
|
local filtered
|
|
|
|
local nodes
|
|
|
|
|
kdump-lib.sh: add a config value retrive helper
upstream: fedora
resolves: bz2003832
conflict: none
commit 09ccf88405793220af640c5317cbadb71cf03d36
Author: Kairui Song <kasong@redhat.com>
Date: Mon Aug 16 23:25:14 2021 +0800
kdump-lib.sh: add a config value retrive helper
Add a helper kdump_get_conf_val to replace get_option_value.
It can help cover more corner cases in the code, like when there are
multiple spaces in config file, config value separated by a tab,
heading spaces, or trailing comments.
And this uses "sed group command" and "sed hold buffer", make it much
faster than previous `grep <config> | tail -1`.
This helper is supposed to provide a universal way for kexec-tools
scripts to read in config value. Currently, different scripts are
reading the config in many different fragile ways.
For example, following codes are found in kexec-tools script code base:
1. grep ^force_rebuild $KDUMP_CONFIG_FILE
echo $_force_rebuild | cut -d' ' -f2
2. grep ^kdump_post $KDUMP_CONFIG_FILE | cut -d\ -f2
3. awk '/^sshkey/ {print $2}' $conf_file
4. grep ^path $KDUMP_CONFIG_FILE | cut -d' ' -f2-
1, 2, and 4 will fail if the space is replaced by, e.g. a tab
1 and 2 might fail if there are multiple spaces between config name
and config value:
"kdump_post /var/crash/scripts/kdump-post.sh"
A space will be read instead of config value.
1, 2, 3 will fail if there are space in file path, like:
"kdump_post /var/crash/scripts dir/kdump-post.sh"
4 will fail if there are trailing comments:
"path /var/crash # some comment here"
And all will fail if there are heading space,
" path /var/crash"
And all will most likely cause problems if the config file contains
the same option more than once.
And all of them are slower than the new sed call. Old get_option_value
is also very slow and doesn't handle heading space.
Although we never claim to support heading space or tailing comments
before, it's harmless to be more robust on config reading, and many
conf files in /etc support heading spaces. And have a faster and
safer config reading helper makes it easier to clean up the code.
Signed-off-by: Kairui Song <kasong@redhat.com>
Acked-by: Philipp Rudo <prudo@redhat.com>
Signed-off-by: Tao Liu <ltao@redhat.com>
2021-11-03 07:19:50 +00:00
|
|
|
nodes=$(kdump_get_conf_val "fence_kdump_nodes")
|
2020-10-15 12:45:57 +00:00
|
|
|
for node in ${nodes}; do
|
|
|
|
# Skip its own node name
|
2021-11-09 13:27:55 +00:00
|
|
|
if is_localhost "$node"; then
|
2020-10-15 12:45:57 +00:00
|
|
|
continue
|
|
|
|
fi
|
|
|
|
filtered="$filtered $node"
|
|
|
|
done
|
2021-11-09 13:27:55 +00:00
|
|
|
echo "$filtered"
|
2020-10-15 12:45:57 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
# setup fence_kdump in cluster
|
|
|
|
# setup proper network and install needed files
|
2021-11-09 13:42:45 +00:00
|
|
|
kdump_configure_fence_kdump() {
|
2020-10-15 12:45:57 +00:00
|
|
|
local kdump_cfg_file=$1
|
|
|
|
local nodes
|
|
|
|
local args
|
|
|
|
|
|
|
|
if is_generic_fence_kdump; then
|
|
|
|
nodes=$(get_generic_fence_kdump_nodes)
|
|
|
|
|
|
|
|
elif is_pcs_fence_kdump; then
|
|
|
|
nodes=$(get_pcs_fence_kdump_nodes)
|
|
|
|
|
|
|
|
# set appropriate options in kdump.conf
|
2021-11-09 13:27:55 +00:00
|
|
|
echo "fence_kdump_nodes $nodes" >> "${kdump_cfg_file}"
|
2020-10-15 12:45:57 +00:00
|
|
|
|
|
|
|
args=$(get_pcs_fence_kdump_args)
|
2021-11-09 13:42:45 +00:00
|
|
|
if [[ -n $args ]]; then
|
2021-11-09 13:27:55 +00:00
|
|
|
echo "fence_kdump_args $args" >> "${kdump_cfg_file}"
|
2020-10-15 12:45:57 +00:00
|
|
|
fi
|
|
|
|
|
|
|
|
else
|
|
|
|
# fence_kdump not configured
|
|
|
|
return 1
|
|
|
|
fi
|
|
|
|
|
|
|
|
# setup network for each node
|
|
|
|
for node in ${nodes}; do
|
2022-11-23 01:42:18 +00:00
|
|
|
kdump_collect_netif_usage "$node"
|
2020-10-15 12:45:57 +00:00
|
|
|
done
|
|
|
|
|
|
|
|
dracut_install /etc/hosts
|
|
|
|
dracut_install /etc/nsswitch.conf
|
2021-11-09 13:27:55 +00:00
|
|
|
dracut_install "$FENCE_KDUMP_SEND"
|
2020-10-15 12:45:57 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
# Install a random seed used to feed /dev/urandom
|
|
|
|
# By the time kdump service starts, /dev/uramdom is already fed by systemd
|
|
|
|
kdump_install_random_seed() {
|
2021-11-03 07:51:02 +00:00
|
|
|
local poolsize
|
|
|
|
|
2021-11-09 13:42:45 +00:00
|
|
|
poolsize=$(< /proc/sys/kernel/random/poolsize)
|
2020-10-15 12:45:57 +00:00
|
|
|
|
2021-11-09 13:27:55 +00:00
|
|
|
if [[ ! -d "${initdir}/var/lib/" ]]; then
|
|
|
|
mkdir -p "${initdir}/var/lib/"
|
2020-10-15 12:45:57 +00:00
|
|
|
fi
|
|
|
|
|
2021-11-09 13:27:55 +00:00
|
|
|
dd if=/dev/urandom of="${initdir}/var/lib/random-seed" \
|
2021-11-09 13:42:45 +00:00
|
|
|
bs="$poolsize" count=1 2> /dev/null
|
2020-10-15 12:45:57 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
kdump_install_systemd_conf() {
|
|
|
|
# Kdump turns out to require longer default systemd mount timeout
|
|
|
|
# than 1st kernel(90s by default), we use default 300s for kdump.
|
2021-11-09 13:35:45 +00:00
|
|
|
if ! grep -q -r "^[[:space:]]*DefaultTimeoutStartSec=" "${initdir}/etc/systemd/system.conf"*; then
|
2021-11-09 13:27:55 +00:00
|
|
|
mkdir -p "${initdir}/etc/systemd/system.conf.d"
|
|
|
|
echo "[Manager]" > "${initdir}/etc/systemd/system.conf.d/kdump.conf"
|
|
|
|
echo "DefaultTimeoutStartSec=300s" >> "${initdir}/etc/systemd/system.conf.d/kdump.conf"
|
2020-10-15 12:45:57 +00:00
|
|
|
fi
|
|
|
|
|
2020-11-05 05:34:29 +00:00
|
|
|
# Forward logs to console directly, and don't read Kmsg, this avoids
|
|
|
|
# unneccessary memory consumption and make console output more useful.
|
2020-10-15 12:45:57 +00:00
|
|
|
# Only do so for non fadump image.
|
2021-11-09 13:27:55 +00:00
|
|
|
mkdir -p "${initdir}/etc/systemd/journald.conf.d"
|
|
|
|
echo "[Journal]" > "${initdir}/etc/systemd/journald.conf.d/kdump.conf"
|
|
|
|
echo "Storage=volatile" >> "${initdir}/etc/systemd/journald.conf.d/kdump.conf"
|
|
|
|
echo "ReadKMsg=no" >> "${initdir}/etc/systemd/journald.conf.d/kdump.conf"
|
|
|
|
echo "ForwardToConsole=yes" >> "${initdir}/etc/systemd/journald.conf.d/kdump.conf"
|
2020-10-15 12:45:57 +00:00
|
|
|
}
|
|
|
|
|
2021-12-29 03:21:42 +00:00
|
|
|
remove_cpu_online_rule() {
|
|
|
|
local file=${initdir}/usr/lib/udev/rules.d/40-redhat.rules
|
|
|
|
|
|
|
|
sed -i '/SUBSYSTEM=="cpu"/d' "$file"
|
|
|
|
}
|
|
|
|
|
2020-10-15 12:45:57 +00:00
|
|
|
install() {
|
2022-11-23 01:42:18 +00:00
|
|
|
declare -A unique_netifs ipv4_usage ipv6_usage
|
Support setting up Open vSwitch (Ovs) Bridge network
Resolves: https://issues.redhat.com/browse/RHEL-33465
Conflict: C9S misses the following two commits,
- 1397006 ("dracut-module-setup: Remove remove_cpu_online_rule() since PowerPC uses nr_cpus")
- 73c9eb7 ("dracut-module-setup: remove old s390 network device config (#1937048)")
Upstream Status: git@github.com:rhkdump/kdump-utils.git
commit 224d3102c54749eae98bfa1af8932aade8e4d2da
Author: Coiby Xu <coxu@redhat.com>
Date: Mon Apr 22 15:02:42 2024 +0800
Support setting up Open vSwitch (Ovs) Bridge network
Resolves: https://issues.redhat.com/browse/RHEL-33465
This patch supports setting up an Ovs bridge in kdump initrd. An Ovs
bridge is similar to a classic Linux bridge but we use ovs-vsctl to find
out the Ethernet device (having the MAC address as the bridge) added to
an Ovs bridge. Once we copy all the needed NetworkManager (NM) connection
profiles to kdump initrd and all the necessary files, NM will create an Ovs bridge
automatically in kdump initrd.
In the case of OpenShift Container Platform (OCP),
ovs-configuration.service [1] is responsible for setting up an Ovs bridge.
In theory, we can also try to bring up the original physical network
interface before ovs-configuration.service. But this approach is
cumbersome because it breaks our assumption that we should bring up the
same network in kdump intrd as in 1st kernel (establishing the same network
in kdump initrd only needs to copy the needed NM connection profiles
thus we don't need to learn how different network setup work under the
hood).
How to test this patch with the help of configure-ovs.sh?
=========================================================
1. Extract configure-ovs.sh from [2]
2. Install necessary packages for configure-ovs.sh
dnf install openvswitch -yq
dnf install NetworkManager-ovs nmap-ncat -yq
systemctl enable --now openvswitch
# restart NM so the ovs plugin can be activated
systemctl restart NetworkManager
3. Assume the network interface used for creating an Ovs bridge is
"ens2", use configure-ovs.sh to create an Ovs bridge,
interface=ens2
mkdir -p /etc/ovnk
echo $interface > /etc/ovnk/iface_default_hint
bash configure-ovs.sh OVNKubernetes
4. (Optional) If you want to make the created Ovs bridge survive a
reboot, simply make the created NM connections created by
configure-ovs.sh persist,
cp /run/NetworkManager/system-connections/ovs-* /etc/NetworkManager/system-connections/
If you need to create an Ovs bridge on top of a bonding network, use the
following commands for step 3,
nmcli con add type bond ifname bond0
nmcli con add type ethernet ifname eth0 master bond0
nmcli con add type ethernet ifname eth1 master bond0
echo bond0 > /etc/ovnk/iface_default_hint
bash configure-ovs.sh OVNKubernetes
Note
1. For RHEL, openvswitch3.3 may be installed so we need to get the
package name by "rpm -qf /usr/lib/systemd/system/openvswitch.service"
2. For RHEL9, openvswitch package needs to installed from another repo,
cat << 'EOF' > /etc/yum.repos.d/ovs.repo
[rhosp-rhel-9-fdp-cdn]
name=Red Hat Enterprise Linux Fast Datapath $releasever - $basearch cdn
baseurl=http://rhsm-pulp.corp.redhat.com/content/dist/layered/rhel9/$basearch/fast-datapath/os/
enabled=1
gpgcheck=0
EOF
dnf install openvswitch3.3 -yq
3. We instruct ovsdb-server to ignore NM connection files changes by
"--ovsdb-server-options='--disable-file-column-diff'". In the
future, this may not be needed if we simply copy all active NM
connection profiles to kdump initrd without changing them after
coming up with different solutions for the following cases,
1. Some environments like some Azure machine doesn't use persistent
NIC name. Current solution is to modify a NM connection
profile to match a device by MAC address, for details check
commit 568623e)
2. If a NIC has an IPv4 or IPv6 address, set the corresponding
may-fail property to no. Otherwise, dumping vmcore over IPv6
could fail because only IPv4 network is ready or vice versa. Current
solution is to disable IPv6 if only IPv4 is used and vice versa,
for details check commit 9dfcacf,
3. Some NICs need longer connection.wait-device-timeout otherwise
the connection will fail to be established (commit 6b586a9).
[1] https://github.com/openshift/machine-config-operator/blob/master/templates/common/_base/units/ovs-configuration.service.yaml
[2] https://github.com/openshift/machine-config-operator/blob/master/templates/common/_base/files/configure-ovs-network.yaml
Signed-off-by: Coiby Xu <coxu@redhat.com>
Signed-off-by: Coiby Xu <coxu@redhat.com>
2024-07-29 09:21:41 +00:00
|
|
|
local arch has_ovs_bridge
|
2021-12-29 03:21:42 +00:00
|
|
|
|
2021-01-22 08:12:00 +00:00
|
|
|
kdump_module_init
|
2020-10-15 12:45:57 +00:00
|
|
|
kdump_install_conf
|
2021-04-19 15:00:10 +00:00
|
|
|
remove_sysctl_conf
|
2020-10-15 12:45:57 +00:00
|
|
|
|
2021-12-29 03:21:42 +00:00
|
|
|
# Onlining secondary cpus breaks kdump completely on KVM on Power hosts
|
|
|
|
# Though we use maxcpus=1 by default but 40-redhat.rules will bring up all
|
|
|
|
# possible cpus by default. (rhbz1270174 rhbz1266322)
|
|
|
|
# Thus before we get the kernel fix and the systemd rule fix let's remove
|
|
|
|
# the cpu online rule in kdump initramfs.
|
|
|
|
arch=$(uname -m)
|
|
|
|
if [[ "$arch" = "ppc64le" ]] || [[ "$arch" = "ppc64" ]]; then
|
|
|
|
remove_cpu_online_rule
|
|
|
|
fi
|
|
|
|
|
2020-10-15 12:45:57 +00:00
|
|
|
if is_ssh_dump_target; then
|
|
|
|
kdump_install_random_seed
|
|
|
|
fi
|
|
|
|
dracut_install -o /etc/adjtime /etc/localtime
|
|
|
|
inst "$moddir/monitor_dd_progress" "/kdumpscripts/monitor_dd_progress"
|
2021-11-09 13:27:55 +00:00
|
|
|
chmod +x "${initdir}/kdumpscripts/monitor_dd_progress"
|
2020-10-15 12:45:57 +00:00
|
|
|
inst "/bin/dd" "/bin/dd"
|
|
|
|
inst "/bin/tail" "/bin/tail"
|
|
|
|
inst "/bin/date" "/bin/date"
|
|
|
|
inst "/bin/sync" "/bin/sync"
|
|
|
|
inst "/bin/cut" "/bin/cut"
|
|
|
|
inst "/bin/head" "/bin/head"
|
|
|
|
inst "/bin/awk" "/bin/awk"
|
|
|
|
inst "/bin/sed" "/bin/sed"
|
2021-11-03 11:09:16 +00:00
|
|
|
inst "/bin/stat" "/bin/stat"
|
2020-10-15 12:45:57 +00:00
|
|
|
inst "/sbin/makedumpfile" "/sbin/makedumpfile"
|
|
|
|
inst "/sbin/vmcore-dmesg" "/sbin/vmcore-dmesg"
|
2020-11-05 05:34:29 +00:00
|
|
|
inst "/usr/bin/printf" "/sbin/printf"
|
|
|
|
inst "/usr/bin/logger" "/sbin/logger"
|
2021-04-20 07:56:16 +00:00
|
|
|
inst "/usr/bin/chmod" "/sbin/chmod"
|
Introduce vmcore creation notification to kdump
Upstream: fedora
Resolves: RHEL-32060
Conflict: Yes, there are several conflicts. 1) Upstream have moved
dracut-kdump.sh into kdump-utils/dracut/99kdumpbase/kdump.sh,
so the targeting files are changed. 2) There are several
patchsets([1] [2]) which not backported to rhel9, so some
formating conflicts encountered. But there is no functional
change been made for the patch backporting.
[1]: https://github.com/rhkdump/kdump-utils/pull/18/commits
[2]: https://github.com/rhkdump/kdump-utils/pull/33/commits
commit 88525ebf5e43cc86aea66dc75ec83db58233883b
Author: Tao Liu <ltao@redhat.com>
Date: Thu Sep 5 15:49:07 2024 +1200
Introduce vmcore creation notification to kdump
Motivation
==========
People may forget to recheck to ensure kdump works, which as a result, a
possibility of no vmcores generated after a real system crash. It is
unexpected for kdump.
It is highly recommended people to recheck kdump after any system
modification, such as:
a. after kernel patching or whole yum update, as it might break something
on which kdump is dependent, maybe due to introduction of any new bug etc.
b. after any change at hardware level, maybe storage, networking,
firmware upgrading etc.
c. after implementing any new application, like which involves 3rd party modules
etc.
Though these exceed the range of kdump, however a simple vmcore creation
status notification is good to have for now.
Design
======
Kdump currently will check any relating files/fs/drivers modified before
determine if initrd should rebuild when (re)start. A rebuild is an
indicator of such modification, and kdump need to be rechecked. This will
clear the vmcore creation status specified in $VMCORE_CREATION_STATUS.
Vmcore creation check will happen at "kdumpctl (re)start/status", and will
report the creation success/fail status to users. A "success" status indicates
previously there has been a vmcore successfully generated based on the current
env, so it is more likely a vmcore will be generated later when real crash
happens; A "fail" status indicates previously there was no vmcore
generated, or has been a vmcore creation failed based on current env. User
should check the 2nd kernel log or the kexec-dmesg.log for the failing reason.
$VMCORE_CREATION_STATUS is used for recording the vmcore creation status of
the current env. The format will be like:
success 1718682002
Which means, there has been a vmcore generated successfully at this
timestamp for the current env.
Usage
=====
[root@localhost ~]# kdumpctl restart
kdump: kexec: unloaded kdump kernel
kdump: Stopping kdump: [OK]
kdump: kexec: loaded kdump kernel
kdump: Starting kdump: [OK]
kdump: Notice: No vmcore creation test performed!
[root@localhost ~]# kdumpctl test
[root@localhost ~]# kdumpctl status
kdump: Kdump is operational
kdump: Notice: Last successful vmcore creation on Tue Jun 18 16:39:10 CST 2024
[root@localhost ~]# kdumpctl restart
kdump: kexec: unloaded kdump kernel
kdump: Stopping kdump: [OK]
kdump: kexec: loaded kdump kernel
kdump: Starting kdump: [OK]
kdump: Notice: Last successful vmcore creation on Tue Jun 18 16:39:10 CST 2024
The notification for kdumpctl (re)start/status can be disabled by
setting VMCORE_CREATION_NOTIFICATION in /etc/sysconfig/kdump
Signed-off-by: Tao Liu <ltao@redhat.com>
Signed-off-by: Tao Liu <ltao@redhat.com>
2024-10-08 01:48:04 +00:00
|
|
|
inst "/usr/bin/dirname" "/sbin/dirname"
|
2020-10-15 12:45:57 +00:00
|
|
|
inst "/lib/kdump/kdump-lib-initramfs.sh" "/lib/kdump-lib-initramfs.sh"
|
2020-11-05 05:34:29 +00:00
|
|
|
inst "/lib/kdump/kdump-logger.sh" "/lib/kdump-logger.sh"
|
2020-10-15 12:45:57 +00:00
|
|
|
inst "$moddir/kdump.sh" "/usr/bin/kdump.sh"
|
|
|
|
inst "$moddir/kdump-capture.service" "$systemdsystemunitdir/kdump-capture.service"
|
2020-12-23 10:00:07 +00:00
|
|
|
systemctl -q --root "$initdir" add-wants initrd.target kdump-capture.service
|
2020-10-15 12:45:57 +00:00
|
|
|
# Replace existing emergency service and emergency target
|
|
|
|
cp "$moddir/kdump-emergency.service" "$initdir/$systemdsystemunitdir/emergency.service"
|
|
|
|
cp "$moddir/kdump-emergency.target" "$initdir/$systemdsystemunitdir/emergency.target"
|
|
|
|
# Also redirect dracut-emergency to kdump error handler
|
|
|
|
ln_r "$systemdsystemunitdir/emergency.service" "$systemdsystemunitdir/dracut-emergency.service"
|
|
|
|
|
2024-07-23 03:00:45 +00:00
|
|
|
# Disable ostree as we only need the physical root
|
|
|
|
systemctl -q --root "$initdir" mask ostree-prepare-root.service
|
|
|
|
|
2020-10-15 12:45:57 +00:00
|
|
|
# Check for all the devices and if any device is iscsi, bring up iscsi
|
|
|
|
# target. Ideally all this should be pushed into dracut iscsi module
|
|
|
|
# at some point of time.
|
|
|
|
kdump_check_iscsi_targets
|
|
|
|
|
|
|
|
kdump_install_systemd_conf
|
|
|
|
|
|
|
|
# nfs/ssh dump will need to get host ip in second kernel and need to call 'ip' tool, see get_host_ip for more detail
|
|
|
|
if is_nfs_dump_target || is_ssh_dump_target; then
|
|
|
|
inst "ip"
|
|
|
|
fi
|
|
|
|
|
2022-11-23 01:42:18 +00:00
|
|
|
kdump_install_net
|
|
|
|
|
2020-10-15 12:45:57 +00:00
|
|
|
# For the lvm type target under kdump, in /etc/lvm/lvm.conf we can
|
|
|
|
# safely replace "reserved_memory=XXXX"(default value is 8192) with
|
|
|
|
# "reserved_memory=1024" to lower memory pressure under kdump. We do
|
|
|
|
# it unconditionally here, if "/etc/lvm/lvm.conf" doesn't exist, it
|
|
|
|
# actually does nothing.
|
|
|
|
sed -i -e \
|
2021-11-09 13:42:45 +00:00
|
|
|
's/\(^[[:space:]]*reserved_memory[[:space:]]*=\)[[:space:]]*[[:digit:]]*/\1 1024/' \
|
|
|
|
"${initdir}/etc/lvm/lvm.conf" &> /dev/null
|
2020-10-15 12:45:57 +00:00
|
|
|
|
dracut-module-setup: Skip initrd-cleanup and initrd-parse-etc in kdump
Resolves: https://issues.redhat.com/browse/RHEL-13996
Upstream: Fedora
Conflict: None
commit 468336700df86b52cd673d68561ba460ff2390be
Author: Lichen Liu <lichliu@redhat.com>
Date: Mon Jan 22 15:59:09 2024 +0800
dracut-module-setup: Skip initrd-cleanup and initrd-parse-etc in kdump
When using multipath devices as the target for kdump, if user_friendly_name
is also specified, devices default to names like "mpath*", e.g., mpatha.
In dracut, we obtain a persistent device name via get_persistent_dev. However,
dracut currently believes using /dev/mapper/mpath* could cause issues, thus
alternatively names are used, here it's /dev/disk/by-uuid/<FS_UUID>.
During the kdump boot progress, the /dev/disk/by-uuid/<FS_UUID> will exist as
soon as one of the path devices exists, but it won't be usable by systemd,
since multipathd will claim that device as a path device. Then multipathd will
get stopped before it can create the multipath device.
Without user_friendly_name, /dev/mapper/<WWID> is considered a persistent
device name, avoiding the issue.
The exit of multipathd is due to two dependencies in the current dracut module
90multipath/multipathd.service, "Before=initrd-cleanup.service" and
"Conflicts=initrd-cleanup.service".
As per man 5 systemd.unit, if A.service has "Conflicts=B.service", starting
B.service will stop A.service.
This is useful during normal boot. However, we will never switch-root after
capturing vmcore in kdump.
We need to ensure that multipathd is not killed due to such dependency issue.
Without modifying multipathd.service, we add ConditionPathExists=!/proc/vmcore
to skip initrd-cleanup.service in kdump. This approach is beneficial as
it avoid the potential termination of other services that conflict with
initrd-cleanup.service. Also skip initrd-parse-etc.service as it will try to
start initrd-cleanup.service. Both of these services are used for switch root,
so they can be safely skipped in kdump.
Suggested-by: Benjamin Marzinski <bmarzins@redhat.com>
Suggested-by: Dave Young <dyoung@redhat.com>
Signed-off-by: Lichen Liu <lichliu@redhat.com>
Reviewed-by: Philipp Rudo <prudo@redhat.com>
Signed-off-by: Lichen Liu <lichliu@redhat.com>
2024-01-24 07:50:54 +00:00
|
|
|
# Skip initrd-cleanup.service and initrd-parse-etc.service becasue we don't
|
|
|
|
# need to switch root. Instead of removing them, we use ConditionPathExists
|
|
|
|
# to check if /proc/vmcore exists to determine if we are in kdump.
|
|
|
|
sed -i '/\[Unit\]/a ConditionPathExists=!\/proc\/vmcore' \
|
|
|
|
"${initdir}/${systemdsystemunitdir}/initrd-cleanup.service" &> /dev/null
|
|
|
|
|
|
|
|
sed -i '/\[Unit\]/a ConditionPathExists=!\/proc\/vmcore' \
|
|
|
|
"${initdir}/${systemdsystemunitdir}/initrd-parse-etc.service" &> /dev/null
|
|
|
|
|
2020-10-15 12:45:57 +00:00
|
|
|
# Save more memory by dropping switch root capability
|
2021-07-12 08:07:05 +00:00
|
|
|
dracut_no_switch_root
|
2020-10-15 12:45:57 +00:00
|
|
|
}
|