[systemd-devel] resolved and bind-mount of /etc/resolv.conf
Colin Guthrie
gmane at colin.guthr.ie
Fri Jan 22 01:38:04 PST 2016
Lennart Poettering wrote on 15/01/16 13:36:
> On Fri, 15.01.16 10:33, Igor Bukanov (igor at mir2.org) wrote:
>
>> Hi,
>>
>> currently if one runs systemd-resolved, then /etc/resolv.conf should
>> be symlinked to /run/systemd/resolve/resolv.conf . Is it possible
>> instead to add an option for resolved to bind-mount /etc/resolv.conf
>> into the real file when it starts?
>>
>> This way stopping or disabling resolved will not require to update the
>> symlink and parallel installation of 2 resolvers is possible when the
>> decision to use a particular one can be done at runtime with no
>> changes in /etc.
>
> Well, the logic is really supposed to be: if /etc/resolv.conf is a the
> symlink, then resolved manages the file. If it is anything else, then
> resolved *reads* that file.
>
> Given that I use NetworkManager daily on my laptop, for the WLAN
> stuff, which will manipulate /etc/resolv.conf directly, this behaviour
> is what allows me to use resolved with it.
>
>> 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).
>
> resolved *never* touches /etc/resolv.conf itself. It will update
> /run/systemd/resolve/resolv.conf atomatically however, via renames,
> hence a bind mount of it would not work...
Just to clarify, in this case I'm fairly sure Igor was referring to
/run/systemd/resolve/resolv.conf when he mentioned "updating the file in
place" vs. "rename of temporary file".
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).
Col.
--
Colin Guthrie
gmane(at)colin.guthr.ie
http://colin.guthr.ie/
Day Job:
Tribalogic Limited http://www.tribalogic.net/
Open Source:
Mageia Contributor http://www.mageia.org/
PulseAudio Hacker http://www.pulseaudio.org/
Trac Hacker http://trac.edgewall.org/
More information about the systemd-devel
mailing list