AutoFS not mounting exported NFS shares.

I cannot work out why the autofs/automount services will not load the exported shares from my Linux Server. I would really appreciate some help with this as it is all consuming.

HISTORY: I have a small home LAN with a main server connected to the router via ethernet. It has NFS server loaded and configured and i have been connecting to it for some years via an old (+10yrs) laptop that is also connected to the LAN via ethernet (wifi card now defunct). All good!

CURRENT: I have acquired another more modern laptop (DELL) and have loaded OS15.2 on it and am looking to configure it the same as the ‘old laptop’ so that I can replace it. However the DELL does NOT have a ethernet port so it is always connected via WiFi.

DELL CONFIG:
firewall


inactive

auto.master

/nfsmounts    /etc/auto.nfs    --timeout=10

auto.nfs

fs-SG600    -fstype=nfs,rw,nosuid,soft  192.168.19.101:/media/SG600

file permissions


-rw-r--r-- 1 root root 14356 May 17  2020 /etc/autofs.conf
-rw------- 1 root root   232 May 17  2020 /etc/autofs_ldap_auth.conf
-rw-r--r-- 1 root root    38 Feb 23 05:31 /etc/auto.master
-rw-r--r-- 1 root root   166 Feb 23 06:55 /etc/auto.nfs

autofs status


● autofs.service - Automounts filesystems on demand
   Loaded: loaded (/usr/lib/systemd/system/autofs.service; enabled; vendor preset: disabled)
   Active: active (running) since Tue 2021-02-23 06:57:27 AEDT; 7min ago
     Docs: man:automount(8)
           man:autofs(5)
  Process: 2415 ExecStart=/usr/sbin/automount $AUTOFS_OPTIONS -p /var/run/automount.pid (code=exited, status=0/SUCCESS)
 Main PID: 2417 (automount)
    Tasks: 4
   CGroup: /system.slice/autofs.service
           └─2417 /usr/sbin/automount -p /var/run/automount.pid


Feb 23 06:57:27 localhost.localdomain systemd[1]: Starting Automounts filesystems on demand...
Feb 23 06:57:27 localhost.localdomain systemd[1]: Started Automounts filesystems on demand.

mount point listing


ls -al /nfsmounts
total 4
drwxr-xr-x  2 root root    0 Feb 23 11:45 .
drwxr-xr-x 23 root root 4096 Feb 22 19:06 ..

fs-SG600 directory not created and exported listing not displayed!

TROUBLESHOOTING:

  1. Stopped the autofs service

sudo systemctl   stop   autofs

  1. In one terminal manually run automount

sudo automount -f -v

Starting automounter version 5.1.3, master map auto.master
using kernel protocol version 5.05
mounted indirect on /nfsmounts with timeout 10, freq 3 seconds

  1. In a second terminal ask for a directory listing of /nfsmounts.
    No directory created and no listing is shown!

There is no further information provided in the first terminal that is running automount to assist debugging.

Revisiting the ‘old laptop’ and the exported directories and their listings appear without issue.

And that is where i am stuck.

It must be something very simple but i am unable to discover it!!

Can somebody help me with this please?

Thanks.

It’s not clear whether there is a problem.

For me, “autofs” is working as expected.

However, I do see this:


% ls /nfsmounts
% 

That is, it shows empty output. The “/nfsmounts” directory is there, but with no content.

If I try harder:


% ls /nfsmounts/shared
acronis  D         iso      lost+found  nwr        stuff    unix-dar
Calibre  excludes  libvirt  Music       repostuff  torrent  ycr
% 

That’s a visibility issue. By default, an nfs directory is not browsable until it has been mounted. But it will mount on a request for a specific file/directory.

I’m not sure if that is what you are seeing, or if you have a different problem.

Yes, as Neil mentioned already auto-mounts are mounted only as they are accessed, so you need to check that explicitly eg

ls /nfsmounts/fs-SG600

aahhh … yes! Ordering the specific share (fs-SG600) does indeed return the listing .

However, on the ‘old laptop’ creating a shortcut to the root directory /nfsmounts/ under Places in Dolphin result in that directory appearing in the Address Bar of the Dolphin listings pane … and the listing pane itself shows the exported subdir fs-SG600 … clicking on it returns the file listing of that exported share, as expected.

But on the DELL, even though the /nfsmounts/ directory appears in the Address Bar of Dolphin the subdir does not appear in the listings pane … so for all intents and purposes there is no access to the NFS share/s … sure, i can edit the shortcut in the Dolphin Places to include the subdirectory fs-SG600 and that will work … but there are many exported NFS shares … surely i do not have to create a separate link for each ??? … as there is no need to on the ‘old laptop’, by merely pointing the Dolphin Places shortcut to the /nfsmounts/ directory all the shares that documented in the auto.nfs map file appear, waiting to be selected as needed ??

Could this disparity have anything to do with the delay in obtaining the LAN connection on the WiFi machine (DELL) … whereas the ‘old laptop’ is hard wired to the LAN???

Dolphin on ‘Old Laptop’




You can try adding the “browse” option to the mount definition (in your auto.nfs).

Not a session-related KDE setting with your old laptop?

https://docs.kde.org/trunk5/en/kde-workspace/kcontrol/kcmsmserver/index.html

A bit off-topic. May I suggest you look into systemd for your automount (not autofs) solution?
https://wiki.archlinux.org/index.php/fstab#Automount_with_systemd
I run it for some time already and it helped several other memebrs here on the forums that had either automount problems, or problem with NFS mounts not working correctly.

I e.g. have the following entry in /etc/fstab:

boven.henm.xs4all.nl:/home/wij  /home/wij  nfs  noauto,nofail,x-systemd.automount,x-systemd.mount-timeout=10,_netdev,x-systemd.idle-timeout=5min   0  0

You must of course adapt host and directories to your situation and can adapt other paramters (e.g the timing) to your need. We also came to the conclusion that the _netdev is not needed because already honoured by systemd in this situation by default.

@griadooss:

I’m using this in Bash scripts used to perform rsync backups to a NAS – the time taken to wake up the NAS and automount is less than a second – often about 60 ms …


#!/bin/bash

systemHostName=$(hostname --short)
effectiveUserID=$(whoami)

StartTime="$(/usr/bin/date +%T:%N)"

if  -d /mnt/NAS-xxx/NFS/$effectiveUserID/$systemHostName ]]
then

  EndTime="$(/usr/bin/date +%T:%N)"
  echo "Mounted NAS NFS $effectiveUserID $systemHostName"
  echo ""
  echo "Start Time = $StartTime"
  echo "End Time   = $EndTime"
  echo ""
  /usr/bin/findmnt

else

  echo ""
  echo "NFS NAS is not available"
  echo ""

fi

  • No, no – the time stamps and the “findmnt” are not in my scripts – this is only an investigative test script …

does not appear to be … as both have identical settings, viz:

http://files.zimpics.org/forum/suse/DesktopSessions.png

PERFECT!!!

Thank you, thanku … many thanks!!

You are welcome.

Hmmm …
Digging around for “Linux autofs versus systemd.mount” I stumbled across this: <automounting - Systemd automount vs autofs - Unix & Linux Stack Exchange.
And, this Red Hat discussion: <https://learn.redhat.com/t5/Platform-Linux/Automounting-using-systemd/td-p/5631&gt;.
[HR][/HR]It seems that –

  • Using “systemd.mount” rather than “autofs” – the inlined Linux automounter
    – is somewhat easier to configure.

Provided that, one accepts the constraints of pre-definition and hard-coding – systemd.mount is neither as flexible nor, as dynamic, as autofs

Yes, the syntax of the autofs configuration files isn’t easy and, it ain’t intuitive – for many people …
[HR][/HR]So, is a “How To/FAQ” topic on this subject needed?