Can’t you just create a user without space for accessing that share?
statemachine:1500: got unexpected signal 28!
last time I saw that indicated issues with the format and the only think that sticks out for me is the space in username.
I try to create user with a name testuser
and see how it goes. Stand by for further info.
EDIT: No luck even I created a new user testuser
into my PC. All the sharing settings were OK and as they should but no luck.
At /etc/auto.master
file there was 2 empty row’s at the bottom of the page. I removed then and now the debug gives me this:
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(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/192.168.1.101/Movies with timeout 15, freq 4 seconds
do_mount_autofs_direct: mounted trigger /mnt/192.168.1.101/Movies
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 /-
ls -lah /mnt/192.168.1.101
gives this
but adding Movies
to ls -lah /mnt/192.168.1.101/Movies
gives error
The funni thing is that when I stop autofs, I can do this:
Too bad that this does not work at the moment. I revert the fstab way as it works.
Strange that it is not working. Did you add the space in the Username again?
Let me know when you want to continue testing.
I can continue testing tomorrow, if it’s okay for you. I’ve added the space to the username again. As I use fstab again, My W10 account’s name First Name works in the file as First\040Name
.
I don’t think there should issues with fstab if your just rebooting your server every once and a while and not doing that when your actually playing something at the same time. If I understand it correctly the problems generally come when you are letting your remote share sleep and the time for it to wake up is excessive.
The problem comes when I try watch a movie and I don’t realize that my PC has secretly rebooted due to automatic updates. Now, thanks to VeraCrypt, my Windows does not boot until I enter the master password. It seems like OSMC thinks that the media is no longer available. Reboot of all of my devices doesn’t help. The only thing left to do is to remove my media mounts from settings > media > videos and do fstab mounting again. All this has probably something to do with my PC.
Never the less, I’d like to debug this autofs thing. I will try the username with \040
as a space bar. I will also try again the user without spaces in the name. Then I try to debug it with sudo automount -f -v -d
.
It could actually be the name of the server, or anything else you want. We suggest the name of the server just to make things easy. A simple example if you only have one share with movies would be instead of /mnt/192.168.1.101/Movies just use /mnt/Movies. If you have more than one server with shares you could do /mnt/myfirstserver/Movies
I’ve got it working now. The solution was to use the non ~/.smbcredentials method, where I put my credentials into the /etc/auto.smb.shares
itself like this:
/mnt/Movies -fstype=cifs,rw,username=First\ Name,password=password123,iocharset=utf8,uid=osmc,gid=osmc,vers=3.0 ://192.168.1.101/Movies/
So my guess is that this has something to do with the name, type or location of the ~/.smbcredentials file. I recall that the name of it in the home/osmc
was .smbcredentials
.
Now the funny thing was that when I got it work, I added my TV_Series
dir also to osmc. When opening the /etc/auto.smb.shares
I noticed that my first mount Movies
was written with dual comma ,,
after the password (password123) like this:
/mnt/Movies -fstype=cifs,rw,username=First\ Name,password=password123,,iocharset=utf8,uid=osmc,gid=osmc,vers=3.0 ://192.168.1.101/TV_Series/
I tried the “dual comma” with my TV series folder TV_Series
also so that the /etc/auto.smb.shares
was
/mnt/Movies -fstype=cifs,rw,username=First\ Name,password=password123,,iocharset=utf8,uid=osmc,gid=osmc,vers=3.0 ://192.168.1.101/Movies/
/mnt/TV_Series -fstype=cifs,rw,username=First\ Name,password=password123,,iocharset=utf8,uid=osmc,gid=osmc,vers=3.0 ://192.168.1.101/TV_Series/
Worked like a charm. Then I removed excessive commas and it worked also after that. Tested with interrupted connection / restart PC. Works in all scenarios imaginable.
As I side mention I’d like to point out that while it works now, I’ve left my /etc/fstab
as it was with the exception of commenting the lines like this:
# rootfs is not mounted in fstab as we do it via initramfs. Uncomment for remount (slower boot)
#/dev/vero-nand/root / ext4 defaults,noatime 0 0
#//192.168.1.101/TV_Series /mnt/TV_Series cifs x-systemd.automount,noauto,rw,iocharset=utf8,username=First\040Name,password=password123,uid=osmc,gid=osmc,file_mode=0770,dir_mode=0770,vers=3.0 0 0
#//192.168.1.101/Movies /mnt/Movies cifs x-systemd.automount,noauto,rw,iocharset=utf8,username=First\040Name,password=password123,uid=osmc,gid=osmc,file_mode=0770,dir_mode=0770,vers=3.0 0 0
I’ve also selected “Wait for network” option from the OSMC options.
Thank you for this excellent explanation. It helped me „out of the box „ to created my smb shares.
May be I got something wrong (I am not a Linux guy): In Kodi under „media „“ video „“auto mount „, I don’t see my shares. I have to go to „add videos“ „root „“, „mnt „.
All my shares are listed here and not as I expected under the section „auto mount „.
Also I find in the mnt folder several entries I have created testing the feature. How can I delete this entries?
Thanks
Chang
In the second file you made the first part of the line is the location where you are mounting to. If you followed the guide the /mnt/<server1>/<share1>
is the ‘root’ /mnt folder. If you want to mount it somewhere else you just need to change that location in the auto.nfs.shares file.
sudo rmdir /mnt/*
(this will remove ONLY empty folders in your /mnt directory)
“auto mount” is another OSMC internal function to automount local devices (e.g. USB Disks).
The deivces/shares you mount via autofs will show up in the directly you define in the config file as indicated by @darwindesign
Thank you for your kind help and your fast response.
Great stuff! I was using fstab to mount a HDD connect to a router running AdvancedTomato (and SMB 1). It was working fine until it suddenly stopped working (and I get “No such file or directory” error message when I try to access the serve share).
So I tried autofs
instead, and it works. Thanks.
I am using AUTOFS NFS on my vero 4K and it is really good. But if i restart my vero 4k I can not watch my movies, because I am loosing connection until I ssh to my vero 4K and restart autofs with comand sudo systemctl restart autofs
This is what I do not like. Is it expected behavier of AUTOFS after restart of vero 4K?
After reboot, what is the output of sudo systemctl status autofs
?
osmc@osmc:~$ sudo systemctl status autofs
● autofs.service - Automounts filesystems on demand
Loaded: loaded (/lib/systemd/system/autofs.service; disabled; vendor preset:
Active: inactive (dead)
Run sudo systemctl enable autofs && reboot
then check if the mounts are active when the machine comes back up.
I entered as you advised sudo systemctl enable autofs && reboot
Vero 4k restarted when I connected by ssh and interned again
osmc@osmc:~$ sudo systemctl status autofs
● autofs.service - Automounts filesystems on demand
Loaded: loaded (/lib/systemd/system/autofs.service; disabled; vendor preset:
Active: inactive (dead)
After that I entered:
osmc@osmc:~$ sudo systemctl restart autofs
osmc@osmc:~$ sudo systemctl status autofs
● autofs.service - Automounts filesystems on demand
Loaded: loaded (/lib/systemd/system/autofs.service; disabled; vendor preset:
Active: active (running) since Sat 2020-05-09 21:57:31 EEST; 46s ago
Process: 1586 ExecStart=/usr/sbin/automount $OPTIONS --pid-file /var/run/autof
Main PID: 1587 (automount)
CGroup: /system.slice/autofs.service
└─1587 /usr/sbin/automount --pid-file /var/run/autofs.pid
May 09 21:57:31 osmc systemd[1]: Starting Automounts filesystems on demand…
May 09 21:57:31 osmc systemd[1]: Started Automounts filesystems on demand.
lines 1-10/10 (END)
It works perfect, but after power failure, or if I restart Vero 4K myself my mounts by AUTOFS is not active…
That should have changed
osmc@osmc:~$ sudo systemctl status autofs
● autofs.service - Automounts filesystems on demand
Loaded: loaded (/lib/systemd/system/autofs.service; disabled; vendor preset:
Into
osmc@osmc:~$ sudo systemctl status autofs
● autofs.service - Automounts filesystems on demand
Loaded: loaded (/lib/systemd/system/autofs.service; enabled; vendor preset: