I have all of my video files on an autofs mount of an SMB share. A long-standing issue is that the server is set to go to sleep after ten minutes of inactivity to save power; this leaves Kodi with what looks like an empty local folder. (Kodi obviously has no way of knowing whether it’s a mounted folder or a genuinely local one as that distinction is only visible at OS level).
So, if I try to play something from the library when the server is asleep, Kodi reports that the file is no longer present, and asks if I should delete the library item. (Reasonable so far). However, if I say no, then wake up the server, then try to play the video again, it still doesn’t play; it’s as if, once autofs has checked for the presence of the remote share once, if it finds it isn’t there, it doesn’t bother to check again.
It’s possible to get the video to play if I restart autofs:
sudo systemctl restart autofs
After running that, if I try playing the video again, now it plays. But is there a way to configure autofs so that it actively checks for the presence of the remote share each time an application tries to access the mounted folder, instead of checking once and then giving up if it isn’t there the first time?
Here is my /etc/auto.master file:
#
# Sample auto.master file
# This is a 'master' automounter map and it has the following format:
# mount-point [map-type[,format]:]map [options]
# For details of the format look at auto.master(5).
#
#/misc /etc/auto.misc
#
# NOTE: mounts done from a hosts map will be mounted with the
# "nosuid" and "nodev" options unless the "suid" and "dev"
# options are explicitly given.
#
#/net -hosts
#
# Include /etc/auto.master.d/*.autofs
# The included files must conform to the format of this file.
#
+dir:/etc/auto.master.d
#
# Include central master map if it can be found using
# nsswitch sources.
#
# Note that if there are entries for /net or /misc (as
# above) in the included master map any keys that are the
# same will not be seen as the first read key seen takes
# precedence.
#
+auto.master
/- /etc/auto.smb.shares --timeout 15 browse
And here is /etc/auto.smb.shares (usernames and passwords redacted):
/mnt/smb/nicolas-pc/VideoE -fstype=cifs,rw,username=XXXXX,password=XXXXX,iocharset=utf8,uid=osmc,gid=osmc,vers=3.0 ://192.168.1.13/VideoE/
/mnt/smb/nicolas-pc/VideoF -fstype=cifs,rw,username=XXXXX,password=XXXXX,iocharset=utf8,uid=osmc,gid=osmc,vers=3.0 ://192.168.1.13/VideoF/
/mnt/smb/nicolas-pc/Interim -fstype=cifs,rw,username=XXXXX,password=XXXXX,iocharset=utf8,uid=osmc,gid=osmc,vers=3.0 ://192.168.1.13/Interim/
/mnt/smb/nicolas-pc/QBTE -fstype=cifs,rw,username=XXXXX,password=XXXX,iocharset=utf8,uid=osmc,gid=osmc,vers=3.0 ://192.168.1.13/QBTE/
/mnt/smb/nicolas-pc/QBTF -fstype=cifs,rw,username=XXXXX,password=XXXXX,iocharset=utf8,uid=osmc,gid=osmc,vers=3.0 ://192.168.1.13/QBTF/