Bug 601296 - ypbind fails to start with multiple NIS servers
Summary: ypbind fails to start with multiple NIS servers
Status: CLOSED ERRATA
Alias: None
Product: Fedora
Classification: Fedora
Component: ypbind (Show other bugs)
(Show other bugs)
Version: 13
Hardware: All Linux
low
medium
Target Milestone: ---
Assignee: Karel Klíč
QA Contact: Fedora Extras Quality Assurance
URL:
Whiteboard:
Keywords: Reopened
: 636992 (view as bug list)
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2010-06-07 16:12 UTC by Chris Schanzle
Modified: 2013-03-03 23:01 UTC (History)
5 users (show)

Fixed In Version: ypbind-1.31-5.fc13
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
: 601615 (view as bug list)
Environment:
Last Closed: 2010-12-07 20:08:43 UTC
Type: ---
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---


Attachments (Terms of Use)
change ypbind init script to call domainname only on first domainname listed in yp.conf (468 bytes, patch)
2010-06-07 16:12 UTC, Chris Schanzle
no flags Details | Diff

Description Chris Schanzle 2010-06-07 16:12:41 UTC
Created attachment 421877 [details]
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.

Comment 1 Karel Klíč 2010-06-08 10:24:08 UTC
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 Chris Schanzle 2010-08-11 15:51:41 UTC
Karel, thanks for the fix, works fine.

Suggested optimization of reducing these four processes from getting forked off:

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

down to a single awk:

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

Sorry to not offer this up earlier.  I'll close this bug.

Comment 3 Karel Volný 2010-10-01 09:08:32 UTC
reopening, can we use the more effective syntax, pretty please?

Comment 4 Chris Schanzle 2010-10-01 14:37:23 UTC
I strongly agree, and I believe we could remove the comment line check too, since the $1 comparison will never match a comment line anyway:

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

Either way, still a nice reduction from 4 fork/exec calls down to 1.  Optimal.

Comment 5 Karel Klíč 2010-11-19 20:46:27 UTC
*** Bug 636992 has been marked as a duplicate of this bug. ***

Comment 6 Karel Klíč 2010-11-19 20:50:09 UTC
Thanks.

Updated in ypbind-1.32-3.fc15.

Comment 7 Fedora Update System 2010-11-23 10:50:56 UTC
ypbind-1.31-5.fc13 has been submitted as an update for Fedora 13.
https://admin.fedoraproject.org/updates/ypbind-1.31-5.fc13

Comment 8 Fedora Update System 2010-11-23 21:55:10 UTC
ypbind-1.31-5.fc13 has been pushed to the Fedora 13 testing repository.  If problems still persist, please make note of it in this bug report.
 If you want to test the update, you can install it with 
 su -c 'yum --enablerepo=updates-testing update ypbind'.  You can provide feedback for this update here: https://admin.fedoraproject.org/updates/ypbind-1.31-5.fc13

Comment 9 Fedora Update System 2010-12-07 20:08:39 UTC
ypbind-1.31-5.fc13 has been pushed to the Fedora 13 stable repository.  If problems still persist, please make note of it in this bug report.


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