1

I have a fresh install of Centos 7. I cannot seem to auto mount an NFS share located on 192.168.254.105:/srv/nfsshare from the Centos client.

Mounting the share manually however, works perfectly.

/etc/auto.master has been commented out completely to simplify the problem, save for the following line:

/-       /etc/auto.nfsshare 

/etc/auto.nfsshare holds the following line:

/tests/nfsshare       -fstype=nfs,credentials=/etc/credentials.txt    192.168.254.105:/srv/nfsshare

/etc/credentials.txt holds:

 user=user
 password=password

The expected behavior is that when I ls -l /tests/nfsshare, I will see a few files that my fileserver's /srv/nfsshare directory holds.

It does not. Instead, it shows nothing.

The logs from sudo journalctl --unit=autofs.service shows this when it starts (debug enabled):

 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.

The following appears in my logs when I attempt to force mounting of the nfs share via ls -l /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 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 -> -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

Additionally, ls -l /tests/nfsshare actually produces the error:

 ls: cannot access nfsshare/: No such file or directory

How can I fix this issue? As stated before, manual mounting the share works fine.


EDIT: as requested, output of ls -la /etc/auto.nfsshare

-rw-r--r--. 1 root root 99 Nov 20 00:25 /etc/auto.nfsshare
  • could you please show us the output of "ls -la /etc/auto.nfsshare"? – Rui F Ribeiro Nov 19 '15 at 20:54
  • @RuiFRibeiro output appended! – steelmonkey Nov 19 '15 at 21:03
  • seems ok. How about adding "rpcbind: 192.168.254.105" in /etc/hosts.allow does it solve it? – Rui F Ribeiro Nov 19 '15 at 21:10
  • @RuiFRibeiro added your text to /etc/hosts.allow. set selinux to permissive, stopped firewalld via systemctl. still nothing. – steelmonkey Nov 20 '15 at 2:54
  • What is the version of NFS by default on both sides? – Rui F Ribeiro Nov 20 '15 at 7:59
0

I had the same problem.

Configuration is fine, but directory does not exist, although is seems created.

The solution in my particular case was that the file was an UTF-8 file, which autofs cannot read (that's why you get the Blob message in the logging).

Recreate the file, and make sure it is an ascii file. After I changed that, everything worked flawlessly.

0

I haven't encoutered username/password protected NFS share so far.

Anyway, you can make good use of systemd features here (example for a basic NFS share you would want to mount in /tests/nfsshare).

192.168.254.105:/srv/nfsshare /tests/nfsshare   nfs users,_netdev,x-systemd.automount  0 0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.