Some users may choose to manage /etc/resolve.conf manually. In this case,
network dumping will not work because DNS resolution doesn't work. Copy
/etc/resolve.conf to kdump initrd if this file is not managed by
systemd-resolved or NetworkManager.
Fixes: 63c3805c ("Set up kdump network by directly copying NM connection profile to
initrd")
Reported-by: Curtis Taylor <cutaylor(a)redhat.com>
Cc: Jie Li <jieli(a)redhat.com>
Signed-off-by: Coiby Xu <coxu(a)redhat.com>
---
dracut-module-setup.sh | 14 ++++++++++++++
1 file changed, 14 insertions(+)
diff --git a/dracut-module-setup.sh b/dracut-module-setup.sh
index ff53d084..e6355973 100755
--- a/dracut-module-setup.sh
+++ b/dracut-module-setup.sh
@@ -563,6 +563,19 @@ kdump_collect_netif_usage() {
fi
}
+kdump_install_resolv_conf() {
+
+ local _resolv_conf=/etc/resolv.conf
+
+ # Some users may choose to manage /etc/resolve.conf manually.
+ #
+ # We can tell this case by confirming this file is not manged by
+ # systemd-resolved or NetworkManager.
+ if ! grep -qs "^nameserver 127.0.0.53" "$_resolv_conf" &&
! grep -qs "^# Generated by NetworkManager" "$_resolv_conf"; then
+ dracut_install "$_resolv_conf"
+ fi
+}
+
# Setup dracut to bring up network interface that enable
# initramfs accessing giving destination
kdump_install_net() {
@@ -575,6 +588,7 @@ kdump_install_net() {
kdump_setup_znet
kdump_install_nm_netif_allowlist "$_netifs"
kdump_install_nic_driver "$_netifs"
+ kdump_install_resolv_conf
fi
}
--
2.41.0