Red Hat Bugzilla – Bug 1364895
Updating /etc/resolv.conf failed sometimes
Last modified: 2018-04-10 14:26:25 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.
Can we make this bug public ? customer is requesting for public access .
(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.
> 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"
Looks like I have already fixed that: https://bugzilla.redhat.com/show_bug.cgi?id=1316019 Should be in 7.3.
*** This bug has been marked as a duplicate of bug 1316019 ***
Just for reference patch for rhel7 branch of initscripts: https://git.fedorahosted.org/cgit/initscripts.git/commit/?h=rhel7-branch&id=21ee08c718692c6a4ff32204767638f0c3aafa65
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.
(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.
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.
Pull-request submitted into upstream: https://github.com/fedora-sysv/initscripts/pull/131
*** Bug 1548871 has been marked as a duplicate of this bug. ***
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