From 27cc5e08c2c1880dba66ce46cabebfd17cac8fde Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Petr=20Men=C5=A1=C3=ADk?= Date: Sat, 6 Nov 2021 19:20:44 +0100 Subject: [PATCH] Switch to NM resolver on systemd-resolved uninstall MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit If /etc/resolv.conf pointed to systemd-resolved stub configuration, it is obvious it would stop working. Compensate it by deleting the link, it would be created again on installation. Try to pass ownership to NM, which also provides similar file. Keep it missing otherwise, might be created by unknown tool on reboot. Signed-off-by: Petr Menšík --- systemd.spec | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/systemd.spec b/systemd.spec index 49e0b6f..618e0c9 100644 --- a/systemd.spec +++ b/systemd.spec @@ -920,6 +920,14 @@ if [ $1 -eq 0 ] ; then systemctl disable --quiet \ systemd-resolved.service \ >/dev/null || : + if [ -L %{_sysconfdir}/resolv.conf ] && \ + realpath %{_sysconfdir}/resolv.conf | grep ^/run/systemd/resolve/; then + rm -f %{_sysconfdir}/resolv.conf # no longer useful + # if network manager is enabled, move to it instead + [ -f /run/NetworkManager/resolv.conf ] && \ + systemctl -q is-enabled NetworkManager.service &>/dev/null && \ + ln -fsv ../run/NetworkManager/resolv.conf %{_sysconfdir}/resolv.conf + fi fi %post resolved