Automounting NFS with autofs

Hi, I've run into bit of a problem with mounting our NFS share with autofs.

I'm having issues configuring the client, its running FreeBSD 14.
The NFS server is running FreeBSD 13.1 and is serving several other clients successfully.

I have mounted the share using autofs with the following indirect map

Code:
# cat /etc/auto_master
#+auto_master
/home /etc/autofs/auto.home -nosuid,nfsv4,retrycnt=1

Code:
#cat /etc/autofs/auto.home
* nfs.example.org:/export/home/&

On the FreeBSD client I'm able to retrieve home directories on demand but if I try accessing a non existing home directory I dont get any "No such file or directory" error.
For example
Code:
cd /home/user
no error, able to list files etc.
Code:
cd /home/troll
no error, but stalls for a few seconds. attempting to touch a file in /home/troll results in an i/o error.

When I check /var/log/messages I see the following

Code:
Mar  5 14:33:49 client automountd[2352]: "mount -t nfs -o nosuid,nfsv4,automounted,retrycnt=1 nfs.example.org:/export/home/troll /home/troll/", pid 2353, terminated with exit status 1
Mar  5 14:33:49 client kernel: WARNING: autofs_trigger_one: request for /home/troll/ completed with error 5, pid 2348 (ls)

Note how it doesnt complain about cd /home/user
/home/troll does not exist on the NFS server.

If i try executing that command as root I get the following error.

Code:
root@client:~ # mount -t nfs -o nosuid,nfsv4,automounted,retrycnt=1 nfs.example.org:/export/home/troll /home/troll/
mount_nfs: nmount: /home/troll, Invalid fstype: Invalid argument

removing the nfsv4 option results in the following error

Code:
[tcp] nfs.example.org:/export/home/troll: No such file or directory

If i remove the nfsv4 flag from the auto_master mapping it starts using nfsv3 but the problem remains.

The exact same indirect mapping works on several other linux clients and one openbsd client.

The host NFS is configured as following

Code:
# NFS
nfs_server_enable="YES"
nfsv4_server_enable="YES"
mountd_enable="YES"

nfsuserd_enable="YES"
nfsuserd_flags="-domain example.org"

rpcbind_enable="YES"
rpc_lockd_enable="YES"
rpc_statd_enable="YES"

And the client is configured as following

Code:
hostid_enable="YES"

nfsuserd_enable="YES"
nfsuserd_flags="-domain example.org"
nfs_client_enable="YES"
nfscbd_enable="YES"

autofs_enable="YES"
autounmountd="YES"
automountd="YES"
automountd_flags="-i"


rpc_lockd_enable="YES"
rpc_statd_enable="YES"
rpcbind_enable="YES"

Am I forgetting something obvious perhaps?
 
Please keep in mind that 13.1 is end-of-life, 13.2 will soon be EoL too as 13.3 was recently released.
Thanks, I'll get to it.

Thought I'd add: If i enter
cd /home/user
and try changing directory to a folder that doesnt exist in the users home dir I do get the expected no such file or directory error and no message in /var/log/messages. I reckon this is expected as the /home/user directory is cached on the client after a successful mount.

Attempting cd /home/troll still doesnt give any error but does show up in /var/log/messages.
The NFS /export/home root contains about ~100 home directories totaling maybe 50GB
 
Got it working with amd(8) but then theres all the downsides of using amd. The home directories were actually closer to 1TB so cant mount them all and call it a day.
Anyone got some clues of how to figure out the cause of not getting any ENOENT error when mounting the NFS share with autofs/automount, I'm feeling kinda lost now. :confused:

edit:
I appear to have found the root cause, its discussed here https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=243551
So adding a special_users map might be needed that checks if the user exists using getent(1), there really should be a better and documented way of doing this.
Here is my attempt, now its instead giving me i/o error when trying to access a directory that doesnt exist on the NFS share but the directory doesnt linger atleast.
Bash:
#!/bin/sh

# Check if username exists
out=`getent passwd "$1"`
if [ -z "$out" ]; then
        exit 1
fi

echo "$1"
mount -t nfs -o intr,nosuid,nfsv4,noac,automounted,retrycnt=0 nfs.example.org:/export/home/$1 /usr/home/$1/

exit 0
 
Back
Top