Bug 1541031

Summary: NM overwrites resolv.conf when it goes down
Product: Red Hat Enterprise Linux 7 Reporter: Vladimir Benes <vbenes>
Component: NetworkManagerAssignee: Beniamino Galvani <bgalvani>
Status: CLOSED ERRATA QA Contact: Desktop QE <desktop-qa-list>
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: 7.5CC: atragler, bgalvani, fgiudici, fpokryvk, lrintel, mabrown, rkhan, sukulkar, thaller, vkavtikw
Target Milestone: rc   
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: NetworkManager-1.12.0-0.1.el7 Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2018-10-30 11:11:02 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Attachments:
Description Flags
[PATCH] dns: on quit only update resolv.conf if dns=dnsmasq none

Description Vladimir Benes 2018-02-01 14:52:28 UTC
Description of problem:
I have running NM.

I created 00-resolv.conf as follows:

$ cat /etc/NetworkManager/conf.d/00-resolv.conf
[main]
rc-manager=unmanaged

altered /etc/resolv.conf to contain
nameserver 192.168.100.1

and I rebooted thinking that everything will be correctly set on many boxes, so I can update them, etc

but what I see in /etc/resolv.conf?
# Generated by NetworkManager

and that's it. So resolv.conf was overwritten in the meantime. Is this expected? If I call systemctl reload NetworkManager before reboot then everything works well. Do we really want to clean the resolv.conf file when NM goes down? 

Version-Release number of selected component (if applicable):
NetworkManager-1.10.2-9.el7.x86_64

Comment 3 Thomas Haller 2018-02-06 12:58:39 UTC
If you edit NetworkManager.conf files, without reloading the configuration (SIGHUP or via D-Bus), then the changes that you made on disk have no effect until you restart NetworkManager.

Yes, this works as expected. We don't automatically reload configuration (for good reasons), so it's up to the user to do that.


I'd close as NOTABUG.


Regardless of that, I wonder if it ever makes sense to write an empty resolv.conf file. Maybe, if we have no name servers to configure, we should leave whatever currently is in resolv.conf file. However, that would mean, that you cannot un-configure all DNS servers if you wanted to. That doesn't seem right either. Beniamino, what do you think?

Comment 4 Beniamino Galvani 2018-02-08 17:21:43 UTC
Created attachment 1393270 [details]
[PATCH] dns: on quit only update resolv.conf if dns=dnsmasq

Comment 5 Beniamino Galvani 2018-02-08 17:24:09 UTC
(In reply to Thomas Haller from comment #3)
> If you edit NetworkManager.conf files, without reloading the configuration
> (SIGHUP or via D-Bus), then the changes that you made on disk have no effect
> until you restart NetworkManager.
> 
> Yes, this works as expected. We don't automatically reload configuration
> (for good reasons), so it's up to the user to do that.
> 
> 
> I'd close as NOTABUG.
> 
> 
> Regardless of that, I wonder if it ever makes sense to write an empty
> resolv.conf file. Maybe, if we have no name servers to configure, we should
> leave whatever currently is in resolv.conf file. However, that would mean,
> that you cannot un-configure all DNS servers if you wanted to. That doesn't
> seem right either. Beniamino, what do you think?

In my opinion, the problem is that we shouldn't update resolv.conf without reason when quitting. The patch above should fix that.

Comment 6 Thomas Haller 2018-02-08 20:46:16 UTC
(In reply to Beniamino Galvani from comment #4)
> Created attachment 1393270 [details]
> [PATCH] dns: on quit only update resolv.conf if dns=dnsmasq

lgtm

Comment 8 Thomas Haller 2018-04-13 11:56:36 UTC
*** Bug 1566656 has been marked as a duplicate of this bug. ***

Comment 11 Thomas Haller 2018-07-17 11:45:54 UTC
*** Bug 1592102 has been marked as a duplicate of this bug. ***

Comment 13 errata-xmlrpc 2018-10-30 11:11:02 UTC
Since the problem described in this bug report should be
resolved in a recent advisory, it has been closed with a
resolution of ERRATA.

For information on the advisory, and where to find the updated
files, follow the link below.

If the solution does not work for you, open a new bug report.

https://access.redhat.com/errata/RHBA-2018:3207