1

I want to automount a nfs share whenever a user logs in to our Mac Minis. My original idea was to use the remote share as the place for the user's home directories, but due to being not able to mount the share, I'm just trying to get it mounted to an unrelated directory via autofs first.

My /etc/auto_master looks like this:

+auto_master
/net              -hosts -nobrowse,hidefromfinder,nosuid
/home             auto_home -nobrowse,hidefromfinder
/Network/Servers  -fstab
/-                -static
/-                auto_nfs -nobrowse,nosuid

My /etc/auto_nfs:

/home_tmp -fstype=nfs,vers=3,rw,resvport,tcp,soft,intr,rsize=8192,wsize=8192,noatime,timeo=900,retrans=3 192.168.0.2:/home_tmp 

The remote machine is running 4.9.11-1-ARCH x86_64 GNU/Linux and it's /etc/exports looks like

/home_tmp -nohide,sync,rw 192.168.0.0/26

and the share is also visible from the client:

$ showmount -e 192.168.0.2
Exports list on 192.168.0.2:
/home_tmp                           192.168.0.0/26

The machine trying to mount the nfs share is within the 192.168.0.0/26 subnet.

When I do a sudo mount -t nfs -o resvport,rw 192.168.0.2:/home_tmp /home_tmp, I can change into /home_tmp and see it's content. But when I try to change into this directory with automount, I get:

$ cd /home_tmp
-bash: cd: /home_tmp: No such file or directory

The system log shows:

automountd: MOUNT  REQUEST: name=/home_tmp [] map=auto_nfs opts=nobrowse,nosuid path=/home_tmp direct=1
automountd:   PUSH /etc/auto_nfs
automountd:   POP /etc/auto_nfs
automountd:   mapline:  -fstype=nfs,vers=3,rw,resvport,tcp,soft,intr,rsize=8192,wsize=8192,noatime,timeo=900,retrans=3 192.168.0.2:/home_tmp
automountd:   do_mount1:
automountd:   (nfs,nfs)   /home_tmp -vers=3,rw,resvport,tcp,soft,intr,rsize=8192,wsize=8192,noatime,timeo=900,retrans=3
automountd:               192.168.0.2:/home_tmp      penalty=0
automountd:   nfsmount: input:
automountd:       192.168.0.2[other]
automountd:       nfsmount: mount on /home_tmp vers=3,rw,resvport,tcp,soft,intr,rsize=8192,wsize=8192,noatime,timeo=900,retrans=3:
automountd:         192.168.0.2:/home_tmp
automountd:       ping: 192.168.0.2 request vers=3 min=3
automountd: pingnfs: 192.168.0.2: RPC: Timed out
automountd:       pingnfs FAIL: can't get nfs version
automountd: NFS server 192.168.0.2 not responding
automountd:       Couldn't mount 192.168.0.2:/home_tmp, err=2
automountd: MOUNT  REPLY  : status=2, AUTOFS_DONE
automountd: mount of /home_tmp failed: No such file or directory
automountd: MOUNT  REQUEST: name=/home_tmp [] map=auto_nfs opts=nobrowse,nosuid path=/home_tmp direct=1
automountd:   PUSH /etc/auto_nfs
automountd:   POP /etc/auto_nfs
automountd:   mapline:  -fstype=nfs,vers=3,rw,resvport,tcp,soft,intr,rsize=8192,wsize=8192,noatime,timeo=900,retrans=3 192.168.0.2:/home_tmp
automountd:   do_mount1:
automountd:   (nfs,nfs)   /home_tmp -vers=3,rw,resvport,tcp,soft,intr,rsize=8192,wsize=8192,noatime,timeo=900,retrans=3
automountd:               192.168.0.2:/home_tmp      penalty=0
automountd:   nfsmount: input:
automountd:       192.168.0.2[other]
automountd:       nfsmount: mount on /home_tmp vers=3,rw,resvport,tcp,soft,intr,rsize=8192,wsize=8192,noatime,timeo=900,retrans=3:
automountd:         192.168.0.2:/home_tmp
automountd:       Couldn't mount 192.168.0.2:/home_tmp, err=2
automountd: MOUNT  REPLY  : status=2, AUTOFS_DONE
automountd: automountd exited

I read somewhere that this RPC: Timed out error can be caused by the nfs-server being started before some other service, so I restarted the nfs-server, but without effect. Any advice welcome to solve this...

  • Please add the server system (e.g. Ubuntu 16.04.2 LTS Server 64bit) – klanomath Mar 10 '17 at 7:48
  • @klanomath I added the server's OS. Should this question better be on serverfault? – PVitt Mar 10 '17 at 8:58
  • The question fits in here. – klanomath Mar 10 '17 at 15:08
0

Your Arch Linux distribution probably contains an NFSv4 server. The NFSv4 server requires a base directory (e.g. /srv/nfs4).

Any additional share has to be a subdirectory (e.g. /srv/nfs4/home_tmp). So move the server-side /home_tmp to the base directory.

The file /etc/exports looks like this then:

/srv/nfsv4 192.168.0.0/26(rw,fsid=0,insecure,no_subtree_check,async)
/srv/nfsv4/home_tmp 192.168.0.0/26(rw,nohide,insecure,no_subtree_check,async)

(only tested with async but should also work with sync)

Reload the file with exportfs -arv on the server.

Your client-side file /etc/auto_nfs has to be changed also:

/home_tmp -fstype=nfs,vers=3,rw,resvport,tcp,soft,intr,rsize=8192,wsize=8192,noatime,timeo=900,retrans=3 192.168.0.2:/srv/nfsv4/home_tmp

Finally enter sudo automount -vc in the client's shell to "refresh" the mounted share.


To set up networked home directories for OS X users some directory integration is required or at least recommended (e.g. LDAP or AD). For Linux servers I've found a pretty old how-to: Automount OS X Home Directories Using OpenLDAP and Linux. I don't know if the approach still works well with newer macOS versions. An updated how-to would require a new question here or at Server Fault.

  • Thanks for this detailed answer, but it is not related to the NFS version, as I can mount the folder when I run the mount command manually. So the server side is fine. – PVitt Mar 13 '17 at 12:33
  • @PVitt You are right - I somehow missed the pingnfs FAIL in your system log excerpt... – klanomath Mar 13 '17 at 15:40
0

Turns out that this is a simple firewall issue. Fravadona's answer pointed me into the right direction. The IT department didn't know which port to open (111 was already open) and didn't have time to dig into it at the moment, so they extensively opened ports. They told me they will change firewalls in the near future and will have a detailed look when they are finished. I hope to remember to update the post here.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .