Bug 1541031 - NM overwrites resolv.conf when it goes down
Summary: NM overwrites resolv.conf when it goes down
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Red Hat Enterprise Linux 7
Classification: Red Hat
Component: NetworkManager
Version: 7.5
Hardware: Unspecified
OS: Unspecified
unspecified
unspecified
Target Milestone: rc
: ---
Assignee: Beniamino Galvani
QA Contact: Desktop QE
URL:
Whiteboard:
: 1566656 1592102 (view as bug list)
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2018-02-01 14:52 UTC by Vladimir Benes
Modified: 2018-10-30 11:12 UTC (History)
10 users (show)

Fixed In Version: NetworkManager-1.12.0-0.1.el7
Doc Type: If docs needed, set a value
Doc Text:
Clone Of:
Environment:
Last Closed: 2018-10-30 11:11:02 UTC
Target Upstream Version:


Attachments (Terms of Use)
[PATCH] dns: on quit only update resolv.conf if dns=dnsmasq (1.63 KB, patch)
2018-02-08 17:21 UTC, Beniamino Galvani
no flags Details | Diff


Links
System ID Private Priority Status Summary Last Updated
Red Hat Product Errata RHBA-2018:3207 0 None None None 2018-10-30 11:12:20 UTC

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


Note You need to log in before you can comment on or make changes to this bug.