CachyOS / CachyOS/CachyOS-Settings
missing resolv.conf symlink breaks DNS for applications that integrate with systemd-resolved
- Dominant language
- Shell
- Stars
- 443
- Forks
- 76
- PR merge metrics
- No merged PRs in 30d
Description
### Description
I use Mullvad VPN and DNS fails on boot to where it says I have no internet. When I disconnect and reconnect this fixes the issue.
Checking `resolvectl status` shows that it's using `resolv.conf mode: foreign`. Mullvad checks whether `/etc/resolv.conf` is a symlink to a known systemd-resolved stub path before using the D-Bus API. When it's a regular file, the check fails and Mullvad falls back to directly writing `/etc/resolv.conf`, which races with systemd-resolved on boot and causes DNS failures.
```
Can't manage DNS using systemd-resolved: systemd-resolved operation failed
Managing DNS via /etc/resolv.conf
```
Issue #79 enabled `dns=systemd-resolved` in NetworkManager and started `systemd-resolved.service`, but didn't create the resolv.conf symlink. `/etc/resolv.conf` is still the regular file shipped by the `filesystem` package.
Creating the symlink manually fixed it for me:
```
sudo ln -sf /run/systemd/resolve/stub-resolv.conf /etc/resolv.conf
```
After a reboot, `resolvectl status` reports `resolv.conf mode: stub` and Mullvad manages DNS through systemd-resolved without issues:
```
Managing DNS via systemd-resolved
```
Looking at the Arch Wiki, it says this symlink is ["the recommended mode of operation"](https://wiki.archlinux.org/title/Systemd-resolved#DNS) when using systemd-resolved, so it seems like this is the right solution.
### System info
- CachyOS, kernel 6.19.10-1-cachyos
- NetworkManager 1.56
Contributor guide
Assessment
This issue has not been assessed yet.