Other Having a lot of difficulty formatting my exports file correctly

This has been an enormous pain for me. It's a seemingly simple issue and I hate to even make a thread about it, but nothing I'm trying is working and at this point I'm starting to wonder if my problem is even in exports or if it's something else.

Basically I just want a couple directories on my home server to be accessible when mounted via NFS on my Linux laptop. I did this with zero trouble when I was running CentOS, but I've had no luck at all on FreeBSD and I'm hoping someone can point out what I'm doing wrong. I *think* it's because /etc/exports is formatted differently on FreeBSD and there aren't many clear sample files available online for me to adapt. But it could be something else entirely.

my /etc/exports:
Code:
/data/shared -rw
/data/autoadd -rw -network 192.168.0/24
/data/misc -ro
/data -network 192.168.1.0 -mask 255.255.240.0

I've got four lines in here right now, mostly just because I was trying different formats and hoping one of them would work. All I really need is to be able to mount one of these directories as rw on a remote system via nfs. Restricting to specific IPs or subnets would be nice, but not as important as just mounting successfully at all. All directories in the exports file have permissions of 0775. There is no firewall active on the server, and when attempting to mount the nfs share on the remote system it times out. /var/log/messages says 'bad exports list line' for each entry when starting server. nfsd is running.

So, what do I need to do differently here? Do I need to provide any further information that I missed?
 
Remove the -rw, it's always read/write unless you specify it's read-only, -network also requires a -netmask, the CIDR notation cannot be used. See exports(5) (don't use the Linux man page, the syntax is different).

There is no firewall active on the server, and when attempting to mount the nfs share on the remote system it times out.
Time-outs indicate a firewall and/or routing issue.
 
Still not working after changing. Here's what I've done, plus any relevant information I can think of. Server is FreeBSD 11.0 hostname nightmaremoon, remote is Slackware Linux 14.2 laptop, hostname trixie.

First, I misspoke about there being no firewall, but it is set to open and so AFAIK it should not be interfering with this:
Code:
root@nightmaremoon:~ # grep firewall /etc/rc.conf
firewall_enable="YES"
firewall_type="open"
root@nightmaremoon:~ #

My /etc/exports is now just this:
Code:
root@nightmaremoon:~ # cat /etc/exports
/data/shared
root@nightmaremoon:~ #

Local permissions on /data/shared are:
Code:
root@nightmaremoon:~ # ls -ld /data
drwxr-xr-x  6 root  wheel  6 Oct 17 02:10 /data
root@nightmaremoon:~ # ls -ld /data/shared
drwxr-xr-x  5 puppyboy  puppyboy  7 Oct 16 23:47 /data/shared

After changing the exports I restarted the relevant services on the nfs server (I think these are all that matter?):
Code:
root@nightmaremoon:~ # service nfsd restart
Stopping nfsd.
Waiting for PIDS: 34000 34001.
Starting nfsd.
root@nightmaremoon:~ # service rpcbind restart
Stopping rpcbind.
Waiting for PIDS: 34033.
Starting rpcbind.
root@nightmaremoon:~ # service nfsuserd restart
Stopping nfsuserd.
Waiting for PIDS: 34118 34119 34120 34121 34122.
Starting nfsuserd.

And on the remote system I tried mounting with several different options with no success:
Code:
root@trixie:/mnt# mount -o nolock,vers=4 nightmaremoon:/data/shared /mnt/nfs0
mount.nfs: access denied by server while mounting nightmaremoon:/data/shared
root@trixie:/mnt# mount -o nolock nightmaremoon:/data/shared /mnt/nfs0
mount.nfs: requested NFS version or transport protocol is not supported
root@trixie:/mnt# mount -o nolock,vers=4 nightmaremoon:/data/shared /mnt/nfs0
mount.nfs: access denied by server while mounting nightmaremoon:/data/shared
root@trixie:/mnt# mount -o vers=4 nightmaremoon:/data/shared /mnt/nfs0
mount.nfs: access denied by server while mounting nightmaremoon:/data/shared

I believe everything I've done is correct, and I've looked all through the nfs section of the handbook and I've seen nothing that looks like it might help. I've overlooked something certainly, but I can't figure out what.
 
You're trying to use NFSv4 on the client but the export is NFSv3.

Besides that, there are some tools you can use to investigate. rpcinfo <hostname>; Check if NFS is properly registered and accessible through RPC. showmount -e <hostname>; See which exports are available.
 
Okay sorry for the long delay but I only just got home from work. So this is getting a little deeper than I'm ordinarily able to go so excuse me if I make any obvious mistakes or misinterpretations.

I changed my exports to V4: /data/shared which is what looks to be the correct format. Restarting everything gives the same result.

Running rpcinfo shows the following:
Code:
root@nightmaremoon:~ # rpcinfo -p
   program vers proto   port  service
    100000    4   tcp    111  rpcbind
    100000    3   tcp    111  rpcbind
    100000    2   tcp    111  rpcbind
    100000    4   udp    111  rpcbind
    100000    3   udp    111  rpcbind
    100000    2   udp    111  rpcbind
    100000    4 local    111  rpcbind
    100000    3 local    111  rpcbind
    100000    2 local    111  rpcbind
    100024    1   udp    971  status
    100024    1   tcp    971  status
    100003    2   udp   2049  nfs
    100003    3   udp   2049  nfs
    100003    2   tcp   2049  nfs
    100003    3   tcp   2049  nfs

What I gather from that is that NFS is running, but not NFSv4?

Running showmount -e nightmaremoon and showmount -a shows the following:
Code:
root@nightmaremoon:~ # showmount -a
RPC: Program not registered
showmount: can't do mountdump rpc
root@nightmaremoon:~ # showmount -e nightmaremoon
RPC: Unknown host
showmount: can't do exports rpc

On the one hand, I'm wondering if the problem might be that NFSv4 isn't running and my laptop just can't mount an NFSv3 mount (as implied by the
mount.nfs: requested NFS version or transport protocol is not supported message above, I'm right now trying to work out if this is in fact the case). But on the other hand, the showmount output also looks problematic. I'm not sure what to do about that one - I've googled and found nothing in stone about doing this. Unfortunately I'm not really clear on what I'm seeing with all this.
 
Edit: nfsd is what you're using, not mountd.

Based on your error messages this is likely not to be very useful, but while you wait for SirDice or someone else to provide further input, have you already tried telnet-ing from the Linux box to the BSD box (to rule out firewall / network config issues)?
 
Order is quite important, rpcbind(8) needs to run (or be restarted) first, then comes nfsd(8). If you happen to do it the other way around NFS won't be registered with RPC. On a good working NFS server you'd see this:
Code:
dice@molly:~ % rpcinfo -p
   program vers proto   port  service
    100000    4   tcp    111  rpcbind
    100000    3   tcp    111  rpcbind
    100000    2   tcp    111  rpcbind
    100000    4   udp    111  rpcbind
    100000    3   udp    111  rpcbind
    100000    2   udp    111  rpcbind
    100000    4 local    111  rpcbind
    100000    3 local    111  rpcbind
    100000    2 local    111  rpcbind
    100005    1   udp    916  mountd
    100005    3   udp    916  mountd
    100005    1   tcp    916  mountd
    100005    3   tcp    916  mountd
    100003    2   tcp   2049  nfs
    100003    3   tcp   2049  nfs
    100024    1   udp    825  status
    100024    1   tcp    825  status
    100021    0   udp    737  nlockmgr
    100021    0   tcp    769  nlockmgr
    100021    1   udp    737  nlockmgr
    100021    1   tcp    769  nlockmgr
    100021    3   udp    737  nlockmgr
    100021    3   tcp    769  nlockmgr
    100021    4   udp    737  nlockmgr
    100021    4   tcp    769  nlockmgr
Code:
dice@molly:~ % showmount -e
Exports list on localhost:
/storage/media                     192.168.10.0
 
Here's what I have for rc.conf:

Code:
#
# NFS
#
nfs_server_enable="YES"          # This host is an NFS server (or NO).
#nfs_server_flags="-u -t"        # Flags to nfsd (if enabled).
mountd_enable="YES"              # Run mountd (or NO).
#mountd_flags="-r"               # Flags to mountd (if NFS server enabled).
nfsv4_server_enable="NO"        # Enable support for NFSv4
nfscbd_enable="NO"              # NFSv4 client side callback daemon
nfscbd_flags=""                 # Flags for nfscbd
nfsuserd_enable="NO"            # NFSv4 user/group name mapping daemon
nfsuserd_flags=""               # Flags for nfsuserd

That is all pulled from /etc/defaults/rc.conf and changed as needed. Note that v4 is disabled by default.

On the Linux Client side, do you have a vers=3 for OPTIONS in the /etc/fstab?
 
Order is quite important, rpcbind(8) needs to run (or be restarted) first, then comes nfsd(8). If you happen to do it the other way around NFS won't be registered with RPC.

This may have been the problem. I started by restarting rpcbind, then restarted nfsd. Tried showmount -e which gave the 'program not registered' error again. Then I restarted nfsuserd just in case, and got the same error. Then I restarted mountd, and now I'm getting:
Code:
root@nightmaremoon:~ # showmount -e
Exports list on localhost:
/data/shared                       Everyone

I'm out of town til tomorrow Thursday morning and won't be able to actually test it until then, but I am optimistic now. I'll report back as soon as I've had a chance to test it.
 
Well I am thrilled to say that, at long last, I have a working nfs mount. Now that I've identified the problem, I can start adding the options I need. Thanks for your help, SirDice and everyone else.

On this note, is there a mailing list or subforum or something where I can suggest changes to the handbook? I just doublechecked and I don't see anything suggesting that the order in which you start or restart daemons is relevant, and I think this is sort of an important thing that should be mentioned somewhere.
 
Back
Top