# HELP:  Can't get NFS server to work

## theosib

I've never been successful at getting NFS to work.  This time, I thought if I got help from people on IRC, I'd have more success, but apparently not.  I'm hoping I can get some help here.

First of all, I read these two tutorials:

http://en.gentoo-wiki.com/wiki/NFS/Server

http://linux-bsd-sharing.blogspot.com/2008/09/howto-setup-nfs-server-on-gentoo.html

My kernel is configured to support NFS3 and 4.  Right now, I'm running 2.6.37.  I have installed nfs-utils:

[ebuild   R   ] net-fs/nfs-utils-1.2.3-r1  USE="ipv6 kerberos nfsv3 nfsv4 tcpd -caps" 0 kB

This is my /etc/exports:

# /etc/exports: NFS file systems being exported.  See exports(5).

/home/millerti 192.168.0.0(async,rw,no_subtree_check)

/mnt/backup 192.168.0.0(rw,no_subtree_check)

When I run "/etc/init.d/nfs start", I get this:

nfs                | * Exporting NFS directories ...                                                                                                            [ ok ]             |

nfs                | * Starting NFS mountd ...                                                                                                                  [ !! ]             |

nfs                | * Starting NFS daemon ...                                                                                                                  [ ok ]             |

nfs                | * Starting NFS smnotify ...                                                                                                                [ ok ]             |

nfs                | * ERROR: nfs failed to start

Some other stuff:

# ps -ef | grep nfs

root      7777     2  0 Feb04 ?        00:00:00 [nfsiod]

root     20308     2  0 18:06 ?        00:00:00 [nfsd4]

root     20309     2  0 18:06 ?        00:00:00 [nfsd4_callbacks]

root     20310     2  0 18:06 ?        00:00:00 [nfsd]

root     20311     2  0 18:06 ?        00:00:00 [nfsd]

root     20312     2  0 18:06 ?        00:00:00 [nfsd]

root     20313     2  0 18:06 ?        00:00:00 [nfsd]

root     20314     2  0 18:06 ?        00:00:00 [nfsd]

root     20315     2  0 18:06 ?        00:00:00 [nfsd]

root     20316     2  0 18:06 ?        00:00:00 [nfsd]

root     20317     2  0 18:06 ?        00:00:00 [nfsd]

# ps -ef | grep rpc

root      7740     2  0 Feb04 ?        00:00:00 [rpciod]

root     16967     1  0 17:46 ?        00:00:00 /sbin/rpcbind

root     16984     1  0 17:46 ?        00:00:00 /usr/sbin/rpc.idmapd

nobody   16991     1  0 17:46 ?        00:00:00 /sbin/rpc.statd --no-notify

Not sure what else to look for.  I'm also not sure how to get more info.  The error is uninformative, and there's nothing relevant in dmesg or /var/log/messages.

Any ideas?

Thanks!

----------

## NeddySeagoon

theosib,

My /etc/exports has 192.168.0.0/24 to specifiy a network.  192.168.0.0 would be a single (illegal) host

To check that the nfs sever works, you can nfs mount a share on the server.  This avoids all the issues you get with mismatched UIDs between server and remote boxes.

----------

## krinn

and make sure your mountd is working, as the [!!] show it is not and you are exporting nfs3 style, so mountd will be needed.

from any host, you can just rpcinfo -p nfsserverip to grab the info

----------

## theosib

Thanks for the responses.  I tried some of what you suggested.  

First, I changed the exports file to this:

/home/millerti 192.168.1.0/24(async,rw,no_subtree_check)

/mnt/backup 192.168.1.0/24(rw,no_subtree_check)

But when I try to start nfs, I still get the same error:

nfs                | * Exporting NFS directories ...                                                                                                            [ ok ]             |

nfs                | * Starting NFS mountd ...                                                                                                                  [ !! ]             |

nfs                | * Starting NFS daemon ...                                                                                                                  [ ok ]             |

nfs                | * Starting NFS smnotify ...                                                                                                                [ ok ]             |

nfs                | * ERROR: nfs failed to start

rcpinfo says this:

# rpcinfo -p 192.168.1.30

   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

    100024    1   udp  43667  status

    100024    1   tcp  33239  status

    100005    1   udp  46787  mountd

    100005    1   tcp  43623  mountd

    100005    2   udp  41614  mountd

    100005    2   tcp  60995  mountd

    100005    3   udp  33011  mountd

    100005    3   tcp  47615  mountd

    100003    2   tcp   2049  nfs

    100003    3   tcp   2049  nfs

    100003    4   tcp   2049  nfs

    100227    2   tcp   2049  nfs_acl

    100227    3   tcp   2049  nfs_acl

    100003    2   udp   2049  nfs

    100003    3   udp   2049  nfs

    100003    4   udp   2049  nfs

    100227    2   udp   2049  nfs_acl

    100227    3   udp   2049  nfs_acl

    100021    1   udp  41969  nlockmgr

    100021    3   udp  41969  nlockmgr

    100021    4   udp  41969  nlockmgr

    100021    1   tcp  56719  nlockmgr

    100021    3   tcp  56719  nlockmgr

    100021    4   tcp  56719  nlockmgr

When I try to mount locally, this happens:

# mount -t nfs localhost:/home/millerti /mnt

mount.nfs: access denied by server while mounting localhost:/home/millerti

What else?  

Thanks again.

----------

## NeddySeagoon

theosib,

```
# mount -t nfs localhost:/home/millerti /mnt

mount.nfs: access denied by server while mounting localhost:/home/millerti 
```

Well, localhost is 127.0.0.1 which is not in your /etc/exports, so thats ok.

Use

```
 mount -t nfs 192.168.0.x:/home/millerti /mnt
```

fill in the IP of the server.

Is there anything in dmsg about things not starting ?

----------

## theosib

# mount -t nfs 192.168.1.30:/home/millerti /mnt

mount.nfs: access denied by server while mounting 192.168.1.30:/home/millerti

I'm not sure what kind of network is 127.0.0.1 (also /24 ?), so I don't know how to add that to exports.  Otherwise, I'd try that.

This is all that dmesg says:

NFSD: Using /var/lib/nfs/v4recovery as the NFSv4 state recovery directory

NFSD: starting 90-second grace period

Anyhow, I don't think everything's started up right, otherwise I wouldn't get that error when I try to start nfs.  Also, since it failed to start, but there's all these processes running, I can't 'stop' it, and I don't know what all processes are associated with nfs, so I don't know which ones to kill manually.

----------

## theosib

net-fs/nfs-utils-1.2.3-r1 is an unstable package.  It may just be broken.  I've filed a bug report:

https://bugs.gentoo.org/show_bug.cgi?id=360677

----------

## theosib

Someone suggested I look at the output of exportfs:

# exportfs

/home/millerti  192.168.1.0/24

/mnt/backup     192.168.1.0/24

----------

## theosib

Someone on IRC suggested that I stop all the rpc processes.  To my knowledge, I'd never started them before, but anyhow, killing them and then restarting nfs did the trick!

----------

## NeddySeagoon

theosib,

Well done.  

127.0.0.1 is defined as a /8  but its a valid host address too, so 127.0.0.1 would work.

----------

