The NM resolv.conf problem was solved by the following commit. You can cherry 
pick that.
"""
commit a8ebf23dde9c82dd9d1dcd0fa6de0b4467a0112b
Author: Chen Qi <[email protected]>
Date:   Tue Dec 20 02:01:38 2022 -0800

    networkmanager: fix /etc/resolv.conf handling
"""

It really does not matter what the resolv.conf mode is in your case because 
what NM does is just to send DNS info to resolved.

But if you really want to use the stub mode, a modification to the systemd 
recipe is needed to support it, maybe via PACKAGECONFIG. However, I don't think 
this is necessary for you unless you happen to make use of some features that 
the stub mode provides, which is unrelated to NM.

Regards,
Qi

-----Original Message-----
From: [email protected] <[email protected]> On Behalf Of 
Tom Isaacson
Sent: Monday, April 3, 2023 5:26 AM
To: [email protected]
Subject: [yocto] How do I symbolically link /etc/resolv.conf to 
/var/run/systemd/resolve/stub-resolv.conf?

I'm trying to setup a Yocto build using NetworkManager v1.22.16 and systemd 
244.5. 
https://www.freedesktop.org/software/systemd/man/systemd-resolved.service.html#/etc/resolv.conf
recommends I setup /etc/resolv.conf as a symbolic link to 
/var/run/systemd/resolve/stub-resolv.conf. Initially it was linked to 
/etc/resolv-conf.NetworkManager but I've fixed that by adding a 
networkmanager_%.bbappend file with:

    ALTERNATIVE_${PN} = ""

But now I find /etc/resolv.conf is a symbolic link to /etc/resolv-conf.systemd, 
which is itself a symbolic link to /run/systemd/resolve/resolv.conf. This seems 
to come from
systemd_244.5.bb:
http://cgit.openembedded.org/openembedded-core/tree/meta/recipes-core/systemd/systemd_244.5.bb?h=dunfell#n289

    if ! ${@bb.utils.contains('PACKAGECONFIG', 'resolved', 'true', 'false', 
d)}; then
        echo 'L! ${sysconfdir}/resolv.conf - - - - 
../run/systemd/resolve/resolv.conf'
>>${D}${exec_prefix}/lib/tmpfiles.d/etc.conf
        echo 'd /run/systemd/resolve 0755 root root -'
>>${D}${exec_prefix}/lib/tmpfiles.d/systemd.conf
        echo 'f /run/systemd/resolve/resolv.conf 0644 root root'
>>${D}${exec_prefix}/lib/tmpfiles.d/systemd.conf
        ln -s ../run/systemd/resolve/resolv.conf
${D}${sysconfdir}/resolv-conf.systemd
    else
        sed -i -e "s%^L! /etc/resolv.conf.*$%L! /etc/resolv.conf - - -
- ../run/systemd/resolve/resolv.conf%g"
${D}${exec_prefix}/lib/tmpfiles.d/etc.conf
        ln -s ../run/systemd/resolve/resolv.conf
${D}${sysconfdir}/resolv-conf.systemd
    fi

But there doesn't seem to be any support for making /etc/resolv.conf a symbolic 
link to /var/run/systemd/resolve/stub-resolv.conf. Is there any way of doing 
this that I'm missing or is this functionality just missing?

(Apologies if this is the wrong forum for this, I'm relatively new to Yocto and 
systemd).

Thanks.

--
Tom Isaacson
-=-=-=-=-=-=-=-=-=-=-=-
Links: You receive all messages sent to this group.
View/Reply Online (#59592): https://lists.yoctoproject.org/g/yocto/message/59592
Mute This Topic: https://lists.yoctoproject.org/mt/98022296/21656
Group Owner: [email protected]
Unsubscribe: https://lists.yoctoproject.org/g/yocto/unsub 
[[email protected]]
-=-=-=-=-=-=-=-=-=-=-=-

Reply via email to