Issues with Win 10 Samba shares with autofs on Vero 4K+

I have been trying to replicate the solution given in Wiki to have shares mount automatically on demand. Unfortunately, while I’m comfortable with the command line on UNIX, I cannot get it to work using the prescribed method - I end up with:

osmc@osmc:~$ ls -lah /mnt/DESKTOP-UPI0R2F/Downloads
ls: cannot open directory ‘/mnt/DESKTOP-UPI0R2F/Downloads’: No such file or directory
The shares worked fine with the standard fstab, but I can’t get it to work using the instructions given with autofs. My config is as follows:

  • /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

  • /etc/auto.smb.shares>

/mnt/DESKTOP-UPI0R2F/Downloads -fstype=cifs,rw,credentials=/home/osmc/.smbcredentials,iocharset=utf8,uid=osmc,gid=osmc ://192.168.1.17/Downloads/

  • ~/.smbcredentials

username=MyWindowsUsername
password=MyWindowsPassword

  • the output I’m getting from 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(dir): dir map /etc/auto.master.d missing or not readable
lookup(file): failed to read included master map dir:/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/DESKTOP-UPI0R2F/Downloads with timeout 15, freq 4 seconds
do_mount_autofs_direct: mounted trigger /mnt/DESKTOP-UPI0R2F/Downloads
st_ready: st_ready(): state = 0 path /-
st_expire: state 1 path /-
expire_proc: exp_proc = 4102026320 path /-
expire_cleanup: got thid 4102026320 path /- stat 0
expire_cleanup: sigchld: exp 4102026320 finished, switching from 2 to 1
st_ready: st_ready(): state = 2 path /-
st_expire: state 1 path /-
expire_proc: exp_proc = 4102026320 path /-
expire_cleanup: got thid 4102026320 path /- stat 0
expire_cleanup: sigchld: exp 4102026320 finished, switching from 2 to 1
st_ready: st_ready(): state = 2 path /-

Anybody has any ideas what’s happening here?

Did you run `ls -lah /mnt/DESKTOP-UPI0R2F/Downloads/ while you had the autmount running? Because your automount output doesn’t show failed a mounting try.

Yes, the output you see on top of my post is what followed after

sudo systemctl restart autofs

Well you need to
sudo systemctl stop autofs
then
sudo automount -f -v -d
then in another window ls -lah /mnt/DESKTOP-UPI0R2F/Downloads/

Then you can show here the debug output.

Thank you, it makes sense. Here is what I got:

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(dir): dir map /etc/auto.master.d missing or not readable
lookup(file): failed to read included master map dir:/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/DESKTOP-UPI0R2F/Downloads with timeout 15, freq 4 seconds
do_mount_autofs_direct: mounted trigger /mnt/DESKTOP-UPI0R2F/Downloads
st_ready: st_ready(): state = 0 path /-
handle_packet: type = 5
handle_packet_missing_direct: token 6, name /mnt/DESKTOP-UPI0R2F/Downloads, request pid 5417
attempting to mount entry /mnt/DESKTOP-UPI0R2F/Downloads
lookup_mount: lookup(file): looking up /mnt/DESKTOP-UPI0R2F/Downloads
lookup_mount: lookup(file): /mnt/DESKTOP-UPI0R2F/Downloads -> -fstype=cifs,rw,credentials=/home/osmc/.smbcredentials,iocharset=utf8,uid=osmc,gid=osmc ://192.168.1.17/Downloads/
parse_mount: parse(sun): expanded entry: -fstype=cifs,rw,credentials=/home/osmc/.smbcredentials,iocharset=utf8,uid=osmc,gid=osmc ://192.168.1.17/Downloads/
parse_mount: parse(sun): gathered options: fstype=cifs,rw,credentials=/home/osmc/.smbcredentials,iocharset=utf8,uid=osmc,gid=osmc
parse_mount: parse(sun): dequote("://192.168.1.17/Downloads/") -> ://192.168.1.17/Downloads/
parse_mount: parse(sun): core of entry: options=fstype=cifs,rw,credentials=/home/osmc/.smbcredentials,iocharset=utf8,uid=osmc,gid=osmc, loc=://192.168.1.17/Downloads/
sun_mount: parse(sun): mounting root /mnt/DESKTOP-UPI0R2F/Downloads, mountpoint /mnt/DESKTOP-UPI0R2F/Downloads, what //192.168.1.17/Downloads/, fstype cifs, options rw,credentials=/home/osmc/.smbcredentials,iocharset=utf8,uid=osmc,gid=osmc
do_mount: //192.168.1.17/Downloads/ /mnt/DESKTOP-UPI0R2F/Downloads type cifs options rw,credentials=/home/osmc/.smbcredentials,iocharset=utf8,uid=osmc,gid=osmc using module generic
mount_mount: mount(generic): calling mkdir_path /mnt/DESKTOP-UPI0R2F/Downloads
mount_mount: mount(generic): calling mount -t cifs -o rw,credentials=/home/osmc/.smbcredentials,iocharset=utf8,uid=osmc,gid=osmc //192.168.1.17/Downloads/ /mnt/DESKTOP-UPI0R2F/Downloads

mount error(112): Host is down
Refer to the mount.cifs(8) manual page (e.g. man mount.cifs)
mount(generic): failed to mount //192.168.1.17/Downloads/ (type cifs) on /mnt/DESKTOP-UPI0R2F/Downloads
dev_ioctl_send_fail: token = 6
failed to mount /mnt/DESKTOP-UPI0R2F/Downloads
st_expire: state 1 path /-
expire_proc: exp_proc = 4102472784 path /-
expire_cleanup: got thid 4102472784 path /- stat 0
expire_cleanup: sigchld: exp 4102472784 finished, switching from 2 to 1
st_ready: st_ready(): state = 2 path /-
st_expire: state 1 path /-
expire_proc: exp_proc = 4102472784 path /-
expire_cleanup: got thid 4102472784 path /- stat 0
expire_cleanup: sigchld: exp 4102472784 finished, switching from 2 to 1
st_ready: st_ready(): state = 2 path /-

So is 192.168.1.17 reachable?
what does ping 192.168.1.17 give you from osmc

It’s reachable:

osmc@osmc:~$ ping 192.168.1.17
PING 192.168.1.17 (192.168.1.17): 56 data bytes
64 bytes from 192.168.1.17: seq=0 ttl=128 time=8.452 ms
64 bytes from 192.168.1.17: seq=1 ttl=128 time=2.830 ms
64 bytes from 192.168.1.17: seq=2 ttl=128 time=4.020 ms
64 bytes from 192.168.1.17: seq=3 ttl=128 time=2.414 ms

— 192.168.1.17 ping statistics —
4 packets transmitted, 4 packets received, 0% packet loss
round-trip min/avg/max = 2.414/4.429/8.452 ms

Might it be the Windows 10 Samba v.1 issue? If so, can I force autofs to use v.3?

vers=3.0 does that.
You also first can manually try
sudo mkdir -p /mnt/DESKTOP-UPI0R2F/Downloads
sudo mount -t cifs -o rw,mount -t cifs -o rw,vers=3.0,credentials=/home/osmc/.smbcredentials,iocharset=utf8,uid=osmc,gid=osmc //192.168.1.17/Downloads/ /mnt/DESKTOP-UPI0R2F/Downloads

If that works you can remove the directory and then start autofs
rmdir /mnt/DESKTOP-UPI0R2F/Downloads
rmdir /mnt/DESKTOP-UPI0R2F

I’m assuming that here:

you meant:
sudo mount -t cifs -o rw,vers=3.0,credentials=/home/osmc/.smbcredentials,iocharset=utf8,uid=osmc,gid=osmc //192.168.1.17/Downloads/ /mnt/DESKTOP-UPI0R2F/Downloads
Unfortunately, still no luck, but a different problem at least:

osmc@osmc:~$ sudo mount -t cifs -o rw,vers=3.0,credentials=/home/osmc/.smbcredentials,iocharset=utf8,uid=osmc,gid=osmc //192.168.1.17/Downloads/ /mnt/DESKTOP-UPI0R2F/Downloads
mount error(13): Permission denied
Refer to the mount.cifs(8) manual page (e.g. man mount.cifs)

OK, so I got this working now manually without the credentials file:

osmc@osmc:~$ sudo mount -t cifs -o rw,vers=3.0,username=MyWindowsUsername,password=MyWindowsPassword,iocharset=utf8,uid=osmc,gid=osmc //192.168.1.17/Downloads/ /mnt/DESKTOP-UPI0R2F/Downloads

What is ls -lah /home/osmc/.smbcredentials giving

Well you can then also try it in autofs with username/password instead of credential file. Security is technically similar

OK, the problem with the credentials file was a rougue space at the end of the username. The problem is solved, thank you very much @fzinken! Just to reiterate (and it may be worth adding to the Wiki entry): unless you want to downgrade your SMB protocol, you have to add an additional parameter to your /etc/auto.smb.shares, namely vers=3.0! So the whole line should be:

/mnt/<server1>/<share1> -fstype=cifs,rw,vers=3.0,credentials=/home/osmc/.smbcredentials,iocharset=utf8,uid=osmc,gid=osmc ://<IP of server1>/<share1>/

Done