Re: Writing resolv.conf issues with broken symlink

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
an ARM embedded device.  Buildroot has the /etc/resolv.conf file
as a
symlink that points to /tmp/resolv.conf.  When I use
with this resolv.conf symlink configuration, DNS lookups do no
because NetworkManger is not writing to the resolv.conf file or
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
follow the symlink and write the contents of the resolv.conf
Unfortunately this does not work when the destination file the
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
on each boot to help support  a read-only root file system or
minimal writes to the root file system.

Is there a specific reason NetworkManager doesn't create the file
/etc/resolv.conf symlink points to if it doesn't exist?  If there
isn't a reason, could NetworkManager be updated to create the
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
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.



with "file" mode, NetworkManager should follow the symlink and
write the
file (if it doesn't exist). It wouldn't create the necessary parent
but since you have /tmp/resolv.conf, this shouldn't apply.

Odd, if that doesn't work. Would need some investigation. Does the
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            : 
daemon.debug NetworkManager[311]: <trace> [1527801020.0115] dns-mgr:
update-resolv-conf: write to /etc/resolv.conf succeeded (rc-
daemon.debug NetworkManager[311]: <trace> [1527801020.0126] dns-mgr:
update-resolv-conf: write internal file /etc/resolv.conf succeeded
daemon.debug NetworkManager[311]: <trace> [1527801020.0135] dns-mgr:
current configuration: [{'nameservers': <['',
'', '']>, '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

Attachment: signature.asc
Description: This is a digitally signed message part

[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]