From c179f45e05c36703359cde610791da822cd572c5 Mon Sep 17 00:00:00 2001 From: Coiby Xu Date: Dec 26 2023 04:46:10 +0000 Subject: Use the same /etc/resolve.conf in kdump initrd if it's managed manually Resolves: https://issues.redhat.com/browse/RHEL-11897 Upstream: Fedora Conflict: None commit 38d9990389d80039964668a4db9cc9c039eac68f Author: Coiby Xu Date: Tue Dec 26 11:17:29 2023 +0800 Use the same /etc/resolve.conf in kdump initrd if it's managed manually Resolves: https://issues.redhat.com/browse/RHEL-11897 Previously fix 0177e248 ("Use the same /etc/resolve.conf in kdump initrd if it's managed manually") is problematic, 1) it generated .conf file unrecognized by NetowrkManager ; 2) this .conf file was installed to current file system instead of to the kdump initrd; 3) this incorrect .conf file prevented the starting of NetworkManager. This patch fixes the above issues and also suppresses a harmless warning when systemd-resolved.service doesn't exist, # systemctl -q is-enabled systemd-resolved Failed to get unit file state for systemd-resolved.service: No such file or directory Fixes: 0177e248 ("Use the same /etc/resolve.conf in kdump initrd if it's managed manually") Reported-by: Jie Li Cc: Dave Young Reviewed-by: Dave Young Signed-off-by: Coiby Xu Signed-off-by: Coiby Xu --- diff --git a/dracut-module-setup.sh b/dracut-module-setup.sh index 3898dac..03d0cba 100755 --- a/dracut-module-setup.sh +++ b/dracut-module-setup.sh @@ -596,10 +596,10 @@ kdump_install_resolv_conf() { # # [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 - systemctl -q is-enabled systemd-resolved && return 0 + systemctl -q is-enabled systemd-resolved 2> /dev/null && 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 + printf "[main]\ndns=none\n" > "${initdir}/${_nm_conf_dir}"/90-dns-none.conf fi }