Preventing autofs from Mounting Over Local Home Directory

autofsautomount

In a previous question, the original poster asks how to prevent autofs to mount over a local home directory:
How to prevent autofs from mounting over specific directories?
I am facing a similar situation, where I would have a local home directory on my workstation (running Arch Linux) and would like NFS onto my workstation without mounting over my local home directory. I tried to apply the solution for the previous question to my auto.master file:

$ cat /etc/autofs/auto.master
/home /-
+dir:/etc/autofs/auto.master.d
+auto.master

Starting the automounter fails:

% sudo systemctl status autofs.service  
● autofs.service - Automounts filesystems on demand
   Loaded: loaded (/usr/lib/systemd/system/autofs.service; enabled; vendor preset: disabled)
   Active: active (running) since Thu 2017-01-26 15:56:19 EST; 1s ago
  Process: 8760 ExecStart=/usr/bin/automount $OPTIONS --pid-file /run/autofs.pid (code=exited, status=0/SUCCESS)
 Main PID: 8762 (automount)
Tasks: 3 (limit: 7372)
   CGroup: /system.slice/autofs.service
       └─8762 /usr/bin/automount --verbose --pid-file /run/autofs.pid

Jan 26 15:56:19 <hostname> systemd[1]: Starting Automounts filesystems on demand...
Jan 26 15:56:19 <hostname> automount[8762]: Starting automounter version 5.1.2, master map auto.master
Jan 26 15:56:19 <hostname> automount[8762]: using kernel protocol version 5.02
Jan 26 15:56:19 <hostname> automount[8762]: file map /- not found
Jan 26 15:56:19 <hostname> automount[8762]: mount_autofs_indirect: failed to read map for /home
Jan 26 15:56:19 <hostname> automount[8762]: handle_mounts: mount of /home failed!
Jan 26 15:56:19 <hostname> automount[8762]: master_do_mount: failed to startup mount
Jan 26 15:56:19 <hostname> systemd[1]: Started Automounts filesystems on demand.
Jan 26 15:56:19 <hostname> automount[8762]: no mounts in table

Again, I am running Arch Linux with autofs version 5.1.2. Another work station in the office runs Ubuntu 16.04 (autofs v 5.1.1) and has the same auto.master file (except that any path /etc/autofs is replaced by /etc). Automounting works without failure on that workstation.

Right now, I do not even know what to google for, because whenever I google a combination of autofs, "/-", and other keywords, I find results for Direct Map Support, which does not seem to be what I need.

Any hints in the right direction, be it a solution for the issue, or the right keywords for google, are greatly appreciated!

Best Answer

I fairly randomly changed the order of entries in /etc/autofs/auto.master and now I can mount the NFS as desired. My /etc/autofs/auto.master now looks like this:

$ cat /etc/autofs/auto.master
/home   /-
+auto.master
+dir:/etc/autofs/auto.master.d
Related Topic