Resolves:
https://issues.redhat.com/browse/RHEL-11897
Some users may choose to manage /etc/resolve.conf manually [1]
by setting dns=none or use a symbolic link resolve.conf [2].
In this case, network dumping will not work because DNS resolution
fails. Use the same /etc/resolve.conf in kdump initrd to fix this
problem.
[1]
https://bugzilla.gnome.org/show_bug.cgi?id=690404
[2]
https://access.redhat.com/documentation/en-us/red_hat_enterprise_linux/8/...
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>
---
v4
- use dracut's inst to install the symbolic link and target file
automatically [Dave]
- drop the unneeded check of symbolic link to tell if dns=none for NM
v3
- Dave
- use "systemctl -q is-active systemd-resolved" to tell if
/etc/resolv.conf is managed by systemd-resolved
- drop needless and unreliable check on whether resolv.conf is generated by NM
- configure dns=none for NM to prevent resolv.conf being overwritten by NM
- take care of the case where user-configured resolv.conf is a symbolic file
v2
- use 'grep "\|"' instead of 'grep | grep' for multiple
patterns
matching
- improve commit message
---
dracut-module-setup.sh | 28 ++++++++++++++++++++++++++++
1 file changed, 28 insertions(+)
diff --git a/dracut-module-setup.sh b/dracut-module-setup.sh
index ff53d084..ab6dc4f1 100755
--- a/dracut-module-setup.sh
+++ b/dracut-module-setup.sh
@@ -563,6 +563,33 @@ kdump_collect_netif_usage() {
fi
}
+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/...
+ systemctl -q is-enabled systemd-resolved && return 0
+ inst "$_resolv_conf"
+ if NetworkManager --print-config | grep -qs "^dns=none"; then
+ echo "[main]\ndns=none" >
"$_nm_conf_dir"/90-dns-none.conf
+ fi
+}
+
# Setup dracut to bring up network interface that enable
# initramfs accessing giving destination
kdump_install_net() {
@@ -575,6 +602,7 @@ kdump_install_net() {
kdump_setup_znet
kdump_install_nm_netif_allowlist "$_netifs"
kdump_install_nic_driver "$_netifs"
+ kdump_install_resolv_conf
fi
}
Hi Coiby, thanks for the update:
Reviewed-by: Dave Young <dyoung(a)redhat.com>
--
2.42.0
--
_______________________________________________
kexec mailing list -- kexec(a)lists.fedoraproject.org
To unsubscribe send an email to kexec-leave(a)lists.fedoraproject.org
Fedora Code of Conduct:
https://docs.fedoraproject.org/en-US/project/code-of-conduct/
List Guidelines:
https://fedoraproject.org/wiki/Mailing_list_guidelines
List Archives:
https://lists.fedoraproject.org/archives/list/kexec@lists.fedoraproject.org
Do not reply to spam, report it:
https://pagure.io/fedora-infrastructure/new_issue