Running smbstatus in OSMC gives no info

Hello,

I am running the June version of OSMC on a Pi3B+ with Samba I installed from the OSMC App store.

When I run the command smbstatus I never get any information about clients that are connected to the Samba server on OSMC.

Instead I get the result:

/var/run/samba/locking.tdb not initialised
This is normal if an SMB client has never connected to your server.

I checked and that locking.tdb file does not exist in /var/run/samba

This error appears to have been discussed here as well. I didn’t try their “solution” and not sure if it would apply in the OSMC case.

Otherwise Samba seems to be running fine on my OSMC installation. I can make a connection to the Samba server running on it initiated from a separate linux OS using the mount -t cifs command which mounts a directory that’s on the OSMC Pi in to the local filesystem of the connecting other Linux OS. However, with this network share in place I never see any information about it from the smbstatus command run in OSMC command line.

Does smbstatus work on OSMC?

Cheers,

Flex

It’s possible our SMB config needs updating.
I don’t know about Samba to advise.

Well you pointed me in the right direction Sam !

On an OSMC installation the Samba config file is at: /etc/samba/smb.conf
In the [global] section it contains this line…

lock directory = /var/cache/samba

I commented that out and restarted Samba… then I found that /var/run/samba/locking.tdb now exists and when I run…

smbstatus

I indeed get pid/uid, SMB protocol information etc about the various shares that are being accessed by clients connecting through Samba on OSMC.

When I then un-comment that line and restart Samba again I get the message:

No locked files

… but once again I don’t see any info about the various clients connected to Samba share, even though two clients are connecting to shares defined in that Samba server.

Samba expects /var/run/samba/locking.tdb to exist but it seems to not get created with the current Samba config in OSMC?

I don’t know much about Samba so maybe I’m missing something else along the way but the only changes I made to the smb.conf file was to add one more Samba share definition so maybe there is something there that needs to be tweaked?

I find that smbstatus command really useful for debugging Samba network mounts and commenting out or deleting the line…

lock directory = /var/cache/samba

… made it work for me when it wasn’t

Cheers,

Flex

This is really odd, just tried it on my OSMC system and it is working out off the box.

osmc@osmc-pi3:~$ ls -lah /var/cache/samba/locking.tdb 
-rw-r--r-- 1 root root 40K Aug 26 07:54 /var/cache/samba/locking.tdb
osmc@osmc-pi3:~$ sudo smbstatus 

Samba version 4.5.16-Debian
PID     Username     Group        Machine                                   Protocol Version  Encryption           Signing              
----------------------------------------------------------------------------------------------------------------------------------------
2810    nobody       nogroup      fz-410 (ipv4:192.168.100.50:52900)        SMB3_11           -                    -                    

Service      pid     Machine       Connected at                     Encryption   Signing     
---------------------------------------------------------------------------------------------
IPC$         2810    fz-410        Wed Aug 26 09:00:59 HKT 2020 HKT -            -           

No locked files

Here too, no issue at all.

root@osmc-pi3:/mnt/video# ls -lah /var/cache/samba/locking.tdb
-rw-r--r-- 1 root root 320K Aug 26 09:22 /var/cache/samba/locking.tdb
root@osmc-pi3:/mnt/video# smbstatus

Samba version 4.9.5-Debian
PID     Username     Group        Machine                                   Protocol Version  Encryption           Signing
----------------------------------------------------------------------------------------------------------------------------------------
27357   osmc         osmc         10.10.10.29 (ipv4:10.10.10.29:49808)      SMB3_11           -                    partial(AES-128-CMAC)

Service      pid     Machine       Connected at                     Encryption   Signing
---------------------------------------------------------------------------------------------
devices      27357   10.10.10.29   Wed Aug 26 09:21:06 2020 CEST    -            -

No locked files

Thanks for the replies.

If you both, like me, also have not made any changes to the smb config files then I’m stumped. Maybe I have a permission issue… Still, this is not urgent enough to do a fresh OSMC re-install.

Cheers,

Flex

Perhaps, you may want to share your smb.conf and its includes here, so we can compare?

Good idea…

/etc/samba/smb.conf

[global]
    config file = /etc/samba/smb-local.conf

/etc/samba/smb-local.conf

[global]

#If you require a fully custom smb.conf create smb-local.conf instead of editing smb.conf so your
#configuration will not be overwritten by samba upgrades. You can use smb.conf as a template by
#copying it to smb-local.conf then removing the config file line below in the new file. If you only
#need to add some additional shares see smb-shares.conf below for a simpler way to do this.

#config file = /etc/samba/smb-local.conf

#min protocol = SMB2_02
workgroup = WORKGROUP
security=user
#Added these two lines below to help Alien2 connect
#You should remove these two lines when you stop using Alien2
#lanman auth = yes
#ntlm auth = yes
#You should remove these two lines when you stop using Alien2
#Added these two lines above to help Alien2 connect
follow symlinks = yes
wide links = no
unix extensions = no
#Commenting out this line makes smbstatus work… See: Running smbstatus in OSMC gives no info - #3 by flexmcmurphy
#lock directory = /var/cache/samba
load printers = no
printing = bsd
printcap name = /dev/null
disable spoolss = yes
log level = 1
map to guest = bad user
#usershare template share = automount template
#Automount template disabled to work around a samba bug causing crashes accessing external drives.

read raw = Yes
write raw = Yes
strict locking = no
min receivefile size = 16384
use sendfile = true
aio read size = 2048
aio write size = 2048
#socket options = TCP_NODELAY IPTOS_LOWDELAY SO_RCVBUF=131072 SO_SNDBUF=131072

[root]
comment = OSMC Root Directory
path = /
browseable = yes
read only = no
writable = yes
#Adding force user = root allows you to create new files and modify files in any folder
#in OSMC from the Samba share in Windows Explorer. Without this I wasn’t able to.
force user = root
valid users = root,osmc
create mask = 0777
directory mask = 0777

[osmc]
browsable = yes
read only = no
valid users = osmc
path = /home/osmc
comment = OSMC Home Directory

[automount template]
browseable = yes
-valid = no
valid users = osmc
path = %P
hide files = /$RECYCLE.BIN/System Volume Information/desktop.ini/thumbs.db/

#Add custom shares in smb-shares.conf instead of editing smb.conf so they will not be
#overwritten by samba updates. You can only add new shares to smb-shares.conf, not change
#the default shares or global options. If you need full control see smb-local.conf above.

include = /etc/samba/smb-shares.conf

I don’t have a /etc/samba/smb-shares.conf file.

Cheers,

Flex

Besides comments anmd manual changes you seem to have made, my smb.conf looks very similiar to yours … but mine is active since ages and I don’t know whether all samba upgrade changes are merged to this config file.

As last idea could you check whether the smbd and nmbd programs match to your installed samba versions?

So, what is the output of

 sudo dpkg -l|grep -i samba
 sudo /usr/sbin/smbd -V
 sudo /usr/sbin/nmbd -V

Here is the output of those commands,

osmc@osmc:~$ sudo dpkg -l|grep -i samba
ii  libwbclient0:armhf                   2:4.5.16+dfsg-1+deb9u2            armhf        Samba winbind client library
ii  python-samba                         2:4.5.16+dfsg-1+deb9u2            armhf        Python bindings for Samba
ii  samba                                2:4.5.16+dfsg-1+deb9u2            armhf        SMB/CIFS file, print, and login server for Unix
ii  samba-common                         2:4.5.16+dfsg-1+deb9u2            all          common files used by both the Samba server and client
ii  samba-common-bin                     2:4.5.16+dfsg-1+deb9u2            armhf        Samba common files used by both the server and the client
ii  samba-libs:armhf                     2:4.5.16+dfsg-1+deb9u2            armhf        Samba core libraries
ii  smb-app-osmc                         1.2.2                             all          Samba server for OSMC with prepopulated configuration
osmc@osmc:~$ sudo /usr/sbin/smbd -V
Version 4.5.16-Debian
osmc@osmc:~$ sudo /usr/sbin/nmbd -V
Version 4.5.16-Debian
osmc@osmc:~$

smbstatus doesn’t work when I uncomment the line
lock directory = /var/cache/samba

So I was wondering would permissions and ownership be wrong… here is an ls on /var/cache showing the samba dir…

osmc@osmc:/var/cache$ ls -l
total 16
drwxr-xr-x 3 root root 4096 Aug 28 22:55 apt
drwxr-xr-x 2 root root 4096 Aug 16 23:56 debconf
drwx------ 2 root root 4096 Aug 16 23:56 ldconfig
drwxr-xr-x 4 root root 4096 Aug 25 20:44 samba

From the Samba man page:

lock directory (G)
This option specifies the directory where lock files will be placed. The lock files are used to implement the max connections option.

Default: lock directory = ${prefix}/var/lock

I don’t know what ${prefix} is meant to be here? I searched the osmc filesystem I didn’t find any path containing /var/lock

I might try and re-install some other time but for now I guess it’s not important… just curious how Samba works.

Cheers,

Flex