Skip to contentSkip to conversation

Revert "networkmanager: Use ALTERNATIVES for resolv-conf handling."

PATCH In review [email protected] 3 participants 3 messages Sep 2, 2019 – Sep 3, 2019

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 Revert "networkmanager: Use ALTERNATIVES for resolv-conf handling."

From: Kai Kang <[email protected]>

This reverts commit 3982dc5b1994ffcc52336b02fbd2c44db164dd82.

With this commit it creates link file /etc/resolv.conf via update-alternatives but the target doesn't exist.

On target:

root@qemux86-64:~# ls -l /etc/resolv*
lrwxrwxrwx    1 root     root            33 Aug 27 09:17 /etc/resolv-conf.NetworkManager -> ../run/NetworkManager/resolv.conf
lrwxrwxrwx    1 root     root            34 Aug 23 03:08 /etc/resolv-conf.systemd -> ../run/systemd/resolve/resolv.conf
lrwxrwxrwx    1 root     root            31 Aug 27 09:22 /etc/resolv.conf -> /etc/resolv-conf.NetworkManager
root@qemux86-64:~# ls -l /run/NetworkManager/resolv.conf
ls: /run/NetworkManager/resolv.conf: No such file or directory
root@qemux86-64:~# cat /etc/resolv.conf
cat: can't open '/etc/resolv.conf': No such file or directory
---
 .../networkmanager/networkmanager_1.18.2.bb          | 12 +-----------
 1 file changed, 1 insertion(+), 11 deletions(-)
meta-networking/recipes-connectivity/networkmanager/networkmanager_1.18.2.bb +1 -11
index b760a40c3..4149eddf0 100644
@@ -19,7 +19,7 @@ DEPENDS = " \
     curl \
 "
 
-inherit gnomebase gettext systemd bash-completion vala gobject-introspection gtk-doc update-alternatives
+inherit gnomebase gettext systemd bash-completion vala gobject-introspection gtk-doc
 
 SRC_URI = " \
     ${GNOME_MIRROR}/NetworkManager/${@gnome_verdir("${PV}")}/NetworkManager-${PV}.tar.xz \
@@ -131,16 +131,6 @@ FILES_${PN}-nmtui-doc = " \
 
 SYSTEMD_SERVICE_${PN} = "${@bb.utils.contains('PACKAGECONFIG', 'systemd', 'NetworkManager.service NetworkManager-dispatcher.service', '', d)}"
 
-ALTERNATIVE_PRIORITY = "100"
-ALTERNATIVE_${PN} = "${@bb.utils.contains('DISTRO_FEATURES','systemd','resolv-conf','',d)}"
-ALTERNATIVE_TARGET[resolv-conf] = "${@bb.utils.contains('DISTRO_FEATURES','systemd','${sysconfdir}/resolv-conf.NetworkManager','',d)}"
-ALTERNATIVE_LINK_NAME[resolv-conf] = "${@bb.utils.contains('DISTRO_FEATURES','systemd','${sysconfdir}/resolv.conf','',d)}"
-
 do_install_append() {
     rm -rf ${D}/run ${D}${localstatedir}/run
-
-    # For read-only filesystem, do not create links during bootup
-    if ${@bb.utils.contains('DISTRO_FEATURES','systemd','true','false',d)}; then
-        ln -sf ../run/NetworkManager/resolv.conf ${D}${sysconfdir}/resolv-conf.NetworkManager
-    fi
 }
Signature · 1 line
2.20.0
#1 lore raw
Quoted 14 lines · On 9/1/19 8:59 PM, [email protected] wrote:

From: Kai Kang <[email protected]>

This reverts commit 3982dc5b1994ffcc52336b02fbd2c44db164dd82.

With this commit it creates link file /etc/resolv.conf via update-alternatives but the target doesn't exist.

On target:

root@qemux86-64:~# ls -l /etc/resolv*
lrwxrwxrwx    1 root     root            33 Aug 27 09:17 /etc/resolv-conf.NetworkManager -> ../run/NetworkManager/resolv.conf
lrwxrwxrwx    1 root     root            34 Aug 23 03:08 /etc/resolv-conf.systemd -> ../run/systemd/resolve/resolv.conf
lrwxrwxrwx    1 root     root            31 Aug 27 09:22 /etc/resolv.conf -> /etc/resolv-conf.NetworkManager
Quoted 6 lines
root@qemux86-64:~# ls -l /run/NetworkManager/resolv.conf
ls: /run/NetworkManager/resolv.conf: No such file or directory
root@qemux86-64:~# cat /etc/resolv.conf
cat: can't open '/etc/resolv.conf': No such file or directory

(Apologies for the delay in getting back to this)

Interestingly, in rocko, the /var/run/NetworkManager/resolv.conf file is automatically generated but in thud it does not seem to be.  Without this patch, we are relying on /var/run/systemd/resolv.conf existing even when not using systemd for name resolution. I wonder if the right solution is to figure out why the /var/run/NetworkManager/resolv.conf file is no longer created.

Drew

#2 lore raw
Quoted 21 lines · Drew Moseley
Quoted 14 lines · On 9/1/19 8:59 PM, [email protected] wrote:

From: Kai Kang <[email protected]>

This reverts commit 3982dc5b1994ffcc52336b02fbd2c44db164dd82.

With this commit it creates link file /etc/resolv.conf via update-alternatives but the target doesn't exist.

On target:

root@qemux86-64:~# ls -l /etc/resolv*
lrwxrwxrwx    1 root     root            33 Aug 27 09:17 /etc/resolv-conf.NetworkManager -> ../run/NetworkManager/resolv.conf
lrwxrwxrwx    1 root     root            34 Aug 23 03:08 /etc/resolv-conf.systemd -> ../run/systemd/resolve/resolv.conf
lrwxrwxrwx    1 root     root            31 Aug 27 09:22 /etc/resolv.conf -> /etc/resolv-conf.NetworkManager
Quoted 6 lines
root@qemux86-64:~# ls -l /run/NetworkManager/resolv.conf
ls: /run/NetworkManager/resolv.conf: No such file or directory
root@qemux86-64:~# cat /etc/resolv.conf
cat: can't open '/etc/resolv.conf': No such file or directory
Quoted 9 lines

(Apologies for the delay in getting back to this)

Interestingly, in rocko, the /var/run/NetworkManager/resolv.conf file is automatically generated but in thud it does not seem to be.  Without this patch, we are relying on /var/run/systemd/resolv.conf existing even when not using systemd for name resolution. I wonder if the right solution is to figure out why the /var/run/NetworkManager/resolv.conf file is no longer created.

I dug into this a bit more and I was incorrect about it being different on different branches. It actually seems to be different when using qemu vs hardware (in my case an RpI3).  Basically runqemu sets up kernel-level IP autoconfiguration so NetworkManager has nothing to configure and thus the /var/run/NetworkManager/resolv.conf file is not created.  But on RpI, it is.

In the systemd recipe, there are tmpfiles.d entries setup to ensure that /var/run/systemd/resolve/resolv.conf exists. Should we make sure NetworkManager and connman do something similar? I verified that systemd will properly populate the file even when using kernel level autoconfiguration but initial experiments indicate that NetworkManager does not.

Drew