From 6b586a903632831b05f591048fdb7de4af273088 Mon Sep 17 00:00:00 2001 From: Coiby Xu Date: Thu, 22 Sep 2022 22:08:43 +0800 Subject: [PATCH] Apply the timeout configuration of nm-initrd-generator nm-wait-online-initrd.service installed by dracut's 35-networkmanager module calls nm-online with "-s" which means it returns immediately when NetworkManager logs "startup complete" after certain timeouts are reached. "startup complete" doesn't necessarily network connectivity has been established. nm-initrd-generator has a set of timeouts that in most of cases when applied, "startup-complete" means network connectivity has been established. So apply it when setting up kdump network. Suggested-by: Thomas Haller Signed-off-by: Coiby Xu Reviewed-by: Thomas Haller Reviewed-by: Philipp Rudo --- dracut-module-setup.sh | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/dracut-module-setup.sh b/dracut-module-setup.sh index e5ca6f7..aeff5fc 100755 --- a/dracut-module-setup.sh +++ b/dracut-module-setup.sh @@ -365,6 +365,22 @@ kdump_setup_ifname() { echo "$_ifname" } +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" +} + use_ipv4_or_ipv6() { local _netif=$1 _uuid=$2 @@ -416,6 +432,7 @@ clone_and_modify_nmconnection() { use_ipv4_or_ipv6 "$_dev" "$_uuid" + nmcli connection modify --temporary uuid "$_uuid" connection.wait-device-timeout 60000 &> >(ddebug) _cloned_nmconnection_file_path=$(nmcli --get-values UUID,FILENAME connection show | sed -n "s/^${_uuid}://p") _tmp_nmconnection_file_path=$_DRACUT_KDUMP_NM_TMP_DIR/$(basename "$_nmconnection_file_path") cp "$_cloned_nmconnection_file_path" "$_tmp_nmconnection_file_path"