Networkmanager still overwrites /etc/resolv.conf

Hi,

I am trying to get dns with tailscale running with the following howto:

That means, symlink /etc/resolv.conf to systemd-resolve with:

$ sudo ln -sf /run/systemd/resolve/stub-resolv.conf /etc/resolv.conf

and then restart everything:

$ sudo systemctl restart systemd-resolved
$ sudo systemctl restart NetworkManager
$ sudo systemctl restart tailscaled

But after restarting NetworkManager it overwrites my resolv.conf symlink. As per documentation that should not be the case.

There must be something what I am doing wrong…?

Any ideas?

did you sync the package systemd-resolvconf ?

did you remove package openresolv ?

NM will only do the test if the dns option is not set in the config. If your NM config contains the dns option it will use this option and do not the softlink test for /etc/resolv.conf.
So either remove the dns option or even better set the dns keyword to systemd-resolved

This is interesting. /etc/NetworkManager/NetworkManager.conf is nearly empty (only 2 comments). I have now added:

[main]
dns=systemd-resolved

and now it seems to work. But it should have worked without the entry above, right?

No, I didnt do anything of these 2 tasks.

Manjaro default to use openresolv and the guide you are reading is for systems using systemd-resolved - hence your problem.

If you don’t remove openresolv it will cause problems with systemd-resolved.

And then you wouldn’t need the above entries in your NetworkManager.conf

I would prefer to stick to manjaro standard and not using systemd-resolvd. But when I am looking at the logging (tailscale), it says it is using direct mode (nss), whatever that means:

Mär 27 14:33:56 thinkpad-t480 tailscaled[7951]: dns: [rc=nm resolved=nss nm-resolved=yes nm-resolved=no ret=direct]
Mär 27 14:33:56 thinkpad-t480 tailscaled[7951]: dns: using "direct" mode
Mär 27 14:33:56 thinkpad-t480 tailscaled[7951]: dns: using *dns.directManager
Mär 27 14:33:56 thinkpad-t480 tailscaled[7951]: link state: interfaces.State{defaultRoute=wlp3s0 ifs={wlp3s0:[192.168.227.46/24 2a01:599:407:331:8a03:e8af:cff5:bb42/64 llu6]} v4=true v6=t>
Mär 27 14:33:56 thinkpad-t480 tailscaled[7951]: onPortUpdate(port=41641, network=udp6)

It looks like tailscale has some problems with openresolv+NetworkManager combination.