Issue to connect to NAS with autofs NFS/SMB

Maybe I should start a new help topic?

I moved your posts to a new thread so we can get going here.

Let’s get this done.

  1. Install smbclient sudo apt-get install smbclient
  2. Post output of smbclient -L 192.168.1.2 -U username_on _nas

Unless you have SMBv1 enabled on your NAS and Kodi set to max SMBv1 then the browsing for the machine isn’t going to work (in a Linux Kodi install) and you need to tweak your method slightly. When you go to add videos>browse instead of clicking on “windows network SMB” instead click on “add network location”. In the server name box enter ONLY the IP address (or machine name) of your NAS and then put your credentials in the user/pass sections. Leave the shared folder section empty and when you click OK you should now see the NAS in the list of sources and you will be able to browse into it now.

THis works, thanks. I will also try to continue with the autofs as above.

osmc@osmc:~$ smbclient -L 192.168.1.2 -U mattsnas
Unable to initialize messaging context
Enter WORKGROUP\mattsnas’s password: (password was entered)

    Sharename       Type      Comment
    ---------       ----      -------
    share           Disk
    IPC$            IPC       IPC Service ()

Reconnecting with SMB1 for workgroup listing.
smbXcli_negprot_smb1_done: No compatible protocol selected by server.
protocol negotiation failed: NT_STATUS_INVALID_NETWORK_RESPONSE
Failed to connect with SMB1 – no workgroup available

This still with smb min/max: OSMC none/smb3, NAS SMB2/SMB3

Ok assuming you have included /etc/auto.smb.shares in your /etc/auto.master your config line in /etc/auto.smb.shares should look like this (assuming you have remove your /etc/auto.nfs.shares

/mnt/share -fstype=cifs,rw,username=mattsnas,password=<password>,iocharset=utf8,uid=osmc,gid=osmc ://192.168.1.2/share

And replace <password> with your actual password (later if all works you can change to use the credentials file.
Now sudo systemctl restart autofs and ls -lah /mnt/share

I have removed the NFS server related share thinggee added line from within auto.nfs.shares but I haven’t removed the actual file I dont think? (it is now empty of text).

Within the auto.master file, does it need the same thing as the NFS one with “–timeout 15 browse”?
Currently: /- /etc/auto.nfs.shares --timeout 15 browse
Update: OK I found out, yes.

Currently inside auto.smb.shares is no text.

After now adding the line in your reply to the auto.smb.shares file:

osmc@osmc:~$ sudo systemctl restart autofs
osmc@osmc:~$ ls -lah /mnt/share
ls: cannot open directory ‘/mnt/share’: No such file or directory
osmc@osmc:~$

osmc@osmc:~$ ls -lah /mnt/mattsnas/share
ls: cannot access ‘/mnt/mattsnas/share’: No such file or directory
osmc@osmc:~$

so in auto.master is: (removed comments)

+dir:/etc/auto.master.d

+auto.master

/- /etc/auto.smb.shares --timeout 15 browse

And inside auto.smb.shares is:
/mnt/share -fstype=cifs,rw,username=mattsnas,password=password,iocharset=utf8,uid=osmc,gid=osmc ://192.168.1.2/share

Correct password of course entered.

Then check out the troubleshooting part in the How To

sudo systemctl stop autofs
sudo automount -f -v -d

And run ls -lah /mnt/share from second SSH session. Then share the output that comes after 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 +dir:/etc/auto.master.d
lookup_nss_read_master: reading master dir /etc/auto.master.d
lookup_read_master: lookup(dir): scandir: /etc/auto.master.d
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.smb.shares
do_init: parse(sun): init gathered global options: (null)
mounted direct on /mnt/share with timeout 15, freq 4 seconds
do_mount_autofs_direct: mounted trigger /mnt/share
st_ready: st_ready(): state = 0 path /-
st_expire: state 1 path /-
expire_proc: exp_proc = 4099929152 path /-
expire_cleanup: got thid 4099929152 path /- stat 0
expire_cleanup: sigchld: exp 4099929152 finished, switching from 2 to 1
st_ready: st_ready(): state = 2 path /-
st_expire: state 1 path /-
expire_proc: exp_proc = 4099929152 path /-
expire_cleanup: got thid 4099929152 path /- stat 0
expire_cleanup: sigchld: exp 4099929152 finished, switching from 2 to 1
st_ready: st_ready(): state = 2 path /-
st_expire: state 1 path /-
expire_proc: exp_proc = 4099929152 path /-
expire_cleanup: got thid 4099929152 path /- stat 0
expire_cleanup: sigchld: exp 4099929152 finished, switching from 2 to 1
st_ready: st_ready(): state = 2 path /-
st_expire: state 1 path /-
expire_proc: exp_proc = 4099929152 path /-
expire_cleanup: got thid 4099929152 path /- stat 0
expire_cleanup: sigchld: exp 4099929152 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 = 4099929152 path /-
expire_cleanup: got thid 4099929152 path /- stat 0
expire_cleanup: sigchld: exp 4099929152 finished, switching from 5 to 7
st_shutdown: state 5 path /-
umount_multi: path /mnt/share incl 0
set_direct_mount_catatonic: set /mnt/share catatonic
umounted direct mount /mnt/share
automount_path_to_fifo: fifo name /var/run/autofs.fifo–
shut down path /-
autofs stopped

osmc@osmc:~$ ls -lah /mnt/share
ls: cannot access ‘/mnt/share’: No such file or directory
osmc@osmc:~$

Did you run the ls -lah /mnt/share in a second SSH window before you stopped autofs with ctrl-c?

I did this time!!

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 +dir:/etc/auto.master.d
lookup_nss_read_master: reading master dir /etc/auto.master.d
lookup_read_master: lookup(dir): scandir: /etc/auto.master.d
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.smb.shares
do_init: parse(sun): init gathered global options: (null)
mounted direct on /mnt/share with timeout 15, freq 4 seconds
do_mount_autofs_direct: mounted trigger /mnt/share
st_ready: st_ready(): state = 0 path /-
st_expire: state 1 path /-
expire_proc: exp_proc = 4104123456 path /-
expire_cleanup: got thid 4104123456 path /- stat 0
expire_cleanup: sigchld: exp 4104123456 finished, switching from 2 to 1
st_ready: st_ready(): state = 2 path /-
st_expire: state 1 path /-
expire_proc: exp_proc = 4104123456 path /-
expire_cleanup: got thid 4104123456 path /- stat 0
expire_cleanup: sigchld: exp 4104123456 finished, switching from 2 to 1
st_ready: st_ready(): state = 2 path /-
st_expire: state 1 path /-
expire_proc: exp_proc = 4104123456 path /-
expire_cleanup: got thid 4104123456 path /- stat 0
expire_cleanup: sigchld: exp 4104123456 finished, switching from 2 to 1
st_ready: st_ready(): state = 2 path /-
st_expire: state 1 path /-
expire_proc: exp_proc = 4104123456 path /-
expire_cleanup: got thid 4104123456 path /- stat 0
expire_cleanup: sigchld: exp 4104123456 finished, switching from 2 to 1
st_ready: st_ready(): state = 2 path /-
st_expire: state 1 path /-
expire_proc: exp_proc = 4104123456 path /-
expire_cleanup: got thid 4104123456 path /- stat 0
expire_cleanup: sigchld: exp 4104123456 finished, switching from 2 to 1
st_ready: st_ready(): state = 2 path /-
st_expire: state 1 path /-
expire_proc: exp_proc = 4104123456 path /-
expire_cleanup: got thid 4104123456 path /- stat 0
expire_cleanup: sigchld: exp 4104123456 finished, switching from 2 to 1
st_ready: st_ready(): state = 2 path /-
st_expire: state 1 path /-
expire_proc: exp_proc = 4104123456 path /-
expire_cleanup: got thid 4104123456 path /- stat 0
expire_cleanup: sigchld: exp 4104123456 finished, switching from 2 to 1
st_ready: st_ready(): state = 2 path /-
st_expire: state 1 path /-
expire_proc: exp_proc = 4104123456 path /-
expire_cleanup: got thid 4104123456 path /- stat 0
expire_cleanup: sigchld: exp 4104123456 finished, switching from 2 to 1
st_ready: st_ready(): state = 2 path /-
st_expire: state 1 path /-
expire_proc: exp_proc = 4104123456 path /-
expire_cleanup: got thid 4104123456 path /- stat 0
expire_cleanup: sigchld: exp 4104123456 finished, switching from 2 to 1
st_ready: st_ready(): state = 2 path /-
handle_packet: type = 5
handle_packet_missing_direct: token 1, name /mnt/share, request pid 3398
attempting to mount entry /mnt/share
lookup_mount: lookup(file): looking up /mnt/share
lookup_mount: lookup(file): /mnt/share → -fstype=cifs,rw,username=mattsnas,password=,iocharset=utf8,uid=osmc,gid=osmc ://192.168.1.2/share
parse_mount: parse(sun): expanded entry: -fstype=cifs,rw,username=mattsnas,password=,iocharset=utf8,uid=osmc,gid=osmc ://192.168.1.2/share
parse_mount: parse(sun): gathered options: fstype=cifs,rw,username=mattsnas,password=,iocharset=utf8,uid=osmc,gid=osmc
parse_mount: parse(sun): dequote(“://192.168.1.2/share”) → ://192.168.1.2/share
parse_mount: parse(sun): core of entry: options=fstype=cifs,rw,username=mattsnas,password=,iocharset=utf8,uid=osmc,gid=osmc, loc=://192.168.1.2/share
sun_mount: parse(sun): mounting root /mnt/share, mountpoint /mnt/share, what //192.168.1.2/share, fstype cifs, options rw,username=mattsnas,password=,iocharset=utf8,uid=osmc,gid=osmc
do_mount: //192.168.1.2/share /mnt/share type cifs options rw,username=mattsnas,password=,iocharset=utf8,uid=osmc,gid=osmc using module generic
mount_mount: mount(generic): calling mkdir_path /mnt/share
mount_mount: mount(generic): calling mount -t cifs -o rw,username=mattsnas,password=,iocharset=utf8,uid=osmc,gid=osmc //192.168.1.2/share /mnt/share

mount error(95): Operation not supported
Refer to the mount.cifs(8) manual page (e.g. man mount.cifs)
mount(generic): failed to mount //192.168.1.2/share (type cifs) on /mnt/share
dev_ioctl_send_fail: token = 1
failed to mount /mnt/share
st_expire: state 1 path /-
expire_proc: exp_proc = 4104123456 path /-
expire_cleanup: got thid 4104123456 path /- stat 0
expire_cleanup: sigchld: exp 4104123456 finished, switching from 2 to 1
st_ready: st_ready(): state = 2 path /-
st_expire: state 1 path /-
expire_proc: exp_proc = 4104123456 path /-
expire_cleanup: got thid 4104123456 path /- stat 0
expire_cleanup: sigchld: exp 4104123456 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 = 4104123456 path /-
expire_cleanup: got thid 4104123456 path /- stat 0
expire_cleanup: sigchld: exp 4104123456 finished, switching from 5 to 7
st_shutdown: state 5 path /-
umount_multi: path /mnt/share incl 0
set_direct_mount_catatonic: set /mnt/share catatonic
umounted direct mount /mnt/share
automount_path_to_fifo: fifo name /var/run/autofs.fifo–
shut down path /-
autofs stopped

I assume you changed password manually?

Let’s try it all manually without autofs

sudo mkdir /mnt/share
sudo mount -t cifs -o rw,username=mattsnas,password=,iocharset=utf8,uid=osmc,gid=osmc //192.168.1.2/share /mnt/share

if that gives an error let’s try lower SMB version
sudo mount -t cifs -o rw,username=mattsnas,password=,iocharset=utf8,uid=osmc,gid=osmc,vers=3.0 //192.168.1.2/share /mnt/share
if that not work
sudo mount -t cifs -o rw,username=mattsnas,password=,iocharset=utf8,uid=osmc,gid=osmc,vers=2.1 //192.168.1.2/share /mnt/share

always putting in the correct password.

It may be helpful if you could copy/paste the output of…

cat /etc/auto.master
cat /etc/auto.smb.shares
cat /etc/auto.nfs.shares

modifying it only to replace your credentials with the words USERNAME and PASSWORD. Also after you paste the text into a post select it all and press </> in the edit bar so it displays correctly. Sometimes we make typos that are hard to spot ourselves :grin:

Or create a temporary password that you change after we got this going.

Yes I changed “password” manually.

if that gives an error let’s try lower SMB version
sudo mount -t cifs -o rw,username=mattsnas,password=,iocharset=utf8,uid=osmc,gid=osmc,vers=3.0 //192.168.1.2/share /mnt/share

This worked, well no error anyway. (the second one on your list).

osmc@osmc:~$ cat /etc/auto.master
#
# 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
osmc@osmc:~$ cat /etc/auto.smb.shares
/mnt/share -fstype=cifs,rw,username=mattsnas,password=xxxxxxx,iocharset=utf8,uid=osmc,gid=osmc ://192.168.1.2/share
osmc@osmc:~$ cat /etc/auto.nfs.shares

osmc@osmc:~$