Bug 601615

Summary: ypbind fails to start with multiple NIS servers
Product: Red Hat Enterprise Linux 6 Reporter: Karel Klíč <kklic>
Component: ypbindAssignee: Karel Klíč <kklic>
Status: CLOSED CURRENTRELEASE QA Contact: Karel Volný <kvolny>
Severity: medium Docs Contact:
Priority: low    
Version: 6.0CC: azelinka, bugzilla, kklic, kvolny, rvokal
Target Milestone: rc   
Target Release: ---   
Hardware: All   
OS: Linux   
Whiteboard:
Fixed In Version: ypbind-1.20.4-28.el6 Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: 601296 Environment:
Last Closed: 2010-11-10 22:00:20 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Description Karel Klíč 2010-06-08 10:25:09 UTC
+++ This bug was initially created as a clone of Bug #601296 +++

Created an attachment (id=421877)
change ypbind init script to call domainname only on first domainname listed in yp.conf

We have multiple NIS servers that dhcclient populates for us in /etc/yp.conf.  When ypbind starts, if domainname is not set, it awk's out the 'domain <domainname>' lines from yp.conf then calls "domainname" with the [potentially numerous] domains.  As of Fedora 13, domainname will not run with multiple domains on the command line, thus ypbind fails to start.

Boot messages (replacing real domainname with OurNISDomain):

Setting NIS domain: domain is 'OurNISDomain
OurNISDomain
OurNISDomain
OurNISDomain
OurNISDomain
OurNISDomain
OurNISDomain'  Usage: hostname [-v] [-b] {hostname|-F file}         set host name (from file)
       hostname [-v] [-d|-f|-s|-a|-i|-y|-A|-I]             display formatted name
       hostname [-v]                                 display host name

       {yp,nis,}domainname [-v] {nisdomain|-F file}  set NIS domain name (from file)
       {yp,nis,}domainname [-v]                      display NIS domain name

       dnsdomainname [-v]                            display dns domain name

       hostname -V|--version|-h|--help               print info and exit

Program name:
       {yp,nis,}domainname=hostname -y
       dnsdomainname=hostname -d

Program options:
    -s, --short            short host name
    -a, --alias            alias names
    -i, --ip-address       addresses for the host name
    -I, --all-ip-addresses all addresses for the host
    -f, --fqdn, --long     long host name (FQDN)
    -A, --all-fqdns        all long host names (FQDNs)
    -d, --domain           DNS domain name
    -y, --yp, --nis        NIS/YP domain name
    -b, --boot             set default hostname if none available
    -F, --file             read host name or NIS domain name from given file

Description:
   This command can get or set the host name or the NIS domain name. You can
   also get the DNS domain or the FQDN (fully qualified domain name).
   Unless you are using bind or NIS for host lookups you can change the
   FQDN (Fully Qualified Domain Name) and the DNS domain name (which is
   part of the FQDN) in the /etc/hosts file.
                                                           [FAILED]
Starting NIS service: domainname not set - aborting.
                                                           [FAILED]


Suggested fix: take the first domainname in yp.conf and use only that.  Works for me.

Of course, if domainname is *suppose* to take multiple NIS domainnames, then this bug should be shifted over to net-tools.

--- Additional comment from kklic on 2010-06-08 06:24:08 EDT ---

Thank you.
I agree that the first domainname should be used if none is set.

Fixed in
 - Rawhide:   ypbind-1_31-6_fc14
 - Fedora 13: ypbind-1_31-4_fc13

Comment 2 RHEL Program Management 2010-06-08 10:53:00 UTC
This request was evaluated by Red Hat Product Management for inclusion in a Red
Hat Enterprise Linux major release.  Product Management has requested further
review of this request by Red Hat Engineering, for potential inclusion in a Red
Hat Enterprise Linux Major release.  This request is not yet committed for
inclusion.

Comment 4 Karel Volný 2010-10-01 09:06:33 UTC
the new initscript now reads:

NISDOMAIN=`grep "domain" /etc/yp.conf | grep -v ^# | \                                                                                                              
     awk '{print $2}' | head -1`                                                                                                                                     

so only the first line is taken

however, I'd suggest (for the future) to use the simpler command proposed in bug #601296 comment #2 as it uses just one awk call instead of four commands:

NISDOMAIN=`awk '/^[^#]/ { if ($1 == "domain") {print $2; exit} }' /etc/yp.conf`

Comment 5 releng-rhel@redhat.com 2010-11-10 22:00:20 UTC
Red Hat Enterprise Linux 6.0 is now available and should resolve
the problem described in this bug report. This report is therefore being closed
with a resolution of CURRENTRELEASE. You may reopen this bug report if the
solution does not work for you.