You are not logged in.

#1 2017-05-02 10:30:54

sredna
Member
Registered: 2008-11-29
Posts: 50

Resolv.conf overwritten by rubbish

Hi,

Since some time, I have had problems with resolv.conf. Nameservers from dhcp is not present in the file. I use NetworkManager and the setup is pretty standard.

[anders@archie ~]$ cat /etc/NetworkManager/NetworkManager.conf
# Configuration file for NetworkManager.
# See "man 5 NetworkManager.conf" for details.
dhcp=dhclient
dns=default
# Configuration for resolvconf(8)
# See resolvconf.conf(5) for details

resolv_conf=/etc/resolv.conf
# Anders: append google nameserver, workaround brokenness.
name_servers_append=8.8.8.8

# If you run a local name server, you should uncomment the below line and
# configure your subscribers configuration files below.
#name_servers=127.0.0.1

If I restart NetworkManager I initially get this (before the network connection is finished):

# Generated by resolvconf
domain bbsyd.net
nameserver 212.10.10.4
nameserver 212.10.10.5
nameserver 8.8.8.8

But after the connection is finished, it is rewritten to this:

[anders@archie ~]$ cat /etc/resolv.conf
# Generated by resolvconf
domain bbsyd.net
search bbsyd.net uvnet.itcfyn.adm
nameserver 127.0.0.1

So first, resolvconf writes the file as expected, but then later something (NetworkManager?) overwrites it.
Any hints on why this happens, and how to prevent it?

Offline

#2 2017-05-02 12:32:13

mrunion
Member
From: Jonesborough, TN
Registered: 2007-01-26
Posts: 1,938
Website

Re: Resolv.conf overwritten by rubbish

Show us a list all the services you have running.


Matt

"It is very difficult to educate the educated."

Offline

#3 2017-05-02 13:57:28

sredna
Member
Registered: 2008-11-29
Posts: 50

Re: Resolv.conf overwritten by rubbish

Hi mrunion, thanks for answering. I hope this is sufficient. My eyes fell on pdnsd, which I have now stopped, disabled and removed.

[anders@archie ~]$ systemctl -t service -a list-units
  UNIT                                                  LOAD      ACTIVE   SUB     DESCRIPTION                                                       
  alsa-restore.service                                  loaded    active   exited  Save/Restore Sound Card State                                     
  alsa-state.service                                    loaded    inactive dead    Manage Sound Card State (restore and store)                       
● auditd.service                                        not-found inactive dead    auditd.service                                                   
  bluetooth.service                                     loaded    active   running Bluetooth service                                                 
  dbus.service                                          loaded    active   running D-Bus System Message Bus                                         
  dm-event.service                                      loaded    inactive dead    Device-mapper event daemon                                       
  emergency.service                                     loaded    inactive dead    Emergency Shell                                                   
  getty@tty1.service                                    loaded    inactive dead    Getty on tty1                                                     
  getty@tty2.service                                    loaded    active   running Getty on tty2                                                     
  getty@tty3.service                                    loaded    active   running Getty on tty3                                                     
  kmod-static-nodes.service                             loaded    active   exited  Create list of required static device nodes for the current kernel
  ldconfig.service                                      loaded    inactive dead    Rebuild Dynamic Linker Cache                                     
  logrotate.service                                     loaded    inactive dead    Rotate log files                                                 
  lvm2-lvmetad.service                                  loaded    inactive dead    LVM2 metadata daemon                                             
  man-db.service                                        loaded    inactive dead    Update man-db cache                                               
  mkinitcpio-generate-shutdown-ramfs.service            loaded    inactive dead    Generate shutdown-ramfs                                           
● NetworkManager-wait-online.service                    loaded    failed   failed  Network Manager Wait Online                                       
  NetworkManager.service                                loaded    active   running Network Manager                                                   
● pdnsd.service                                         loaded    failed   failed  proxy name server                                                 
● plymouth-quit-wait.service                            not-found inactive dead    plymouth-quit-wait.service                                       
● plymouth-quit.service                                 not-found inactive dead    plymouth-quit.service                                             
● plymouth-start.service                                not-found inactive dead    plymouth-start.service                                           
  polkit.service                                        loaded    active   running Authorization Manager                                             
  rescue.service                                        loaded    inactive dead    Rescue Shell                                                     
  rtkit-daemon.service                                  loaded    active   running RealtimeKit Scheduling Policy Service                             
  sddm.service                                          loaded    active   running Simple Desktop Display Manager                                   
  shadow.service                                        loaded    inactive dead    Verify integrity of password and group files                     
● syslog.service                                        not-found inactive dead    syslog.service                                                   
  systemd-ask-password-console.service                  loaded    inactive dead    Dispatch Password Requests to Console                             
  systemd-ask-password-wall.service                     loaded    inactive dead    Forward Password Requests to Wall                                 
  systemd-backlight@backlight:intel_backlight.service   loaded    active   exited  Load/Save Screen Backlight Brightness of backlight:intel_backlight
  systemd-binfmt.service                                loaded    inactive dead    Set Up Additional Binary Formats                                 
  systemd-firstboot.service                             loaded    inactive dead    First Boot Wizard                                                 
  systemd-fsck-root.service                             loaded    inactive dead    File System Check on Root Device                                 
  systemd-fsck@dev-disk-by\x2duuid-07DE\x2d36F2.service loaded    active   exited  File System Check on /dev/disk/by-uuid/07DE-36F2                 
  systemd-hwdb-update.service                           loaded    inactive dead    Rebuild Hardware Database                                         
  systemd-initctl.service                               loaded    inactive dead    /dev/initctl Compatibility Daemon                                 
  systemd-journal-catalog-update.service                loaded    inactive dead    Rebuild Journal Catalog                                           
  systemd-journal-flush.service                         loaded    active   exited  Flush Journal to Persistent Storage                               
  systemd-journald.service                              loaded    active   running Journal Service                                                   
  systemd-logind.service                                loaded    active   running Login Service                                                     
  systemd-machine-id-commit.service                     loaded    inactive dead    Commit a transient machine-id on disk                             
  systemd-modules-load.service                          loaded    active   exited  Load Kernel Modules                                               
  systemd-quotacheck.service                            loaded    inactive dead    File System Quota Check                                           
  systemd-random-seed.service                           loaded    active   exited  Load/Save Random Seed                                             
  systemd-remount-fs.service                            loaded    active   exited  Remount Root and Kernel File Systems                             
  systemd-rfkill.service                                loaded    inactive dead    Load/Save RF Kill Switch Status                                   
  systemd-sysctl.service                                loaded    active   exited  Apply Kernel Variables                                           
  systemd-sysusers.service                              loaded    inactive dead    Create System Users                                               
  systemd-timesyncd.service                             loaded    active   running Network Time Synchronization                                     
  systemd-tmpfiles-clean.service                        loaded    inactive dead    Cleanup of Temporary Directories                                 
  systemd-tmpfiles-setup-dev.service                    loaded    active   exited  Create Static Device Nodes in /dev                               
  systemd-tmpfiles-setup.service                        loaded    active   exited  Create Volatile Files and Directories                             
  systemd-udev-trigger.service                          loaded    active   exited  udev Coldplug all Devices                                         
  systemd-udevd.service                                 loaded    active   running udev Kernel Device Manager                                       
  systemd-update-done.service                           loaded    inactive dead    Update is Completed                                               
  UNIT                                                  LOAD      ACTIVE   SUB     DESCRIPTION                                                       
  alsa-restore.service                                  loaded    active   exited  Save/Restore Sound Card State                                     
  alsa-state.service                                    loaded    inactive dead    Manage Sound Card State (restore and store)                       
● auditd.service                                        not-found inactive dead    auditd.service                                                   
  bluetooth.service                                     loaded    active   running Bluetooth service                                                 
  dbus.service                                          loaded    active   running D-Bus System Message Bus                                         
  dm-event.service                                      loaded    inactive dead    Device-mapper event daemon                                       
  emergency.service                                     loaded    inactive dead    Emergency Shell                                                   
  getty@tty1.service                                    loaded    inactive dead    Getty on tty1                                                     
  getty@tty2.service                                    loaded    active   running Getty on tty2                                                     
  getty@tty3.service                                    loaded    active   running Getty on tty3                                                     
  kmod-static-nodes.service                             loaded    active   exited  Create list of required static device nodes for the current kernel
  ldconfig.service                                      loaded    inactive dead    Rebuild Dynamic Linker Cache                                     
  logrotate.service                                     loaded    inactive dead    Rotate log files                                                 
  lvm2-lvmetad.service                                  loaded    inactive dead    LVM2 metadata daemon

Offline

#4 2017-05-02 15:03:53

Ropid
Member
Registered: 2015-03-09
Posts: 1,069

Re: Resolv.conf overwritten by rubbish

You can take a look at what NetworkManager etc. sent to resolvconf like this:

resolvconf -l

What do you see when you take a look at that before and after NetworkManager does its thing?

Offline

#5 2017-05-02 15:43:34

sredna
Member
Registered: 2008-11-29
Posts: 50

Re: Resolv.conf overwritten by rubbish

Here is a sequence:

[anders@archie ~]$ sudo systemctl restart NetworkManager
[sudo] adgangskode for anders: 
[anders@archie ~]$ resolvconf -l                        
# resolv.conf from wlp2s0.dhcp
# Generated by dhcpcd from wlp2s0.dhcp
domain bbsyd.net
search bbsyd.net
nameserver 212.10.10.4
nameserver 212.10.10.5

[anders@archie ~]$ resolvconf -l
# resolv.conf from wlp2s0.dhcp
# Generated by dhcpcd from wlp2s0.dhcp
domain bbsyd.net
search bbsyd.net
nameserver 212.10.10.4
nameserver 212.10.10.5

# resolv.conf from NetworkManager
# Generated by NetworkManager
search bbsyd.net
nameserver 127.0.0.1
nameserver 212.10.10.4
nameserver 212.10.10.5

[anders@archie ~]$ cat /etc/resolv.conf
# Generated by resolvconf
domain bbsyd.net
nameserver 127.0.0.1
[anders@archie ~]$ 

Looks weird, as the actual content is not equal to the output of resolvconf -l.

Last edited by sredna (2017-05-02 15:44:06)

Offline

#6 2017-05-02 16:45:09

Ropid
Member
Registered: 2015-03-09
Posts: 1,069

Re: Resolv.conf overwritten by rubbish

Yes, and it also ignores your "name_server_append=8.8.8.8" in the config. It's perhaps some program editing the /etc/resolv.conf file directly without going through resolvconf?

Offline

#7 2017-05-02 16:47:41

sredna
Member
Registered: 2008-11-29
Posts: 50

Re: Resolv.conf overwritten by rubbish

Yes, but what could it be??? That is the question smile

Offline

#8 2017-05-02 17:44:59

Ropid
Member
Registered: 2015-03-09
Posts: 1,069

Re: Resolv.conf overwritten by rubbish

I found a package "fatrace" in the AUR that can record file accesses of all running processes on the machine and works with the normal Arch kernel. It records everything and can't watch just a certain file, but you can filter with grep, so you could use it like this to track resolv.conf while you restart NetworkManager:

sudo fatrace | grep /etc/resolv\.conf

Offline

#9 2017-05-02 17:48:57

sredna
Member
Registered: 2008-11-29
Posts: 50

Re: Resolv.conf overwritten by rubbish

I ended up uninstalling openresolv (which provides resolvconf), since it is not required, and now I get a working resolv.conf:

[root@archie ~]# cat /etc/resolv.conf
# Generated by NetworkManager
search bbsyd.net
nameserver 127.0.0.1
nameserver 212.10.10.4
nameserver 212.10.10.5
[root@archie ~]# 

I still do not understand why the nameservers were removed.

Offline

#10 2017-05-03 09:34:01

rsmarples
Member
Registered: 2009-05-12
Posts: 287

Re: Resolv.conf overwritten by rubbish

sredna wrote:

Here is a sequence:

[anders@archie ~]$ sudo systemctl restart NetworkManager
[sudo] adgangskode for anders: 
[anders@archie ~]$ resolvconf -l                        
# resolv.conf from wlp2s0.dhcp
# Generated by dhcpcd from wlp2s0.dhcp
domain bbsyd.net
search bbsyd.net
nameserver 212.10.10.4
nameserver 212.10.10.5

[anders@archie ~]$ resolvconf -l
# resolv.conf from wlp2s0.dhcp
# Generated by dhcpcd from wlp2s0.dhcp
domain bbsyd.net
search bbsyd.net
nameserver 212.10.10.4
nameserver 212.10.10.5

# resolv.conf from NetworkManager
# Generated by NetworkManager
search bbsyd.net
nameserver 127.0.0.1
nameserver 212.10.10.4
nameserver 212.10.10.5

[anders@archie ~]$ cat /etc/resolv.conf
# Generated by resolvconf
domain bbsyd.net
nameserver 127.0.0.1
[anders@archie ~]$ 

Looks weird, as the actual content is not equal to the output of resolvconf -l.


Here's the key part

# resolv.conf from NetworkManager
# Generated by NetworkManager
search bbsyd.net
nameserver 127.0.0.1
nameserver 212.10.10.4
nameserver 212.10.10.5

So NetworkManager inserted a local nameserver.
Because of this, resolvconf will just list that in /etc/resolv.conf - the expectation is that this local name server will then have the rest of the DNS setup. But this requries exta config in resolvconf.conf, because it does not know what local resolver is in use or where it should store it's config files.
Luckily, you can configure openresolv to ignore this in resolvconf.conf like so

replace="nameserver/127.0.0.1/"

That will make the applied NetworkManager config look like this

# resolv.conf from NetworkManager
# Generated by NetworkManager
search bbsyd.net
nameserver 212.10.10.4
nameserver 212.10.10.5

Exactly the same, but the local name server removed.

Last edited by rsmarples (2017-05-03 09:35:12)

Offline

#11 2017-05-03 16:08:44

sredna
Member
Registered: 2008-11-29
Posts: 50

Re: Resolv.conf overwritten by rubbish

Thanks, but I did not find that in the manuals. Nor do I understand why NetworkManager adds a local nameserver - I did not knowingly ask it to, and no local nameserver is running. I can't figure out why. I did at one time experiment with running pdnsd, but that was a long time ago, som somewhere, NetworkManager is getting things wrong, even if it is just failing to document how to configure it properly.

Offline

#12 2017-05-03 16:44:16

rsmarples
Member
Registered: 2009-05-12
Posts: 287

Re: Resolv.conf overwritten by rubbish

The replace option is specified in resolvconf.conf(5).

Offline

Board footer

Powered by FluxBB