# NFS will not mount



## erikf154 (Jul 2, 2009)

I'm having issues with NFS, it was working fine, and then suddenly stopped. I can't mount the NFS shares any more, I'be goofing around for hours now but can't figure out why it's not working.

Whenever I try to mount I get these messages:

```
[tcp6] localhost:/usr/ports: RPCPROG_NFS: RPC: Remote system error - Protocol not supported
[tcp] localhost:/usr/ports: Permission denied
[tcp] localhost:/usr/ports: Permission denied
```

Even with this simple /etc/exports file it doesn't work anymore:

```
/usr/ports/ -ro
```

I've got this in /etc/rc.conf

```
rpcbind_enable="YES"
nfs_client_enable="YES"
nfs_server_enable="YES"
nfs_server_flags="-u -t -n 20"
nfs_reserved_port_only="YES"
mountd_flags="-r"
```

Still looks like it's exported though

```
# showmount -e
Exports list on localhost:
/usr/ports/                        Everyone
```

In /var/messages I get these errors:

```
Jul  2 10:34:45 kitbuild001 mountd[486]: mount request denied from 127.0.0.1 for /usr/ports
Jul  2 10:35:22 kitbuild001 last message repeated 2 times
```

I can't mount these shares from other servers or even localhost:

```
mount -o tcp localhost:/usr/ports test
[tcp6] localhost:/usr/ports: RPCPROG_NFS: RPC: Remote system error - Protocol not supported
[tcp] localhost:/usr/ports: Permission denied
[tcp] localhost:/usr/ports: Permission denied
```

I know you're not supposed use symlink in the path and stuff so I've checked for that. I've tried sharing different directories and etc. I don't think it's really a permission problem either, but who knows...

Please help, it's driving me nuts!


----------



## danger@ (Jul 2, 2009)

try to restart mountd


----------



## erikf154 (Jul 2, 2009)

I've done that (and restarted nfsd as well, rebooted, reloaded the exports file (/etc/mountd onereload). Nothing did anything.


----------



## kiyolee (Jul 2, 2009)

First path in an exports entry must be a file system mount point, not any random directory.
For you case to work, /usr/ports must be by itself a separate file system.
Instead, you may use something like:
/usr /usr/ports -ro
assuming /usr is a separate file system (which usually is).
Read man page for exports.
After modifying /etc/exports, you don't really need to restart mountd.
You can simply run this command as root:
kill -HUP `cat /var/run/mountd.pid`


----------



## erikf154 (Jul 3, 2009)

> First path in an exports entry must be a file system mount point, not any random directory.


That's incorrect, it's not necessary to share an entire filesystem, that would be inconvenient. Besides it was working before w/o needing to put the /usr in front. What you cannot do however is have several lines sharing the same directory. Anyways, I tried just to be safe, but still samme error.


> After modifying /etc/exports, you don't really need to restart mountd.


I don't, I just reload the config

```
/etc/rc.d/mountd onereload
```
So I'm still stuck...


----------



## qsecofr (Jul 6, 2009)

I assume you're just testing setup locally with nfs client & server on same physical box.

Try 

```
rpcinfo -s 127.0.0.1
```
you should see services: rpcbind, mountd, nfs, nlockmgr (and probably status too, though I'm not certain it's required for nfs)

Also check TCP wrappers to make sure you're not blocking the traffic in /etc/hosts.allow and verify entry in /etc/hosts

You're not blocking traffic in the firewall somehow are you?

Stick with dotted decimal IP addresses.

My /usr/ports is owned by root:wheel.  Not sure about yours.  I'm not sure I would export something owned by root.  Maybe for easier debugging try and export your own home directory.  It should be owned by you.  In /etc/exports

```
/home        -alldirs        127.0.0.1
```
If you can mount your own home then maybe you've got permission issues with ports tree.

And consider changing your mount point as kiyolee suggested.

When you get it running and involve more than 1 box, double-check uid numbers match on both/all boxes.  I think this is still a requirement, though if not, someone will likely correct the statement.


----------



## erikf154 (Jul 8, 2009)

It's working again - for some reason. I haven't really changed anything. Rebooted a couple of times, restarted nfsd, mountd and rpcbind...and it's working. Kinda annoying really since I don't know what caused the problem.

Anyhow, the exports line looks like this now, and yes, working 

```
/usr/src /usr/obj /usr/ports -ro -maproot=root -network 10.0.0.0 -mask 255.0.0.0
```

Thanks for all the help/suggestions!

qsecofr: You're right, rpcbind, mountd, nfs is running, but not nlockmgr


----------

