# NFS problem... can't start rpc.mountd

## Phlaegel

Ok, so I finally decided to get nfs running on my server, but the machines conspire against me. I compiled nfs support (v3, server and client) into the kernel, rebooted, installed nfs-utils (1.0.6), set up /etc/exports ,and ran /etc/init.d/nfs start. What do I get for my trouble?

```

 * Exporting NFS directories...                                                      [ ok ]

 * Starting NFS daemon...                                                            [ ok ]

 * Starting NFS mountd...

/sbin/runscript.sh: line 526:  1468 Segmentation fault      start-stop-daemon --start --quiet --exec $mountd -- $RPCMOUNTDOPTS 1>&2

 * Error starting NFS mountd                                                         [ !! ]

```

Strange, says I. Anybody know what would do this? I haven't been able to find this problem in my searches.

----------

## Phlaegel

Anybody?

----------

## pilla

Nothing in the logs? 

Try to start it by hand. Or maybe you could try to remove the --quiet in the init script.

----------

## Phlaegel

Ok, got it figured out. I'm using LDAP for pretty much everything, but didn't have all the rpc info in the directory. So that works, but mounts are really slow, or hanging. But not all the time. Fun.

edit: ok, need portmap on the client too. yay, nfs.

----------

## lplatypus

 *Phlaegel wrote:*   

> Ok, got it figured out. I'm using LDAP for pretty much everything, but didn't have all the rpc info in the directory. So that works...

 

Hi, I'm having the same problem with rpc.mountd segfaulting.  I too am using LDAP for user and group accounts.  What do you mean about having the rpc info in the directory?

----------

## luked

I solved this problem by doing:

```
CFLAGS=-O0 emerge nfs-utils
```

Previously I had been compiling with -march=athlon -O3 -fomit-frame-pointer

----------

## mobian

I'm having the same problem as described by the original poster.  

My network uses ldap for all user authentication, and home directories are mounted via nfs.  

Here's the output when I try to start /etc/init.d/nfs:

```

 * Starting idmapd ...

rpc.idmapd: Skipping configuration file "/etc/idmapd.conf": No such file or directory                                                                     [ ok ]

 * Starting NFS daemon ...                                                [ ok ]

 * Starting NFS mountd ...

/etc/init.d/nfs: line 98: 14764 Segmentation fault      start-stop-daemon --start --quiet --exec $mountd -- $RPCMOUNTDOPTS 1>&2

 * Error starting NFS mountd 

```

If I try to start mountd directly, via /usr/sbin/rpc.mountd, I get the following rather unhelpful segfault:

```

Segmentation fault

```

I have tried as luked suggested, and did the following:

```

CFLAGS=-O0 emerge nfs-utils

```

To no avail.  It still segfaults.  Any ideas?

----------

## mobian

OK, I found a fix for this.  I downgraded my glibc as follows: 

```

emerge =glibc-2.3.4.20050125-r1

```

Then I re-emerged nfs-utils as follows:

```

CFLAGS=-O0 emerge nfs-utils

```

Now it works.  Anyone see a better fix to this, or a more permanent one, let me know.

----------

## mobian

After a very sleepless night, I have come to the bottom of this *very* ellusive problem.  I don't know if this will fix anyone else's problem if it is similar, but I am posting my conclusions here in case anyone else ever runs into the same problem.

I noticed this bug only crept in after I switched to using LDAP.  So, on this hunch, I disabled ldap on the offending client by replacing the /etc/nsswitch.conf with the original non-ldap one.  This allowed me to start nfs (including rpc.mountd) with no segfault!  So on that hunch, I modified my nsswitch.conf file so that it works with ldap and nfs no longer segfaults.  Here is my current /etc/nsswitch.conf:

```

# /etc/nsswitch.conf:

# $Header: /var/cvsroot/gentoo-src/rc-scripts/etc/nsswitch.conf,v 1.4 2002/11/18 19:39:22 azarah Exp $

passwd:      files ldap

shadow:      files ldap

group:       files ldap

# passwd:    db files nis

# shadow:    db files nis

# group:     db files nis

hosts:       files ldap dns

networks:    files dns

services:    db files

protocols:   db files

rpc:         db files

ethers:      db files

netmasks:    files ldap

netgroup:    files ldap

bootparams:  files

automount:   files ldap

aliases:     files ldap

```

I hope this helps others.....

----------

## mobian

Damn, seems the nsswitch.conf file was preventing some key things from working correctly.  So now I've taken the nsswitch.conf file suggested for ldap in the OpenLDAP howto, and line by line I traced where the bug was being introduced.  Turns out it was on this line:

```

rpc:        ldap [NOTFOUND=return] files

```

So now, I've changed it to the following:

```

rpc:        files ldap [NOTFOUND=return]

```

This allows all of ldap to work and nfs no longer segfaults.  

For those keeping track, here is my final nsswitch.conf file:

```

#ident $Id: nsswitch.ldap,v 2.4 2003/10/02 02:36:25 lukeh Exp $

#

# An example file that could be copied over to /etc/nsswitch.conf; it

# uses LDAP conjunction with files.

#

# "hosts:" and "services:" in this file are used only if the

# /etc/netconfig file has a "-" for nametoaddr_libs of "inet" transports.

# the following two lines obviate the "+" entry in /etc/passwd and /etc/group.

passwd:         files ldap

shadow:         files ldap

group:          files ldap

# consult files/dns first, we will need it to resolve the LDAP host. (If we

# can't resolve it, we're in infinite recursion, because libldap calls

# gethostbyname(). Careful!)

hosts:          files dns ldap

# LDAP is nominally authoritative for the following maps.

services:   ldap [NOTFOUND=return] files

networks:   ldap [NOTFOUND=return] files

protocols:  ldap [NOTFOUND=return] files

rpc:        files ldap [NOTFOUND=return]

ethers:     ldap [NOTFOUND=return] files

# no support for netmasks, bootparams, publickey yet.

netmasks:   files

bootparams: files

publickey:  files

automount:  ldap

# I'm pretty sure nsswitch.conf is consulted directly by sendmail,

# here, so we can't do much here. Instead, use bbense's LDAP

# rules ofr sendmail.

aliases:    files

sendmailvars:   files

# Note: there is no support for netgroups on Solaris (yet)

netgroup:   ldap [NOTFOUND=return] files

```

----------

## Dabljuh

I just ran into the same problem and your solution worked. Maybe someone should file a bug with the ebuild maintainers, since it seems the default ldap nsswitch config doesn't work properly.

----------

