RE: Writing resolv.conf issues with broken symlink

-----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?


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        
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': 
<['', '', '']>, '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]