title: Cannot automount NFS share on Centos 7
body: <p>I have a fresh install of Centos 7. I cannot seem to auto mount an NFS share located on <code>192.168.254.105:/srv/nfsshare</code> from the Centos client. </p>
  
  <p>Mounting the share manually however, works perfectly.</p>
  
  <p><strong>/etc/auto.master</strong> has been commented out completely to simplify the problem, save for the following line:</p>
  
  <pre><code>/-       /etc/auto.nfsshare 
  </code></pre>
  
  <p><strong>/etc/auto.nfsshare</strong>  holds the following line:</p>
  
  <pre><code>/tests/nfsshare       -fstype=nfs,credentials=/etc/credentials.txt    192.168.254.105:/srv/nfsshare
  </code></pre>
  
  <p><strong>/etc/credentials.txt</strong> holds:</p>
  
  <pre><code> user=user
   password=password
  </code></pre>
  
  <p>The expected behavior is that when I <code>ls -l /tests/nfsshare</code>, I will see a few files that my fileserver's <strong>/srv/nfsshare</strong> directory holds. </p>
  
  <p>It does not. Instead, it shows nothing.</p>
  
  <p>The logs from <strong>sudo journalctl --unit=autofs.service</strong> shows this when it starts (debug enabled):</p>
  
  <pre><code> Nov 20 00:25:38 localhost.localdomain systemd[1]: Starting Automounts filesystems on demand...
   Nov 20 00:25:38 localhost.localdomain automount[21204]: Starting automounter version 5.0.7-48.el7, master map auto.master
   Nov 20 00:25:38 localhost.localdomain automount[21204]: using kernel protocol version 5.02
   Nov 20 00:25:38 localhost.localdomain automount[21204]: lookup_nss_read_master: reading master files auto.master
   Nov 20 00:25:38 localhost.localdomain automount[21204]: parse_init: parse(sun): init gathered global options: (null)
   Nov 20 00:25:38 localhost.localdomain automount[21204]: spawn_mount: mtab link detected, passing -n to mount
   Nov 20 00:25:38 localhost.localdomain automount[21204]: spawn_umount: mtab link detected, passing -n to mount
   Nov 20 00:25:38 localhost.localdomain automount[21204]: lookup_read_master: lookup(file): read entry /-
   Nov 20 00:25:38 localhost.localdomain automount[21204]: master_do_mount: mounting /-
   Nov 20 00:25:38 localhost.localdomain automount[21204]: automount_path_to_fifo: fifo name /run/autofs.fifo--
   Nov 20 00:25:38 localhost.localdomain automount[21204]: lookup_nss_read_map: reading map file /etc/auto.nfsshare
   Nov 20 00:25:38 localhost.localdomain automount[21204]: parse_init: parse(sun): init gathered global options: (null)
   Nov 20 00:25:38 localhost.localdomain automount[21204]: spawn_mount: mtab link detected, passing -n to mount
   Nov 20 00:25:38 localhost.localdomain automount[21204]: spawn_umount: mtab link detected, passing -n to mount
   Nov 20 00:25:38 localhost.localdomain automount[21204]: mounted direct on /tests/nfsshare with timeout 300, freq 75 seconds
   Nov 20 00:25:38 localhost.localdomain automount[21204]: do_mount_autofs_direct: mounted trigger /tests/nfsshare
   Nov 20 00:25:38 localhost.localdomain automount[21204]: st_ready: st_ready(): state = 0 path /-
   Nov 20 00:25:38 localhost.localdomain systemd[1]: Started Automounts filesystems on demand.
  </code></pre>
  
  <p>The following appears in my logs when I attempt to force mounting of the nfs share via <strong>ls -l /tests/nfsshare</strong>:</p>
  
  <pre><code> Nov 20 00:48:05 localhost.localdomain automount[22030]: handle_packet: type = 5
   Nov 20 00:48:05 localhost.localdomain automount[22030]: handle_packet_missing_direct: token 21, name /tests/nfsshare, request pid 22057
   Nov 20 00:48:05 localhost.localdomain automount[22030]: attempting to mount entry /tests/nfsshare
   Nov 20 00:48:05 localhost.localdomain automount[22030]: lookup_mount: lookup(file): looking up /tests/nfsshare
   Nov 20 00:48:05 localhost.localdomain automount[22030]: lookup_mount: lookup(file): /tests/nfsshare -&gt; -fstype=nfs,credentials=/etc/credenti...fsshare
   Nov 20 00:48:05 localhost.localdomain automount[22030]: parse_mount: parse(sun): expanded entry: -fstype=nfs,credentials=/etc/credentials.tx...fsshare
   Nov 20 00:48:05 localhost.localdomain automount[22030]: parse_mount: parse(sun): gathered options: fstype=nfs,credentials=/etc/credentials.txt  
   Nov 20 00:48:05 localhost.localdomain automount[22030]: [90B blob data]
   Nov 20 00:48:05 localhost.localdomain automount[22030]: dev_ioctl_send_fail: token = 21
   Nov 20 00:48:05 localhost.localdomain automount[22030]: failed to mount /tests/nfsshare
   Nov 20 00:48:05 localhost.localdomain automount[22030]: handle_packet:      type = 5
   Nov 20 00:48:05 localhost.localdomain automount[22030]: handle_packet_missing_direct: token 22, name /tests/nfsshare, request pid 22057
   Nov 20 00:48:05 localhost.localdomain automount[22030]: dev_ioctl_send_fail: token = 22
  </code></pre>
  
  <p>Additionally, <strong>ls -l /tests/nfsshare</strong> actually produces the error:</p>
  
  <pre><code> ls: cannot access nfsshare/: No such file or directory
  </code></pre>
  
  <p>How can I fix this issue? As stated before, manual mounting the share works fine.</p>