[Networkmanager] Does /etc/resolv.conf need to link to /var/run/systemd/resolve/stub-resolv.conf?

Thomas Haller thaller at redhat.com
Thu Mar 30 05:50:56 UTC 2023


Hi,

On Thu, Mar 30, 2023 at 3:48 AM Tom Isaacson <tom.isaacson at teknique.com>
wrote:

> 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. I'm not sure where this is coming
> from, possibly after the device boots. Everything seems to work so is
> this ok? Or will NetworkManager get confused by this?
>

NetworkManager never creates /etc/resolv.conf to be a symlink, because a
symlink is taken as administrative action that indicates what the user
wants (and not something that NetworkManager would overwrite). This was
done by somebody else.

NetworkManager can autodetect `dns=systemd-resolved`, based on whether
`/etc/resolv.conf` is a symlink to the well-known resolv.conf files of
systemd-resolved. See `/ETC/RESOLV.CONF` in `man systemd-resolved`. If the
symlink points somewhere else and the autodetection doesn't work, you can
explicitly set `dns=systemd-resolved` in `NetworkManager.conf`.

Basically, read `man NetworkManager.conf` about `dns` and `rc-manager`
settings, and configure whatever works for you best. Usually, the default
settings and autodetection gives the sensible behavior and you don't need
to explicitly set those options -- but you may.

Thomas
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.freedesktop.org/archives/networkmanager/attachments/20230330/6c9a2012/attachment.htm>


More information about the Networkmanager mailing list