Mounting network shares with autofs (alternative to fstab)

If you have done the config as I posed you would run
ls -lah /mnt/192.168.1.9/Movies

Apologies was in a bit of a rush ahah…

osmc@osmc:~$ ls -lah /mnt/192.168.1.9/Movies
ls: cannot open directory '/mnt/192.168.1.9/Movies': Permission denied

osmc@osmc:~$ ls -lah /mnt/192.168.1.9/volume2/Movies
ls: cannot access '/mnt/192.168.1.9/volume2/Movies': No such file or directory

Did you restart autofs after making the changes?

sudo systemctl restart autofs
  1. Share your current config paste-log /etc/auto.nfs.shares
  2. Next step would be to try the debugging from the first post
sudo systemctl stop autofs
sudo automount -f -v -d

Yep, restarted :slight_smile:
nfs config: https://paste.osmc.tv/kihovupexo

ok soo ah the results of running: (It went on forever, so I only included the beginning and end, complete gibberish to me ahha)
sudo systemctl stop autofs
sudo automount -f -v -d

osmc@osmc:~$ sudo automount -f -v -d
Starting automounter version 5.1.2, master map /etc/auto.master
using kernel protocol version 5.02
lookup_nss_read_master: reading master file /etc/auto.master
do_init: parse(sun): init gathered global options: (null)
lookup_read_master: lookup(file): read entry +auto.master
lookup_nss_read_master: reading master files auto.master
do_init: parse(sun): init gathered global options: (null)
lookup(file): failed to read included master map auto.master
lookup_read_master: lookup(file): read entry /-
master_do_mount: mounting /-
automount_path_to_fifo: fifo name /var/run/autofs.fifo--
lookup_nss_read_map: reading map file /etc/auto.nfs.shares
do_init: parse(sun): init gathered global options: (null)
mounted direct on /mnt/192.168.1.9/TV-Shows with timeout 15, freq 4 seconds
do_mount_autofs_direct: mounted trigger /mnt/192.168.1.9/TV-Shows
mounted direct on /mnt/192.168.1.9/Movies with timeout 15, freq 4 seconds
do_mount_autofs_direct: mounted trigger /mnt/192.168.1.9/Movies
st_ready: st_ready(): state = 0 path /-
st_expire: state 1 path /-
expire_proc: exp_proc = 4096783440 path /-
expire_cleanup: got thid 4096783440 path /- stat 0
expire_cleanup: sigchld: exp 4096783440 finished, switching from 2 to 1
st_ready: st_ready(): state = 2 path /-
st_expire: state 1 path /-
expire_proc: exp_proc = 4096783440 path /-
expire_cleanup: got thid 4096783440 path /- stat 0
expire_cleanup: sigchld: exp 4096783440 finished, switching from 2 to 1
st_ready: st_ready(): state = 2 path /-
st_expire: state 1 path /-
expire_proc: exp_proc = 4096783440 path /-
expire_cleanup: got thid 4096783440 path /- stat 0
expire_cleanup: sigchld: exp 4096783440 finished, switching from 2 to 1
st_ready: st_ready(): state = 2 path /-
st_expire: state 1 path /-

expire_proc: exp_proc = 4096783440 path /-
expire_cleanup: got thid 4096783440 path /- stat 0
expire_cleanup: sigchld: exp 4096783440 finished, switching from 2 to 1
st_ready: st_ready(): state = 2 path /-
^Cdo_notify_state: signal 2
master_notify_state_change: sig 2 switching /- from 1 to 5
st_prepare_shutdown: state 1 path /-
expire_proc: exp_proc = 4096783440 path /-
expire_cleanup: got thid 4096783440 path /- stat 0
expire_cleanup: sigchld: exp 4096783440 finished, switching from 5 to 7
st_shutdown: state 5 path /-
umount_multi: path /mnt/192.168.1.9/TV-Shows incl 0
set_direct_mount_catatonic: set /mnt/192.168.1.9/TV-Shows catatonic
umounted direct mount /mnt/192.168.1.9/TV-Shows
umount_multi: path /mnt/192.168.1.9/Movies incl 0
set_direct_mount_catatonic: set /mnt/192.168.1.9/Movies catatonic
umounted direct mount /mnt/192.168.1.9/Movies
automount_path_to_fifo: fifo name /var/run/autofs.fifo--
shut down path /-
autofs stopped

So did you run ls -lah /mnt/192.168.1.9/Movies in another window? And was the output again Permission denied?
If so can you plese do
sudo ls -lah /mnt/
sudo ls -lah /mnt/192.168.1.9/
sudo ls -lah /mnt/192.168.1.9/Movies

Also how have you configured the NFS shares on the Synology?

ohhh ahah opps… sorry I didn’t do it in a new window.

Running in a new window while the other one is open as per the OP, returned:

osmc@osmc:~$ ls -lah /mnt/192.168.1.9/Movies
    total 12K
    dr-xr-xr-x 3 root root 4.0K Nov 10 11:51 .
    dr-xr-xr-x 4 root root 4.0K Apr  8 20:06 ..
    dr-xr-xr-x 2 root root 4.0K Nov 10 11:56 MOVIES
    osmc@osmc:~$ ls -lah /mnt/192.168.1.9/TV-Shows
    total 8.0K
    dr-xr-xr-x 2 root root 4.0K Apr  8 20:06 .
    dr-xr-xr-x 4 root root 4.0K Apr  8 20:06 ..
    osmc@osmc:~$

Ahh ok, right well now we’re getting somewhere. The folders came up in the Kodi rootfile system, mnt folder.
I was able to add each mnt into the database, however, the folders were all empty…

Ahh I have created a user for the required shares: “movies” this user has both R&W access to the shares. Additionally an NFS permission has been created for Kodi as a client. NFS rule as follows:
Hostname or IP: 192.168.1.100
Privilege: R/W
Squash: No mapping
Security: AUTH_SYS
Enable asynchronous = Yes
Allow users to access mounted subfolders = Yes

The folder structure for the share: “TV-Shows”, has two subfolders to get to the shows.
And the folder structure for the share: "Movies, also has two subfolders before the start of the movies.

Hope the above may be of any help. :slight_smile:

Not a Synology expert, but unless you have osmc user with same ID on the NAS you most likely need to enable squash to admin

Also what does ls -lah /mnt/192.168.1.9/Movies/MOVIES now show?

1 Like

Well, I don’t quite believe it, it’s all up and running & so much faster!! :slight_smile:
Added a NFS user “osmc” and gave user root admin rights, it seems such a simple thing. ahah.
Thanks again for all your help & patience @fzinken! :slight_smile:

Might be worth mentioning that when using a .smbcredentials file, it helps to keep the username/password characters to simple characters, avoiding ones such as ’ ’ (space), ‘@’, ‘#’ or ‘.’ characters (particularly in the username).

So you tried it and it worked with simple characters? Or was it the space in username?
I can do some testing if I know which worked and which not.

Well, just tried it now with a simple username/password combo and it still does not work with the .smbcrentials file. Here’s the details, using a Windows account called ‘osmc’, with password ‘osmcosmc’ -

/etc/auto.smb.shares

/mnt/nuputer10/osmc_test_1 -fstype=cifs,rw,credentials=/home/osmc/.smbcredentials,iocharset=utf8,uid=osmc,gid=osmc,vers=3.0 ://192.168.1.100/#flacs
/mnt/nuputer10/osmc_test_2 -fstype=cifs,rw,username=osmc,password=osmcosmc,iocharset=utf8,uid=osmc,gid=osmc,vers=3.0 ://192.168.1.100/#flacs

.smbcredentials

osmc@osmc:~$ cat .smbcredentials
username=osmc
password=osmcosmc

ls -alh of both mounts -
with .smbcredentials

osmc@osmc:~$ ls -alh /mnt/nuputer10/osmc_test_1
ls: cannot open directory '/mnt/nuputer10/osmc_test_1': No such file or directory
credentials mnt spec 
osmc@osmc:~$ ls -alh /mnt/nuputer10/osmc_test_2
total 324K
dr-xr-xr-x 2 osmc osmc    0 Oct 22  2020 '#Various [FLAC 5.1 24-44.1] Surround Mixes by Sean Herbeck'
drwxr-xr-x 2 osmc osmc 320K Aug 26 19:42  .
dr-xr-xr-x 8 root root 4.0K Aug 28 12:18  ..
drwxr-xr-x 2 osmc osmc    0 Aug 26 19:46 '1 Test'
drwxr-xr-x 2 osmc osmc    0 Oct 21  2020  10cc
drwxr-xr-x 2 osmc osmc    0 Oct 21  2020 '1996 - Richard D. James Album (62010-2)'
drwxr-xr-x 2 osmc osmc    0 Oct 21  2020 '2xHD - Audiophile Hi-Res System Test - Great Sampling Tracks Included (2016) [24-192]'
drwxr-xr-x 2 osmc osmc    0 Oct 21  2020 '3.2 - The Rules Have Changed (2018) WEB-FLAC'
drwxr-xr-x 2 osmc osmc    0 Oct 21  2020  AC_DC_-_Back_In_Black-2003
drwxr-xr-x 2 osmc osmc    0 Oct 21  2020  Ace
drwxr-xr-x 2 osmc osmc    0 Oct 21  2020 'Al Di Meola - Elegant Gypsy & More (Live) (2018) [24-48]'
drwxr-xr-x 2 osmc osmc    0 Oct 21  2020 'Al Di Meola - Elegant Gypsy (1977) [Japan 2001] (FLAC 24-88.2)'

i.e. .smbcredentials does not work for this simple case.

That is really odd what is ls -lah /home/osmc/.smbcredentials giving.

osmc@osmc:~$ ls -lah /home/osmc/.smbcredentials
-rwxr--r-- 1 osmc osmc 36 Aug 28 12:02 /home/osmc/.smbcredentials
osmc@osmc:~$
osmc@osmc:~$ cat /home/osmc/.smbcredentials
username=osmc
password=osmcosmc

Try chmod 600 /home/osmc/.smbcredentials

Also did you create the file on OSMC using an editor like nano or did you copy it from Windows?
Do you have a newline after the password?

chmod 600 made no difference on the existing file.

Yes, the file was (incorrectly) created in windows (as a .txt file & renamed) and written to the Vero4K using the SMB client add-on. (i.e. this was a Windows (CR LF) UTF-8 text file.)

Recreating it using the native nano editor solved the problem (i.e. this is now a UNIX(LF) UTF-8 text file)

Multiple newlines (LFs) after the password, when created using nano, had no effect and .smbcredentials was still usable.

Spaces in the username of the .smbcredentials file also don’t work. They cannot be forced by preceeding the space with the ‘\’ character (however this is possible when using them in the mount specification to autofs. )

fzinken - thanks for your help and patience, I’d recommend updating your ‘how to guide’ for autofs with these points.

Chris.

Thanks, I will first add the reminder not to use Windows to create the file.
For the space in username I might want to do some more testing.

21 posts were split to a new topic: Issue to connect to NAS with autofs NFS/SMB

22 posts were split to a new topic: Cannot mount nfs shares with autofs

Hope this thread is still alive. Returned to Vero 4K+ after a long hiatus. In setting up autofs with my Synology & QNAP NAS’es, I’m getting former to work, but not latter.

Followed instructions in the first post to mount SMB shares using autofs, and when I type in…

sudo nano /etc/auto.smb.shares

…I have…

/mnt/192.168.68.2/Videos1 -fstype=cifs,rw,username=admin,password=MyPW2022,iocharset=utf8,uid=osmc,gid=osmc ://192.168.68.2/Videos1
/mnt/192.168.68.2/Videos2 -fstype=cifs,rw,username=admin,password=MyPW2022,iocharset=utf8,uid=osmc,gid=osmc ://192.168.68.2/Videos2
/mnt/192.168.68.3/4Kmovies -fstype=cifs,rw,username=admin,password=MyPW2022,iocharset=utf8,uid=osmc,gid=osmc ://192.168.68.3/4Kmovies

Now, when I try to verify for my Synology (IP ending in 2), the shares are there. But, when I type command for my QNAP, I get this error:

osmc@osmc:~$ ls -lah /mnt/192.168.68.3/4Kmovies
ls: cannot access '/mnt/192.168.68.3/4Kmovies': No such file or directory

Any idea what could be happening?

Perhaps, the share name is wrong on the QNAP?

Have you seen the section “Testing the config” in Mounting network shares with autofs (alternative to fstab) ?