Samba 4.x package support thread

This seems much isolated to your specific setup, file locks (oplocks) can be tuned in smb.conf however since the defaults are used in most setups without issues you have to understand that there will not be tuning in favor of your setup specifically if you have clients crashing which isn't normal behaviour.

Whatever performance issue you have with wifi is clearly outside the scope of Samba.

I would try to first replicate this using files on /var /tmp, so we can exclude storage device or filesystem specific problems. So you can try share /var aka ramfs and see how access and locking behaves on it.
If it behaves the same, we can at least assume its not filesystem, storage driver specific.

Than i would try different smb versions v1, v2, v3 and verify the connections via a Windows 10 client and powershell (Get-SmbConnection).

I would also probably compare samba3 and cifsd speeds, just to see if its a wifi + samba4 problem or also happens on other services, maybe even nfsv4 if i'm desperate.

The main goal is to find out, if you need to fiddle with wifi or filesharing services settings.

Hello everyone.

I found that /etc/init.d/samba4 parses only few parameters of config file.
For example:
I try to create shared folder with full acces for authenticated users, and for guests - with read only acces.
In /etc/config/samba4 I wrote:

config sambashare
	option 'name'			'demo'
	option 'path'			'/mnt/C'
	option 'read_only'		'yes'
	option 'write_list' 'User'

After 'service samba4 restart' I didn't find string write list = User in temporary config file.
To solve this problem I added next string in /etc/init.d/samba4

....
config_get write_list $1 write_list
....
[ -n "$write_list" ] && echo -e "\twrite list = $write_list" >> /var/etc/smb.conf
...

Please add parsing of all parametres for samba service

Samba has over 100 parameters, so we did implement the most commonly used, mainly those that you can also setup via the ui and write_list is not documented to-be supported atm "https://openwrt.org/docs/guide-user/services/nas/samba_configuration

I can add read/write list as a uci only parameter in one of the next releases, since its a trivial change.

I made some investigation at weekend, better now, here are the results:

  • File locks. In fact, it was quite stable from one of the operation by software on host, so easy to diagnose. Result - fully disabling oplocks fix it.

  • Netbios "master browser" spam in logs (can't promote) - quite common-style bug. In my configuration, i have different names for netbios and DNS. So, the issue then promote to master browser, nmbd trying to promote to master DNS name instead of Netbios one - and can't find it! Bug. Fix it for now setting the same name for netbios and DNS.

  • Wifi read speed degradation. Seems like it's both Samba and wifi protocol bug. As i expect, the issue related to different package fragmentation between ethernet and wifi. So, then i remove "max xmit" parameter or set it to below 2310 - situation becomes better. Did Samba have frame size at network interface in mind?
    Let me check - i bet i will have performance degradation on wired if enable jumbo frames as well.
    For now i have interesting result - i have reasonable speed first 1-3 secs, then it drops about 40%. Anyway, this is 15% better, then before.

PS: I can't alter "server max protocol" - if i set it lower, then default SMB3, i can't browse and connect shares. Maybe it's my windows config, but, in fact, i have SMB1 support installed there. Let me check as well.

Done in https://github.com/openwrt/packages/pull/8943 .

1 Like

ehi @Andy2244 i discoverd something interesting...
i find out why my samba share didn't work...

i use unbound as my dns server so i tought that unbound was the problem... Well today i tried my andoird phone and i notice that i does discover the samaba share but I notice one specific problem.

The hostname of my router is "No-More-Lag-Router"

But on the andoird device it was seen as "NO-MORE-LAG-ROU"

This could be a problem with the app... but let's try it... I changed the hostname to "NoLag-Router" and my samba share started to work right away...

This is stupid as...

the error reported is this

Sun May 19 13:15:34 2019 daemon.err nmbd[8305]: [2019/05/19 13:15:34.368159,  0] ../source3/nmbd/nmbd_become_lmb.c:533(become_local_master_browser)
Sun May 19 13:15:34 2019 daemon.err nmbd[8305]:   become_local_master_browser: Error - cannot find server NO-MORE-LAG-ROUTER in workgroup WORKGROUP on subnet 192.168.2.1

But the real problem is with the name lenght... Think something is broken on samba source or is a limitation of the broadcast service.

I think you have the same bug as i explain above, just different side.
BTW, lenght is not an issue, i even have a longer name.

We enable mdns name by default, maybe there is a problem?

## Allows the server name that is advertised through MDNS to be set to the hostname rather than the Samba NETBIOS name.
## This allows an administrator to make Samba registered MDNS records match the case of the hostname rather than being in all capitals.
## (netbios, mdns)

mdns name = mdns

in my case disabling it didn't solve the problem... i'm 100% sure there is a limitation on the share names lenght

Looks strange. I have about 60 chars netbios name, and it's workin without issue.

But - maybe - it's LUCI bug, there are lot of it last times...
Can you SSH to router and type:

cat /etc/samba/smb.conf | grep netbios

It will show you real name used for samba.

@Ansuel it may have been Unbound. Samba 4 uses mdns (rfc6762) and that must use TLD "local." Unbound scripts put that in s dead end SOA record to prevent DNS leaks from dumb clients. Avahi will terminate if it sees that SOA. Avahi sees it is an admin domain, and not adhoc as the RFC requires. Openwrt-18.06 packages fixed this and "local." Is forced to be NXDOMAIN instead.

samba 4.10.6 is broken,the samba connection is refused.
After revert to 4.9.8, then with same configuration file, it works.

Tue Jul 16 15:57:29 2019 daemon.err nmbd[10580]: [2019/07/16 15:57:29.469589,  0] ../../source3/nmbd/nmbd.c:59(terminate)
Tue Jul 16 15:57:29 2019 daemon.err nmbd[10580]:   Got SIGTERM: going down...
Tue Jul 16 15:57:29 2019 daemon.err nmbd[32519]: [2019/07/16 15:57:29.732233,  0] ../../lib/util/become_daemon.c:136(daemon_ready)
Tue Jul 16 15:57:29 2019 daemon.err nmbd[32519]:   daemon_ready: daemon 'nmbd' finished starting up and ready to serve connections
Tue Jul 16 15:57:29 2019 daemon.err nmbd[32519]: [2019/07/16 15:57:29.735243,  0] ../../source3/nmbd/nmbd_namequery.c:109(query_name_response)
Tue Jul 16 15:57:29 2019 daemon.err nmbd[32519]:   query_name_response: Multiple (2) responses received for a query on subnet 192.168.190.1 for name WORKGROUP<1d>.
Tue Jul 16 15:57:29 2019 daemon.err nmbd[32519]:   This response was from IP 192.168.190.178, reporting an IP address of 192.168.190.178.
Tue Jul 16 15:57:55 2019 daemon.info procd: Instance samba4::instance1 s in a crash loop 6 crashes, 0 seconds since last crash

What platform?

WRT3200ACM and WRT1900ACS both met same issue

What happens if you disable netbios in luci or just rename the nmbd bin on the system? Just wondering if nmbd or smbd causes this.

it is smbd caused this issue, the smbd process can't bootup

root@OpenWrt:~# cat /var/log/log.nmbd 
[2019/07/17 22:13:39.172543,  0] ../../source3/nmbd/nmbd.c:906(main)
  nmbd version 4.10.6 started.
  Copyright Andrew Tridgell and the Samba Team 1992-2019
[2019/07/17 22:13:39.191114,  0] ../../lib/util/become_daemon.c:136(daemon_ready)
  daemon_ready: daemon 'nmbd' finished starting up and ready to serve connections
[2019/07/17 22:59:39.606241,  0] ../../source3/nmbd/nmbd.c:59(terminate)
  Got SIGTERM: going down...
[2019/07/17 22:59:39.882426,  0] ../../source3/nmbd/nmbd.c:906(main)
  nmbd version 4.10.6 started.
  Copyright Andrew Tridgell and the Samba Team 1992-2019
[2019/07/17 22:59:39.887170,  0] ../../lib/util/become_daemon.c:136(daemon_ready)
  daemon_ready: daemon 'nmbd' finished starting up and ready to serve connections
root@OpenWrt:~# cat /var/log/log.smbd 
root@OpenWrt:~# ps|grep nmbd
18122 root     20224 S    /usr/sbin/nmbd -F
22460 root      3124 S    grep nmbd
root@OpenWrt:~# ps|grep smbd
22462 root      3124 S    grep smbd

Did you try disable netbios via luci?

Yes, I have tried disable netbios via luci, but it is not work

Although samba-tool is built, when you try and run it, "import ldb" fails because ldb.so is not built. Not sure if there's other dependencies after that, but for sure the python ldb.so is missing. I compared this to what it looks like under Ubuntu, and there should be an ldb.so in /usr/lib/python2.7/dist-packages/ldb.so