Bug 815369

Summary: NetworkManager overwrites resolv.conf because of no DNS1/DNS2 entries in dracut generated files
Product: [Fedora] Fedora Reporter: Mark Hamzy <hamzy>
Component: dracutAssignee: dracut-maint
Status: CLOSED ERRATA QA Contact: Fedora Extras Quality Assurance <extras-qa>
Severity: urgent Docs Contact:
Priority: unspecified    
Version: 17CC: dracut-maint, jonathan
Target Milestone: ---   
Target Release: ---   
Hardware: ppc64   
OS: Linux   
Whiteboard:
Fixed In Version: dracut-018-26.git20120424.fc17 Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2012-05-02 04:37:43 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:

Description Mark Hamzy 2012-04-23 13:39:17 UTC
Description of problem:
I am seeing a problem with network name lookup. NetworkManager nukes /etc/resolv.conf because there are no DNS1 or DNS2 entries in ifcfg-eth* entries created by dracut.

Version-Release number of selected component (if applicable):
dracut-018-23.git20120419.fc17.noarch.rpm

How reproducible:
Very.

Steps to Reproduce:
The system was booted with the following line:

boot: linux ip=9.5.250.145::9.5.250.1:255.255.255.0:sharpie.rchland.ibm.com:eth0:none ip=9.5.252.203::9.5.252.1:255.255.255.0::eth1:none nameserver=9.10.244.100 bootdev=eth0

When I access a bash shell on the booted system, this is what I see:

[anaconda root@sharpie /]# ifconfig
eth0: flags=4163<UP,BROADCAST,RUNNING,MULTICAST>  mtu 1500
        inet 9.5.250.145  netmask 255.255.255.0  broadcast 9.5.250.255
        ether 2a:0f:41:b7:3f:03  txqueuelen 1000  (Ethernet)
        RX packets 1781  bytes 135886 (132.7 KiB)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 12  bytes 1072 (1.0 KiB)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0
        device interrupt 19

eth1: flags=4163<UP,BROADCAST,RUNNING,MULTICAST>  mtu 1500
        inet 9.5.252.203  netmask 255.255.255.0  broadcast 9.5.252.255
        ether 2a:0f:41:b7:3f:06  txqueuelen 1000  (Ethernet)
        RX packets 1772  bytes 130305 (127.2 KiB)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 1  bytes 90 (90.0 B)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0
        device interrupt 22

lo: flags=73<UP,LOOPBACK,RUNNING>  mtu 16436
        inet 127.0.0.1  netmask 255.0.0.0
        inet6 ::1  prefixlen 128  scopeid 0x10<host>
        loop  txqueuelen 0  (Local Loopback)
        RX packets 0  bytes 0 (0.0 B)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 0  bytes 0 (0.0 B)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

[anaconda root@sharpie /]# nslookup sharpie.rchland.ibm.com
;; connection timed out; trying next origin
;; connection timed out; no servers could be reached

[anaconda root@sharpie /]# cat /etc/sysconfig/network-scripts/ifcfg-eth0
# Generated by dracut initrd
DEVICE=eth0
ONBOOT=yes
NETBOOT=yes
UUID=44b2d13b-f3ff-4a89-bc76-db7c90447666
BOOTPROTO=none
IPADDR=9.5.250.145
NETMASK=255.255.255.0
GATEWAY=9.5.250.1
HWADDR=2a:0f:41:b7:3f:03
TYPE=Ethernet
NAME="Boot Disk"
[anaconda root@sharpie /]# cat /etc/sysconfig/network-scripts/ifcfg-eth1
# Generated by dracut initrd
DEVICE=eth1
ONBOOT=yes
NETBOOT=yes
UUID=d1fe600f-8a3c-4431-9612-0f620aaa9734
BOOTPROTO=none
IPADDR=9.5.252.203
NETMASK=255.255.255.0
GATEWAY=9.5.252.1
HWADDR=2a:0f:41:b7:3f:06
TYPE=Ethernet
NAME="Boot Disk"
[anaconda root@sharpie /]# cat /etc/resolv.conf
# Generated by NetworkManager


# No nameservers found; try putting DNS servers into your
# ifcfg files in /etc/sysconfig/network-scripts like so:
#
# DNS1=xxx.xxx.xxx.xxx
# DNS2=xxx.xxx.xxx.xxx
# DOMAIN=lab.foo.com bar.foo.com

Comment 1 Mark Hamzy 2012-04-23 14:16:58 UTC
If I break into dracut with rd.break=cmdline

cmdline:/# vi /run/initramfs/usr/lib/dracut/hooks/pre-pivot/85write-ifcfg.sh
...
        namesrv=$(getargs nameserver)
        if  [ -n "$namesrv" ] ; then
            declare -i i=1
            for s in $namesrv; do
                echo "DNS$i=$s"
                i=$(($i+1))
            done
        fi
...
cmdline:/# exit

Then that fixes the problem.

[anaconda root@sharpie /]# cat /etc/sysconfig/network-scripts/ifcfg-eth0
# Generated by dracut initrd
DEVICE=eth0
ONBOOT=yes
NETBOOT=yes
UUID=eff7cc6b-8f76-4da7-acda-c6af9186da3e
DNS1=9.10.244.100
BOOTPROTO=none
IPADDR=9.5.250.145
NETMASK=255.255.255.0
GATEWAY=9.5.250.1
HWADDR=2a:0f:41:b7:3f:03
TYPE=Ethernet
NAME="Boot Disk"
[anaconda root@sharpie /]# cat /etc/resolv.conf
# Generated by NetworkManager
nameserver 9.10.244.100

Comment 2 Mark Hamzy 2012-04-23 18:12:45 UTC
Will Woods responded with this patch:

http://fpaste.org/EGNE/

This patch works when testing from dracut with rd.break=cmdline.

Comment 3 Fedora Update System 2012-04-24 14:25:44 UTC
dracut-018-26.git20120424.fc17 has been submitted as an update for Fedora 17.
https://admin.fedoraproject.org/updates/dracut-018-26.git20120424.fc17

Comment 4 Fedora Update System 2012-04-25 04:48:28 UTC
Package dracut-018-26.git20120424.fc17:
* should fix your issue,
* was pushed to the Fedora 17 testing repository,
* should be available at your local mirror within two days.
Update it with:
# su -c 'yum update --enablerepo=updates-testing dracut-018-26.git20120424.fc17'
as soon as you are able to.
Please go to the following url:
https://admin.fedoraproject.org/updates/FEDORA-2012-6603/dracut-018-26.git20120424.fc17
then log in and leave karma (feedback).

Comment 5 Fedora Update System 2012-05-02 04:37:43 UTC
dracut-018-26.git20120424.fc17 has been pushed to the Fedora 17 stable repository.  If problems still persist, please make note of it in this bug report.