Bug 1767100

Summary: nameservers are not written correctly by the ifcfg module
Product: Red Hat Enterprise Linux 8 Reporter: Christophe Besson <cbesson>
Component: dracutAssignee: Lukáš Nykrýn <lnykryn>
Status: CLOSED ERRATA QA Contact: Frantisek Sumsal <fsumsal>
Severity: low Docs Contact:
Priority: low    
Version: 8.0CC: dracut-maint-list, dtardon, fkrska, fsumsal, jamacku
Target Milestone: rcKeywords: Patch, Triaged
Target Release: 8.0   
Hardware: All   
OS: Linux   
Whiteboard:
Fixed In Version: dracut-049-129.git20210107.el8 Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2021-05-18 15:02:41 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 Christophe Besson 2019-10-30 16:58:45 UTC
Description of problem:
According to the code of net-lib.sh and the manual of dracut.cmdline, the ip argument from the cmdline used for early networking setup may have several forms, including this one:
ip=<client-IP>:[<peer>]:<gateway-IP>:<netmask>:<client_hostname>:<interface>:{none|off|dhcp|on|any|dhcp6|auto6|ibft}[:[<dns1>][:<dns2>]]

The last columns are not parsed, so the DNS1 and DNS2 are not present in the generated ifcfg files (which are themselves used by the NetworkManager).

Version-Release number of selected component (if applicable):
# rpm -qf /usr/lib/dracut/modules.d/45ifcfg/write-ifcfg.sh 
dracut-network-049-10.git20190115.el8.x86_64

How reproducible:
echo "kernel_cmdline=ip=192.168.122.100::192.168.122.1:255.255.255.0::ens3:none:8.8.8.8" > /etc/dracut.conf.d/static_ip.conf
dracut -fv --regenerate-all

Actual results:
No DNS1 and DNS2 entries in /etc/sysconfig/network-scripts/ifcfg-*

Expected results:
DNS1 and DNS2 are present in the ifcfg file.

Additional info:
The code of write-ifcfg only iterates the nameserver arguments from the cmdline.
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    i=1
    for ns in $(getargs nameserver); do
        echo "DNS${i}=\"${ns}\"" >> /tmp/ifcfg/ifcfg-$netif
        i=$((i+1))
    done
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Comment 1 Christophe Besson 2019-10-30 17:02:14 UTC
Additionally, there is no way to define a DOMAIN with this ifcfg module. This is a second issue, since the early network setup overwrites files generated by anaconda (parse-kickstart), so there is no way to define the DOMAIN value in the ifcfg file (the NetworkManager reads that to write /etc/resolv.conf).

Comment 2 Jan Macku 2019-11-01 14:12:06 UTC
Pull-request that should fix this issue was send to upstream:

https://github.com/dracutdevs/dracut/pull/667

Comment 4 Christophe Besson 2019-11-06 10:30:09 UTC
Thanks, and what about the 2nd (related) issue about the DOMAIN definition? Should I open another bug for that one?

Comment 5 Lukáš Nykrýn 2019-11-11 09:12:36 UTC
Yeah, maybe it would be better to have this covered in separated bugs. Since the nameserver part was a bugfix, while the domain part is RFE.

Comment 13 errata-xmlrpc 2021-05-18 15:02:41 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 (dracut bug fix and enhancement update), 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-2021:1661