# [Worked around] Broken ypbind

## peterz76

Hello,

Today's not my day indeed =(

I was emerging Xgl recently -- lots of packages -- and that seemingly affected ypbind badly: it won't connect to the server. Upon startup, /etc/init/ypbind hangs for about 10 minutes, then gives me "Cannot find NIS server" message. ypbind -d produces the following (this works fast):

```
# ypbind -d

15814: parsing config file

  [ skip ]

15814: [Welcome to ypbind-mt, version 1.19.1]

15814: ping interval is 20 seconds

15814: Unable to register (YPBINDPROG, YPBINDVERS, udp).

```

At the same time, portmap is running ok:

```
# rpcinfo -p localhost

   program vers proto   port

    100000    2   tcp    111  portmapper

    100000    2   udp    111  portmapper

# rpcinfo -p "nisserver"

   program vers proto   port

    100000    4   tcp    111  portmapper

    100000    3   tcp    111  portmapper

    100000    2   tcp    111  portmapper

    100000    4   udp    111  portmapper

    100000    3   udp    111  portmapper

    100000    2   udp    111  portmapper

 [ lots of lines skipped ]

    100007    3   udp  35719  ypbind

    100007    2   udp  35719  ypbind

    100007    1   udp  35719  ypbind

    100007    3   tcp  34698  ypbind

    100007    2   tcp  34698  ypbind

    100007    1   tcp  34698  ypbind

    100026    1   udp  35726  bootparam

1073741824    1   tcp  34712

    100026    1   tcp  34717  bootparam

    100004    2   udp    919  ypserv

    100004    1   udp    919  ypserv

    100004    1   tcp    562  ypserv

    100004    2   tcp  43944  ypserv

1073742287    2   udp  43636

```

Any ideas what may be wrong here?

Thanks!

--

PeterLast edited by peterz76 on Wed Oct 11, 2006 12:31 pm; edited 1 time in total

----------

## sgao

I saw the same problem. ypbind failed to start correctly with:

```
 * Starting ypbind ...

 * No NIS server found                                                    [ !! ]

```

```
# domainname

NIS-DOMAIN

```

```
# rpcinfo -p localhost

   program vers proto   port

    100000    2   tcp    111  portmapper

    100000    2   udp    111  portmapper

    100007    2   udp    693  ypbind

    100007    1   udp    693  ypbind

    100007    2   tcp    696  ypbind

    100007    1   tcp    696  ypbind

```

```

# rpcinfo -p nis-server1

   program vers proto   port

    100000    2   tcp    111  portmapper

    100000    2   udp    111  portmapper

    100004    1   udp   1021  ypserv

    100004    2   udp   1021  ypserv

    100004    1   tcp   1023  ypserv

    100004    2   tcp   1023  ypserv

 600100069    1   udp   1015  fypxfrd

 600100069    1   tcp   1022  fypxfrd

    100007    2   udp   1011  ypbind

    100007    2   tcp   1021  ypbind

    100001    1   udp   1103  rstatd

    100001    2   udp   1103  rstatd

    100001    3   udp   1103  rstatd

    100002    1   udp   1104  rusersd

    100002    2   udp   1104  rusersd

```

ypbind would time out on boot or starting.

Simon

----------

## Janne Pikkarainen

Anything in the logs?

----------

## peterz76

Ugh! Logs really have something interesting.

Each invocation of "ypbind -d" produces these three lines in /var/log/everything/current:

```
Oct 10 17:26:02 [portmap] connect from 127.0.0.1 to unset(ypbind): request from non-local host

                - Last output repeated twice -

Oct 10 17:26:02 [portmap] connect from 127.0.0.1 to set(ypbind): request from non-local host

```

127.0.0.1 is surely LOCAL host:

```
# cat /etc/hosts

...

127.0.0.1   localhost

# ifconfig

eth0      Link encap:Ethernet  HWaddr 00:11:D8:8B:9C:6D  

          inet addr:129.159.125.188  Bcast:129.159.125.255  Mask:255.255.254.0

          UP BROADCAST NOTRAILERS RUNNING MULTICAST  MTU:1500  Metric:1

          RX packets:557296 errors:0 dropped:0 overruns:0 frame:0

          TX packets:292 errors:0 dropped:0 overruns:0 carrier:0

          collisions:0 txqueuelen:1000 

          RX bytes:59672288 (56.9 Mb)  TX bytes:35295 (34.4 Kb)

          Interrupt:19 

lo        Link encap:Local Loopback  

          inet addr:127.0.0.1  Mask:255.0.0.0

          UP LOOPBACK RUNNING  MTU:16436  Metric:1

          RX packets:1726 errors:0 dropped:0 overruns:0 frame:0

          TX packets:1726 errors:0 dropped:0 overruns:0 carrier:0

          collisions:0 txqueuelen:0 

          RX bytes:109476 (106.9 Kb)  TX bytes:109476 (106.9 Kb)

```

Any ideas?

--

Peter

----------

## Janne Pikkarainen

So it's probably portmap which needs some massaging.

See /etc/conf.d/portmap -- does it have any options set? You might want to put -v switch there to make portmap be more verbose, restart portmap and try your stanza again...

----------

## peterz76

I've added -v to /etc/conf.d/portmap but that added added no extra verbosity.

Now after some experimenting and lots of reboots i've noticed that it's only at boot time that portmap/ypbind do not work. After the system boots up, i just run

```
/etc/init.d/portmap restart

/etc/init.d/ypbind restart

```

... and everything works perfectly!

Now it seems to me that the problem is related to the order in which init scripts run on my system. Now it is:

* net.eth0

* portmap

* xdm

* net.lo

So by the time portmap initializes, loopback interface is not yet set up.

The xdm init script explicitly requires that it is run after ypbind but before net.lo. I vaguely remember it was not always the case. I believe net.lo used to run right after net.eth0 before i've migrated to modular X.

----------

## sgao

Can you post your /etc/conf.d/net? Did you modify rc script?

My debug information is different:

```

# ypbind -d

5308: parsing config file

5308: Trying entry: domain NISDOMAIN server 192.168.10.5

5308: parsed domain 'NISDOMAIN' server '192.168.10.5'

5308: add_server() domain: NISDOMAIN, host: 192.168.10.5, slot: 0

5308: [Welcome to ypbind-mt, version 1.19.1]

5308: ping interval is 20 seconds

5316: ping host '192.168.10.5', domain 'NISDOMAIN'

5316: Pinging all active server.

5316: ping host '192.168.10.5', domain 'NISDOMAIN'

5316: Pinging all active server.

5316: ping host '192.168.10.5', domain 'NISDOMAIN'

5316: Pinging all active server.

5316: ping host '192.168.10.5', domain 'NISDOMAIN'

5316: Pinging all active server.

5316: ping host '192.168.10.5', domain 'NISDOMAIN'

....

# rpcinfo -p 192.168.10.5

   program vers proto   port

    100000    2   tcp    111  portmapper

    100000    2   udp    111  portmapper

    100004    1   udp   1021  ypserv

    100004    2   udp   1021  ypserv

    100004    1   tcp   1023  ypserv

    100004    2   tcp   1023  ypserv

 600100069    1   udp   1015  fypxfrd

 600100069    1   tcp   1022  fypxfrd

    100007    2   udp   1011  ypbind

    100007    2   tcp   1021  ypbind

    100001    1   udp   1103  rstatd

    100001    2   udp   1103  rstatd

    100001    3   udp   1103  rstatd

    100002    1   udp   1104  rusersd

    100002    2   udp   1104  rusersd

```

Simon

----------

## peterz76

I've worked around my problem by removing "before net.lo" from /etc/init.d/xdm. However, this script obviously work as is for lots of people -- so i still wonder what exactly is broken on my system.

Thanks Janne -- your questions helped me fight my frustration and find the solution  :Smile: 

--

Peter

----------

## peterz76

Hey sgao,

My /etc/conf.d/net is empty -- i use DHCP so there's nothing to override. I did not modify rc but rather modified xdm so it now starts after net.lo.

Your problem is apparenlty different from mine -- in your case ypbind is at least able to register with the portmapper. It likely fails to talk to the server. Try broadcasting for server, like this:

```
# cat /etc/yp.conf

domain NISDOMAIN broadcast

```

----------

## sgao

My problem remains though I found some interesting issues.

ypbind only binds to a NIS master server on the same machine (for slave server to work, it must be able to bind to a master server first). It failed binding any NIS server on remote machines. Still not sure why this could ever happen. If rpcinfo reports the local machine able to connect to remote NIS server, then there should be no problem binding it.

In the startup script, ypbind uses ypserv and domainname before it starts.

```

#!/sbin/runscript

# Copyright 1999-2004 Gentoo Foundation

# Distributed under the terms of the GNU General Public License v2

# $Header: /var/cvsroot/gentoo-x86/net-nds/ypbind/files/ypbind.initd,v 1.3 2006/

04/10 19:57:11 eradicator Exp $

depend() {

        need net portmap

        use ypserv domainname

}

start() {

        ebegin "Starting ypbind"

        if [ -n "${YPBIND_OPTS}" ]; then YOPTS="-- ${YPBIND_OPTS}"; fi

        start-stop-daemon --start --quiet --exec /usr/sbin/ypbind ${YOPTS}

        if [ -n "$?" ] ; then

                notfound=1

                for i in 0 1 2 3 4 5 6 7 8 9

                do

                        ypwhich &>/dev/null && { notfound=0; break; }

                        sleep 1

                done

                if [ $notfound -eq 1 ] ; then                        eend 1 "No NIS server found"

                else

                        eend 0

                fi

        else

                eend $?

        fi

}

stop() {

        ebegin "Stopping ypbind"

        start-stop-daemon --stop --quiet --exec /usr/sbin/ypbind

        eend $?

        # Remove binding files, if ypbind "forgets" it

        rm -f /var/yp/binding/*

}

```

Why are ypserv and domainname ever needed here?

sys-apps/baselayout-1.12.5-r2

net-nds/ypbind-1.19.1-r1

net-nds/portmap-5b-r9

net-nds/yp-tools-2.9

net-nds/ypserv-2.18

Kernel   2.6.17-r8/2.6.16.28-xen

Simon

----------

