mounting nfs fails: Permission denied / Bad file descriptor

Hello!

I want to mount a directory from my host PC (11.4, 64 bit) to an embedded board. The host setup:


# cat /etc/exports
/srv/nfs/3wm/   *(fsid=0,crossmnt,rw,no_root_squash,no_subtree_check)

# showmount -e 10.100.100.12
Export list for 10.100.100.12:
/srv/nfs/3wm *

# rpcinfo -p 10.100.100.12 
   program vers proto   port  service
    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
    100005    1   udp  44488  mountd
    100005    1   tcp  57396  mountd
    100005    2   udp  35924  mountd
    100005    2   tcp  52910  mountd
    100005    3   udp  51770  mountd
    100005    3   tcp  46954  mountd
    100024    1   udp  39122  status
    100024    1   tcp  45728  status
    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  39339  nlockmgr
    100021    3   udp  39339  nlockmgr
    100021    4   udp  39339  nlockmgr
    100021    1   tcp  39486  nlockmgr
    100021    3   tcp  39486  nlockmgr
    100021    4   tcp  39486  nlockmgr

# ll /srv/nfs/ | grep wm
drwxr-xr-x 18 root root 4096 Apr 23 17:17 3wm

# iptables -nvL
Chain INPUT (policy ACCEPT 9087 packets, 5308K bytes)
 pkts bytes target     prot opt in     out     source               destination         

Chain FORWARD (policy ACCEPT 0 packets, 0 bytes)
 pkts bytes target     prot opt in     out     source               destination         

Chain OUTPUT (policy ACCEPT 4107 packets, 517K bytes)
 pkts bytes target     prot opt in     out     source               destination

# cat /proc/fs/nfs/exports
# Version 1.1
# Path Client(Flags) # IPs

# cat /var/lib/nfs/xtab

(no output)

On the client I’d doing:


# mount -t nfs 10.100.100.12:/3wm storage
mount: 10.100.100.12:/3wm failed, reason given by server: Permission denied
mount: mounting 10.100.100.12:/3wm on storage failed: Bad file descriptor

I executed “exportfs -ra” on the host. But no change: /proc/fs/nfs/exports remains empty and the client reports the same error. For this problem for a lot of checklists and forum posts can be found in the 'net but so far I haven’t found the root cause of my problem. Has anyone an idea to share?

Best,
Andreas

On 2012-04-24 16:26, AKS42 wrote:
> problem. Has anyone an idea to share?

The first thing I do, is trying to import the share in the server itself.


Cheers / Saludos,

Carlos E. R.
(from 11.4 x86_64 “Celadon” at Telcontar)

Good idea. It reports the same error. By playing a bit more with it I got it work on my host:


sudo mount -t nfs 10.100.100.12:/srv/nfs/3wm mount-test

Now I see:


# cat /proc/fs/nfs/exports
# Version 1.1
# Path Client(Flags) # IPs
/srv/nfs/3wm    *(rw,no_root_squash,sync,wdelay,crossmnt,no_subtree_check,fsid=0,uuid=f397f4ab:78b44811:8e0a7757:c5b9141d)

I’m somewhat certain that I tried that on my embedded board as well. And I cannot explain why it /proc/fs/nfs/exports now has the share. The machine was not rebooted and the service was not restarted manually since my experiments yesterday.

I cannot try this on my embedded board now since it is in a bad state but I’ll report back here as soon as I can test.

Thank you for your answer!

Andreas

For the record: It works now also from my embedded box when I pass the mount args ‘-o port=2049,nolock,proto=tcp’ as well.

Rebooted the machine and the problem is back. I don’t seem to be the only one with this problem:
Patri’s Peripatetic Peregrinations - nfs troubleshooting

So I tried:


# echo A ; cat /proc/fs/nfs/exports ; echo B ; mount -t nfs 10.100.100.12:/srv/nfs/3wm /mnt ; echo C ; cat /proc/fs/nfs/exports ; echo D
A
# Version 1.1
# Path Client(Flags) # IPs
B
C
# Version 1.1
# Path Client(Flags) # IPs
/srv/nfs/3wm    *(rw,no_root_squash,sync,wdelay,crossmnt,no_subtree_check,fsid=0,uuid=f397f4ab:78b44811:8e0a7757:c5b9141d)
D

Therefore my problem was hidden by mounting the nfs share on my host. It was not just a test, it really changed my host.

The blog also mentions DNS problems. This may also be involved here since the IP address of the embedded box has no assigned DNS address.