[systemd-devel] resolved and bind-mount of /etc/resolv.conf

Igor Bukanov igor at mir2.org
Fri Jan 22 03:19:06 PST 2016


On 22 January 2016 at 10:38, Colin Guthrie <gmane at colin.guthr.ie> wrote:
...
>> On Fri, 15.01.16 10:33, Igor Bukanov (igor at mir2.org) wrote:
>>> I suppose I already can do with service ExecStartPost, ExecStart hooks
>>> for resolved, but this is rather hackish as I do not know if resolved
>>> updates the file in place (which is compatible with bind-mount) or via
>>> rename of a temporary (which is not).

> He said he could do bind mounting of /etc/resolv.conf as a file via
> ExecStartPost but it would only work if the file he bind mounted to was
> update in place (i.e. /run/systemd/resolve/resolv.conf).

Note that I wrote "hackish" because it is possible to bind-mount even
with resolved even with systemd-resolved doinfg updates via renames of
a temporary file. The trick is to symlink /etc/resolv.conf into, say,
/etc/my-resolv/resolv.conf and then bind-mount /run/systemd/resolve
into /etc/my-resolv.

But there is still a problem with that. As Lennart pointed out
systemd-resolved parses /etc/resolv.conf as long as it is not a
symlink to /run/systemd/resolve/resolv.conf. So with bind-mount it
will parse the file it generates. I suppose I can disable this parsing
via DNS option for resolved.conf, but that require to write something
there which would have consequences. That is, there is no option just
to disable any /etc/resolv.conf processing without effecting anything
else.


More information about the systemd-devel mailing list