Bugzilla will be upgraded to version 5.0 on a still to be determined date in the near future. The original upgrade date has been delayed.
Bug 1364895 - Updating /etc/resolv.conf failed sometimes
Updating /etc/resolv.conf failed sometimes
Status: CLOSED ERRATA
Product: Red Hat Enterprise Linux 7
Classification: Red Hat
Component: initscripts (Show other bugs)
7.1
Unspecified Unspecified
medium Severity medium
: rc
: ---
Assigned To: David Kaspar [Dee'Kej]
Daniel Rusek
Filip Hanzelka
: Reopened
Depends On:
Blocks: 1203710 1298243 1380361 1393867 1400961 1420851 1465901 1466365 1357658
  Show dependency treegraph
 
Reported: 2016-08-08 02:50 EDT by Akhil John
Modified: 2018-04-10 14:26 EDT (History)
5 users (show)

See Also:
Fixed In Version: initscripts-9.49.40-2.el7
Doc Type: Release Note
Doc Text:
Network scripts now correctly update `/etc/resolv.conf` Network scripts have been enhanced to update the `/etc/resolv.conf` file correctly. Notably: * The scripts now update the `nameserver` and `search` entries in the `/etc/resolv.conf` file after the "DNS*" and "DOMAIN" options, respectively, have been updated in the `ifcfg-*` files in the `/etc/sysconfig/network-scripts/` directory * The scripts now also update the order of `nameserver` entries after it has been updated in the `ifcfg-*` files in `/etc/sysconfig/network-scripts/` * Support for the "DNS3" option has been added * The scripts now correctly process duplicate and randomly omitted "DNS*" options
Story Points: ---
Clone Of:
Environment:
Last Closed: 2018-04-10 14:24:45 EDT
Type: Bug
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---


Attachments (Terms of Use)


External Trackers
Tracker ID Priority Status Summary Last Updated
Red Hat Product Errata RHBA-2018:0983 None None None 2018-04-10 14:26 EDT

  None (edit)
Description Akhil John 2016-08-08 02:50:43 EDT
Description of problem:
Updating the DNS configuration in /etc/sysconfig/network-scripts/ifcfg-eth0 does not always trigger an update of /etc/resolv.conf if the system has booted.



Version-Release number of selected component (if applicable):
RHEL7 server without the NetworkManager packages
# uname -a
Linux f1moon1 3.10.0-229.4.2.el7.x86_64 #1 SMP Fri Apr 24 15:26:38 EDT 2015 x86_64 x86_64 x86_64 GNU/Linux

# rpm -qa | egrep -i 'initscr|network'
dracut-network-033-241.el7_1.1.x86_64
initscripts-9.49.24-1.el7.x86_64



Steps to Reproduce:
1) Setup a RHEL7 server without the NetworkManager packages
-----------------------------------------------------------
# uname -a
Linux f1moon1 3.10.0-229.4.2.el7.x86_64 #1 SMP Fri Apr 24 15:26:38 EDT 2015 x86_64 x86_64 x86_64 GNU/Linux

# rpm -qa | egrep -i 'initscr|network'
dracut-network-033-241.el7_1.1.x86_64
initscripts-9.49.24-1.el7.x86_64

# cat /etc/resolv.conf
# Generated by NetworkManager
nameserver 192.168.3.6
nameserver 192.168.13.6
search example.com

# cat /etc/sysconfig/network-scripts/ifcfg-eth0
# Generated by dracut initrd
NAME="eth0"
HWADDR="00:50:56:a2:5e:31"
ONBOOT=yes
NETBOOT=yes
UUID="7d677073-5b05-44ea-b09d-8ec823f42cdf"
BOOTPROTO=none
IPADDR="192.168.1.29"
NETMASK="255.255.255.0"
GATEWAY="192.168.1.254"
TYPE=Ethernet
DNS1="192.168.3.6"
DNS2="192.168.13.6"
DOMAIN=example.com

2) Remove /etc/resolv.conf.save
-------------------------------
# ll /etc/resolv.c*
-rw-r--r-- 1 root root 97 Aug  5 09:43 /etc/resolv.conf

3) Update the DNS2 in ifcfg-eth0
--------------------------------
# grep DNS /etc/sysconfig/network-scripts/ifcfg-eth0
DNS1="192.168.3.6"
DNS2="192.168.13.6"

# vi /etc/sysconfig/network-scripts/ifcfg-eth0

# grep DNS /etc/sysconfig/network-scripts/ifcfg-eth0
DNS1="192.168.3.6"
DNS2="192.168.16.6"

# cat /etc/resolv.conf
# Generated by NetworkManager
nameserver 192.168.3.6
nameserver 192.168.13.6
search example.com

4) Reboot 
---------
# uptime
 09:49:39 up 1 min,  1 user,  load average: 0.31, 0.11, 0.04

5) Compare DNS entries in ifcfg-eth0 and resolv.conf
----------------------------------------------------
# cat /etc/resolv.conf
# Generated by NetworkManager
nameserver 192.168.3.6
nameserver 192.168.13.6
search example.com

# grep DNS /etc/sysconfig/network-scripts/ifcfg-eth0
DNS1="192.168.3.6"
DNS2="192.168.16.6"




Actual results:
The second DNS entry is still the old entry "192.168.13.6".

Expected results:
The second DNS entry has been updated to the new entry "192.168.16.6".

Additional info:
Swaping the entries DNS1 and DNS2 in ifcfg-eth0 also does not trigger an update of /etc/resolv.conf. 
Just after DNS1 has changed to a new ip address that does not match DNS2, the file resolv.conf will updated in a predictive way.
Comment 2 Akhil John 2016-08-08 05:58:13 EDT
Can we make this bug public ? customer is requesting for public access .
Comment 3 Lukáš Nykrýn 2016-08-08 06:52:48 EDT
(In reply to Akhil John from comment #2)
> Can we make this bug public ? customer is requesting for public access .
I am fine with that.
Comment 4 Lukáš Nykrýn 2016-08-08 07:04:03 EDT
> RHEL7 server without the NetworkManager packages

> # cat /etc/resolv.conf
> # Generated by NetworkManager

Are you really sure that NetworkManager is not installed on that system?

Anyway in your reproducer could you before the reboot add "set -x" to the end of /etc/init.d/functions so it looks like this:
----------------------------------------
[0 root@qeos-52 test]# tail /etc/init.d/functions 
                "x$1" = xtry-restart -o \
                "x$1" = xforce-reload -o \
                "x$1" = xcondrestart ] ; then

		systemctl_redirect $0 $1
		exit $?
	fi
fi

set -x
----------------------------------------
And then reboot the machine and attach the output of "journalctl -b" and "journalctl -b -u network.service"
Comment 5 Lukáš Nykrýn 2016-08-08 10:54:49 EDT
Looks like I have already fixed that: https://bugzilla.redhat.com/show_bug.cgi?id=1316019

Should be in 7.3.
Comment 6 Lukáš Nykrýn 2016-08-08 10:56:27 EDT

*** This bug has been marked as a duplicate of bug 1316019 ***
Comment 7 Lukáš Nykrýn 2016-08-08 11:04:07 EDT
Just for reference patch for rhel7 branch of initscripts:
https://git.fedorahosted.org/cgit/initscripts.git/commit/?h=rhel7-branch&id=21ee08c718692c6a4ff32204767638f0c3aafa65
Comment 8 Carsten Grohmann 2016-08-09 02:32:20 EDT
I wouldn't agree with closing this bug, because swapping the entries DNS1 and DNS2 in ifcfg-eth0 also does not trigger an update of /etc/resolv.conf.
Comment 9 Lukáš Nykrýn 2016-08-09 02:56:58 EDT
(In reply to Carsten Grohmann from comment #8)
> I wouldn't agree with closing this bug, because swapping the entries DNS1
> and DNS2 in ifcfg-eth0 also does not trigger an update of /etc/resolv.conf.

Ok, I will look into that part. Unfortunately it is quite late in 7.3 development and this is not a critical issue, so I don't think it will make it there.
Comment 10 Lukáš Nykrýn 2016-08-09 03:02:16 EDT
Also I must admit I was wrong in the case of DNS3. I have read the specification for resolving in glib and for rhel7 we have MAXNS set to 3. So that should be also supported in initscripts. I will look into that as well.
Comment 17 David Kaspar [Dee'Kej] 2017-10-09 06:23:11 EDT
Pull-request submitted into upstream:
https://github.com/fedora-sysv/initscripts/pull/131
Comment 29 Andrew Taylor 2018-02-25 19:53:06 EST
*** Bug 1548871 has been marked as a duplicate of this bug. ***
Comment 35 errata-xmlrpc 2018-04-10 14:24:45 EDT
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:0983

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