Samba 4.x package support thread

Any recent tests samba vs ksmbd?

1 Like

Samba is so feature packed, nice luci page, and very performant. With a usb3.0 drive it easily maxes my gigabit LAN at 110-120 MB/s on my 7 year old WRT32X, so it's hard to find any issue with it I haven't bothered with Ksmbd.

Comparing CPU utilization would be worth doing actually, I'll look into doing this. Samba 4.17 and especially 4.18 versions improved security related performance regressions so much it's well optimized.

Someday I'll move my network to a 2.5Gbit setup, like a N5105 + i226-v box, or NanoPi R6S if official OpenWrt support gets added. It'll be fun to see what these performance limits are again.

1 Like

Getting numerous syslog entries here using Samba Version 4.18.0.... copying files to the OpenWRT USB storage device!
Seems every file written has a syslog entry.

...daemon.err smbd[21514]:   get_static_share_mode_data: get_static_share_mode_data_fn failed: NT_STATUS_NOT_FOUND
...daemon.err smbd[21514]: [2023/05/03 17:11:56.057215,  0] ../../source3/locking/share_mode_lock.c:888(get_static_share_mode_data)

There is a logging fix upstream in 4.18.2 but this package isn't updated as frequently. Overall Samba 4.18.0 in OpenWrt has been working fantastic for me for the past couple months I use it almost daily.

2 Likes

Hi all,
New to OpenWRT but I've used Gargoyle for multiple years which is based on OpenWRT. The new router I have isn't supported by Gargoyle yet and only exists in Snapshot for now (BPi-R3).
I'm trying to get Samba working through Luci and I can't see the mounted USB drive. As posted previously in this thread, clicking Path gives the error:
Unable to dispatch: /cgi-bin/luci/admin/system/mounts
How do you access the mounted drive in Luci? I can see that it is mounted in /mnt over SSH.

What I'd like to be able to do is setup the mounts for 2 USB HDDs that will automount and autoshare over Samba.

Also wondering if it is possible to have any USB stick automounted when hotplugged for access in Luci.
Thanks!

Assuming it's a USB 3.0 external drive (most common) you need to add packages for USB 3.0 and the file system its formatted for. Some examples:

kmod-usb3 kmod-usb-storage kmod-usb-storage-uas block-mount usbutils mount-utils luci-app-hd-idle kmod-fs-exfat (it might instead need ntfs-3g or ext4)

After that it'll be under System > Mount Points. Once mounted, it you can enter the /dev/sdaX in Services > Network Shares, give the share a name, enable it, etc.

Check the doc page too for some guidance: [https://openwrt.org/docs/guide-user/services/nas/cifs.server]

I have been working on this problem for a while. As an update:
I had installed all of the files you mentioned, and could see the drive and its contents over SSH. However, I didn't have the System > Mount Points or Services > Network Shares in Luci. I played around for a while and finally rebooted out of frustration. As soon as I rebooted, everything came back.
I can see the mount in Luci and I setup the samba share according to the instructions. I can see the share on my network, but I cannot get it to allow an anonymous share. I tried using the root password and I get a permission error.
I have also updated to the 2 June snapshot.

So, the final hurdle is getting the anonymous share access working and I have the router working the way I need it to work.

Check the link I pasted above under Installation section (I actually wrote that section some time back) for default settings. The key is to enable 'force root' and 'allow guests' if you just want a simple anonymous config but follow the settings. That's what I use it works perfectly with Samba 4.18 getting 100-120 MB/s read/write.

I don't know if it is the reboots or what but now it is working. I didn't change any of the settings from what I set on Friday following the link (which I had followed before asking for help). Thanks for the help.

OK, this is weird.
I can connect to the share on my Linux laptop, but I cannot connect to the share using my phone. I can connect to my shares on the Gargoyle router with both devices.
The phone software, X-plore, reports SMB Access denied. I have it set to SMB2 on the phone. Are there logs to check or something to get this working?

Turns out its the software, not the phone or openwrt. VLC on the same device can access the shares no trouble. Now I have to find another file manager that supports the newer SAMBA.

I upgraded from r23611 to r23885 with the new kernel v6.1. Clients can't mount the samba shares anymore. I get this error in the samba log on each mount attempt:
make_connection_snum: SMB_VFS_CONNECT for service 'Archive' at '/mnt/Archive' failed: Function not implemented

Samba version seems to be the same. Configuration is the same. Hardware is the same. Client is the same. Network is the same. Shared dirs are the same and they are mounted ok.
Only the kernel changed, afaik.

samba build options:

CONFIG_PACKAGE_samba4-libs=y
CONFIG_PACKAGE_samba4-server=y
# CONFIG_SAMBA4_SERVER_WSDD2 is not set
CONFIG_SAMBA4_SERVER_NETBIOS=y
# CONFIG_SAMBA4_SERVER_AVAHI is not set
# CONFIG_SAMBA4_SERVER_QUOTAS is not set
CONFIG_SAMBA4_SERVER_VFS=y
# CONFIG_SAMBA4_SERVER_VFSX is not set
# CONFIG_SAMBA4_SERVER_AD_DC is not set
CONFIG_PACKAGE_samba4-utils=m

Any ideeas what could be wrong?

Noticed Samba got updated to 4.18.6, can confirm this is working well. Read/write from USB3 drive in the 100-120 MB/s range on my WRT32X. Thanks to package maintainers.

4 Likes

Have you ever tested ksmbd on your device?

I did yes, found Ksmbd somewhat annoying to setup and deal with so didn't use it for more than a day. I'm away this weekend so can't paste any numbers I had. In the meantime throughput on Samba was a little better on my wrt32x, although ram usage was a bit higher as well, has many more features so makes sense.

Samba just works incredibly well for my needs (hosting a 2TB USB3.0 network share for misc files and movies for Kodi on shield tv pro). I'm just very comfortable with Samba configs so maybe it's me.

1 Like

I have a working OpenWrt Samba4 package for latest samba "4.20" or samba github master, let me know if anyone feel 'adventurous' or for those currently waiting for new release because it's already been fixed in samba git master branch , or just wanted to help out samba4 development.

This is only exclusively available on OpenWrt :smile: .

But not thoroughly tested only run & compile tested on x86-64.

1 Like

Samba 4.20 rc builds are even't out yet so it's way too early to switch to it. Currently 4.18.6 we have in OpenWrt package feed is a great build (even though it's superseded upstream by 4.19.0 I'm not the package maintainer).

It's more for developer type, I won't provide pre-compiled binaries, It's a OpenWrt samba4 custom Makefile archive. I have provide reasoning behind these, please re-read again my post.

Samba4 is a huge project, would be useful if more peoples are also test or helping it out. Sometime you only need missed couple seconds window for a fixes that needs to become stabilize in like weeks or months stable release.

1 Like

Samba 4.20-DEV Revision #3 (Snapshot/Master) Makefile package :

  • This is most likely would be useful when 4.20 Final comes out, as we don't need starting from scratch make / edit the current Samba4 Makefile
  • Most likely would be compatible with latest Samba Master/Snapshot git. Will update this post if there are changes in the Makefile
  • Not at all or thoroughly tested, only compile and run-tested on x86-64 platform.
  • Please help out samba development team.

Changelog Revision #4 :

  • Removed 104-samba-4.12-unbundle-icu.patch to see if it's bring UTF8_NORMALISATION
  • Updated PKG_SOURCE_VERSION

Changelog Revision #3 :

  • Fixed recursively selecting it's own "SAMBA4_SERVER_ICU"
  • Trying to more enabling NLS (iconv) for more probable strings helper (need tester).

Changelog Revision #2 :

  • Re-enable libicu, might be helpful those who are problematic currently on macOS as the client, need to be selected from make menuconfig in Samba "SAMBA4_SERVER_ICU" (need tests), I just come across a written up that libicu in SAMBA4 are used as somekind of UTF8_NORMALISATION , more in here.
  • Fixed compilation with liburing (need tests)

Anyway, here is the Samba 4.20-DEV Revision #4 archive:

https://uploadnow.io/f/sVQbjKd

To use it , delete, replace all files and folders inside ./feeds/packages/net/samba4 with the contents from the archive file.

Initiate clean & recompilation with "make package/samba4/{clean,compile} -j1 V=s"

[EDIT]
Link was down, so re-upload it.

[EDIT #2]
Revision #2 posted.

2 Likes

Strange problem with samba4 4.18 when installed on OpenWrt 23.05.0-rc4.

Though this OpenWrt release candidate now runs really well (after fix of speed regression), samba4 4.18.6 does not; on 22.03.5 samba 4.18.0 with the same config works.

The observed problem is that while the samba daemons run, testparm shows the shares, but a macOS smb connection cannot be established. Whether the issue stems from the minor version update of samba4 or a change on the platform is uncertain.

Listing the shares locallly on the router with smbclient works, so does making a connection from a Debian 12 smb client (Gnome), but connecting from any macOS client is to no avail. A test with the default smb.conf.template and package example UCI samba4 file with just one test share could not be connected from macOS either. The samba log for the macOS (13.6) client shows:

log samba 4.18.6 on 23.05.0.-rc4
[2023/10/10 16:04:31.575213,  3] ../../source3/smbd/smb2_oplock.c:1408(init_oplocks)
  init_oplocks: initializing messages.
[2023/10/10 16:04:31.576523,  3] ../../source3/smbd/server_exit.c:229(exit_server_common)
  Server exit (failed to receive request length)
[2023/10/10 16:04:31.577020,  3] ../../source3/smbd/smb2_oplock.c:1408(init_oplocks)
  init_oplocks: initializing messages.
[2023/10/10 16:04:31.577424,  3] ../../source3/smbd/smb2_negprot.c:1110(smb2_multi_protocol_reply_negprot)
  Requested protocol [NT LM 0.12]
[2023/10/10 16:04:31.577541,  3] ../../source3/smbd/smb2_negprot.c:1110(smb2_multi_protocol_reply_negprot)
  Requested protocol [SMB 2.002]
[2023/10/10 16:04:31.577631,  3] ../../source3/smbd/smb2_negprot.c:1110(smb2_multi_protocol_reply_negprot)
  Requested protocol [SMB 2.???]
[2023/10/10 16:04:31.578691,  3] ../../source3/smbd/smb2_negprot.c:342(smbd_smb2_request_process_negprot)
  Selected protocol SMB2_FF
[2023/10/10 16:04:36.585796,  3] ../../lib/util/util_net.c:255(interpret_string_addr_internal)
  interpret_string_addr_internal: getaddrinfo failed for name gw (flags 34) [Try again]
[2023/10/10 16:04:36.585985,  3] ../../source3/lib/util_sock.c:1034(get_mydnsfullname)
  get_mydnsfullname: getaddrinfo failed for name gw [Unknown error]
[2023/10/10 16:04:41.596585,  3] ../../lib/util/util_net.c:255(interpret_string_addr_internal)
  interpret_string_addr_internal: getaddrinfo failed for name gw (flags 34) [Try again]
[2023/10/10 16:04:41.596764,  3] ../../source3/lib/util_sock.c:1034(get_mydnsfullname)
  get_mydnsfullname: getaddrinfo failed for name gw [Unknown error]
[2023/10/10 16:04:41.596992,  3] ../../auth/gensec/gensec_start.c:1083(gensec_register)
  GENSEC backend 'gssapi_spnego' registered
[2023/10/10 16:04:41.597076,  3] ../../auth/gensec/gensec_start.c:1083(gensec_register)
  GENSEC backend 'gssapi_krb5' registered
[2023/10/10 16:04:41.597156,  3] ../../auth/gensec/gensec_start.c:1083(gensec_register)
  GENSEC backend 'gssapi_krb5_sasl' registered
[2023/10/10 16:04:41.597232,  3] ../../auth/gensec/gensec_start.c:1083(gensec_register)
  GENSEC backend 'spnego' registered
[2023/10/10 16:04:41.597306,  3] ../../auth/gensec/gensec_start.c:1083(gensec_register)
  GENSEC backend 'schannel' registered
[2023/10/10 16:04:41.597380,  3] ../../auth/gensec/gensec_start.c:1083(gensec_register)
  GENSEC backend 'ncalrpc_as_system' registered
[2023/10/10 16:04:41.597456,  3] ../../auth/gensec/gensec_start.c:1083(gensec_register)
  GENSEC backend 'sasl-EXTERNAL' registered
[2023/10/10 16:04:41.597530,  3] ../../auth/gensec/gensec_start.c:1083(gensec_register)
  GENSEC backend 'ntlmssp' registered
[2023/10/10 16:04:41.597605,  3] ../../auth/gensec/gensec_start.c:1083(gensec_register)
  GENSEC backend 'ntlmssp_resume_ccache' registered
[2023/10/10 16:04:41.597680,  3] ../../auth/gensec/gensec_start.c:1083(gensec_register)
  GENSEC backend 'http_basic' registered
[2023/10/10 16:04:41.597757,  3] ../../auth/gensec/gensec_start.c:1083(gensec_register)
  GENSEC backend 'http_ntlm' registered
[2023/10/10 16:04:41.597835,  3] ../../auth/gensec/gensec_start.c:1083(gensec_register)
  GENSEC backend 'http_negotiate' registered
[2023/10/10 16:04:41.598624,  3] ../../source3/smbd/smb2_negprot.c:1176(smb2_multi_protocol_reply_negprot)
  Selected protocol SMB 2.???
[2023/10/10 16:04:41.599382,  3] ../../source3/smbd/server_exit.c:229(exit_server_common)
  Server exit (NT_STATUS_INVALID_PARAMETER)

The log for the Debian workstation differs and most relevant seems that it shows Selected protocol SMB3_11 (i.s.o. Selected protocol SMB 2.???), after which authentication etc continues successfully. The log of the failed connection attempt never gets to authenticating the principal.

Please note that in the OpenWrt 23.05 image samba4 4.18.6 is build against libopenssl3 i.s.o. libopenssl1.1 in 22.03.5's samba4 4.18.0.

So, it seems that for some reason the macOS client protocol negotiation with the samba server fails. Reason ?