RE: Writing resolv.conf issues with broken symlink
- From: Matthew Starr <mstarr hedonline com>
- To: Thomas Haller <thaller redhat com>, "networkmanager-list gnome org" <networkmanager-list gnome org>
- Subject: RE: Writing resolv.conf issues with broken symlink
- Date: Fri, 1 Jun 2018 14:16:38 +0000
-----Original Message-----
From: Thomas Haller [mailto:thaller redhat com]
Sent: Friday, June 01, 2018 1:14 AM
On Thu, 2018-05-31 at 21:18 +0000, Matthew Starr wrote:
-----Original Message-----
From: Thomas Haller [mailto:thaller redhat com]
Sent: Thursday, May 31, 2018 3:35 PM
On Thu, 2018-05-31 at 19:02 +0000, Matthew Starr wrote:
I am building NetworkManager 1.8.0 using buildroot with SysV init
on an ARM embedded device. Buildroot has the /etc/resolv.conf
file as a symlink that points to /tmp/resolv.conf. When I use
NetworkManager with this resolv.conf symlink configuration, DNS
lookups do no work because NetworkManger is not writing to the
resolv.conf file or the file pointed to by the symlink.
I tried updating the NetworkManager.conf file to include "rc-
manager=file" since the man page states that NetworkManager will
then follow the symlink and write the contents of the resolv.conf
there.
Unfortunately this does not work when the destination file the
symlink points to does not exist. In this situation the symlink
points to a file in /tmp which is a tmpfs file system (RAM based)
and wiped clean on each boot to help support a read-only root
file system or doing minimal writes to the root file system.
Is there a specific reason NetworkManager doesn't create the file
the /etc/resolv.conf symlink points to if it doesn't exist? If
there isn't a reason, could NetworkManager be updated to create
the file pointed to by the /etc/resolv.conf symlink?
What you say, makes sense.
I also thought it should be like that, and the man page explains it that way
(well, I was involved writing the manual page with this understanding).
https://cgit.freedesktop.org/NetworkManager/NetworkManager/tree/src/
dns/nm-dns-manager.c?id=nm-1-8#n737
Seems `realpath` only returns the destination file, if the path actually exists...
I think this behavior is a bug, maybe it should be fixed, but it's a bit
problematic to change at this point... I will follow up.
In the meantime, can you not just symlink /etc/resolv.conf to
/var/run/NetworkManager/resolv.conf ?
That anyway seems the better solution to me.
Thank you for making this change.
As a work around I am just running "touch /tmp/resolv.conf" early in the init process before NetworkManager
is launched. I was not aware of the /var/run/NetworkManager/resolv.conf file at the time I did my
workaround, but it is good to know it is there as a backup.
Best regards,
Matthew Starr
Hi,
with "file" mode, NetworkManager should follow the symlink and write
the file (if it doesn't exist). It wouldn't create the necessary
parent directories, but since you have /tmp/resolv.conf, this
shouldn't apply.
Odd, if that doesn't work. Would need some investigation. Does the
logfile say anything with level=TRACE?
You could also have /etc/resolv.conf as symlink to
/var/run/NetworkManager/resolv.conf and leave "symlink" setting.
I actually had that wrong in the original email. What I was seeing
where it wouldn't write the /etc/resolv.conf file was with the
"symlink" setting. I see that this is the expected action when
/etc/resolv.conf is a symlink.
The issue I am seeing with the "file" setting is that instead of
following the broken symlink at /etc/resolv.conf and writing the file
at where the symlink is pointing (/tmp/resolv.conf), Network Manager
is deleting the symlink and writing a new /etc/resolv.conf regular
file. Wouldn't it make more sense. Based on what the man page
states, I was expecting NetworkManager to follow the symlink and make
a new file there. The man page says "NetworkManager will write
/etc/resolv.conf as file. If it finds a symlink, it will follow the
symlink and update the target instead."
In case it helps, here are some of the dns trace messages when
NetworkManager was updating the DNS:
daemon.debug NetworkManager[311]: <debug> [1527801019.9945] dns-
mgr:
update-dns: updating resolv.conf
daemon.debug NetworkManager[311]: <trace> [1527801019.9948] dns-
mgr:
config: 100 best v4 mlan0 : 208.67.222.222
208.67.222.220 4.2.2.2
daemon.debug NetworkManager[311]: <trace> [1527801020.0115] dns-
mgr:
update-resolv-conf: write to /etc/resolv.conf succeeded (rc-
manager=file)
daemon.debug NetworkManager[311]: <trace> [1527801020.0126] dns-
mgr:
update-resolv-conf: write internal file /etc/resolv.conf succeeded
(rc-manager=file)
daemon.debug NetworkManager[311]: <trace> [1527801020.0135] dns-
mgr:
current configuration: [{'nameservers': <['208.67.222.222',
'208.67.222.220', '4.2.2.2']>, 'interface': <'mlan0'>, 'priority':
<100>, 'vpn': <false>}]
daemon.debug NetworkManager[311]: <debug> [1527801020.0632] dns-
mgr:
(device_ip4_config_changed): queueing DNS updates (1)
Best regards,
Matthew Starr
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]