Ksmbd (Samba3/4 alternative, ex cifsd/smbd) package support thread

I tried build ksmbd with openwork 19.07.2. Now ksmbd works. Thanks.

As my last reply, now it works. The performance is not good though.
With ksmbd, I got ~20MB/s download and ~35MB/s upload. CPU usage nice, system load nice.
With samba4, I got ~65MB/s download and ~145MB/s upload. CPU usage around 17%, system load a little high above 2.
Test with Linksys WRT1900acs running openwrt 19.07.2.
With legacy mode enabled, VLC on android tv pie still cannot access the share folder. Not even show up the authentication popup. VLC seems still using smbv1.
I think currently it's better to keep using samba4.

One thing is a little confusing is that upload (write to disk) is 2x faster than download (read from disk). Normally read should be faster than write.

1 Like

They just finished fixing the Android issues see: https://github.com/cifsd-team/cifsd/issues/334

PS: I will setup a new PR with the updated versions in the next days.

1 Like

Thank you for the update. As samba4 provides much better file transfer speed, I'll keep using it for awhile. Samba4 seems also has some issues with VLC android. I'll post it to samba4 thread.

Hi Andy, thanks for the work on this package. Having a problem that is touched on in this thread.
Running 19.07.2 on a WRT1900ACSv2 and WRT1900ACv2. Have installed ksmbd and wsdd2.

The router is advertised on the network with wsdd2 however when I click on it, the connection fails.
When I access via I.P. address from a Windows 10 client, the shares work fine, everything connects.

What I notice on the router, ksmbd is only accepting connection on port 445 on an IPv6 interface. It does not appear to be listening on IPv4. This is demonstrated by running netstat.

Where stuff gets weird, I believe I have removed IPv6 from the LAN interface - it has no IPv6 address when I run ifconfig.

I have tried modifying the startup script to only advertise wsdd2 on IPv6. wsdd2 runs fine (no errors) but still when opening an advertised router host from a Windows 10 client by hostname (not i.p.) the connection fails. I realise that SMBv1 is not enabled in ksmbd, and have tried enabling / disabling CIFS/SMB1 on the Windows 10 client, but to no avail.

Am I missing a package or config item for ksmbd to listen on IPv4? BTW the LAN interface I have bound ksmbd to is br-lan, rather than leaving the option blank for any interface.

i installed this today with a fairly stock openwrt install for my wrt1900ac

transfer speeds are really nice compared to samba server, thank you!

however i have an issue. All [reading and writing] transfers get stuck at 99%
i have 2 windows 10 computers, 1 laptop connected via wifi, and 1 desktop connected via ethernet and both suffer from the problem.
any ideas how to fix this?

[global]
	netbios name = OpenWrt
	server string = Skittles Share
	workgroup = SKITTLES
	interfaces = br-lan 
	bind interfaces only = yes
	ipc timeout = 20
	deadtime = 15
	map to guest = Bad User
	smb2 max read = 64K
	smb2 max write = 64K
	smb2 max trans = 64K
	cache read buffers = no
	cache trans buffers = no

######### Dynamic written config options #########

[skittlesshare]
	path = /mnt/usb1/shareroot
	force user = root
	force group = root
	create mask = 0666
	directory mask = 0777
	read only = no
	guest ok = yes
	hide dot files = no


FYI hour later and they are still stuck

That's just weird. Maybe a bug with the current version. There's an update queued up in the packages feed.

Anyone having issues with luci-app-ksmbd installing but not showing in Services area, even after clearing the caches??

Infact even though ksmbd is running i can't even see the Router shares on the network which is odd.

Edit: Solved, I deleted the config files and uninstalled and reinstalled the ksmbd files and its working again. Sorry

I'm seeing the same issue with OpenWrt SNAPSHOT r14190 and Windows 10. Router = Archer C2600.

On a different note, is it possible to make Ksmbd listen on two interfaces at once? I would like to be able to access my shares from both LAN and a Wireguard client. For this to work, it is my understanding that i have to "bind" Ksmbd to both lan and wg0.

Usually you add the wg0 interface to the LAN bridge and get full LAN access this way, including SMB.

Hi, Andy! Thank you for your reply.

I have tried adding wg0 to the LAN bridge but it does not seem to work towards being able to access my network shares via WG. Some quick reading reveals that wg0 cannot be truly bridged with LAN due to the difference in layer types (WG = layer 3, LAN = layer 2). I am a newb so take my previous statement with a grain of salt.

Would it be possible to have Ksmbd listen on two different interfaces? If so, how?

So far i have tried telling Ksmbd to use both wg0 and lan via "interfaces = lan wg0" in the Edit Template tab but to no avail. I have tried setting ksmbd.@globals[0].interface to wg0 lan via uci set but that has catastrophically failed as well. Is there any other way to fix it?

If it matters in any way, wg0 is assigned to firewall zone LAN.

Your lan interface probably is named "br-lan" not just "lan", lan is just used as alias for LUCI/UCI, but native configs/templates don't know this, so try interfaces = br-lan wg0.

PS: For me adding WG to the lan bridge works fine for smb share access. Maybe your routing options in the client are wrong?

anyone know how to get upper case letter in the share name ?

I'm having the same issue on WDR4300 on Ksmbd: 3.2.1 Kmod: 3.1.3 on OpenWRT 19.07.3.

Does anyone know of a fix? Either stuff gets stuck on 99%, or alternatively if I try to create/delete/modify just 1 file or folder, File explorer on Windows 10 crashes and doesn't respond inside the shared folder.

Updated OpenWRT to 19.07.4, fresh install with no backup restores. Just did a straight install of ksmbd-server, ksmbd-utils and luci-app-ksmbd. Added user samba50 with a password.

Works just fine on Android through FX Explorer. Logs in with the user, can transfer/delete files no problem. But on Windows 10, I can't map it because it says "the network folder specified is currently mapped using different user name and password". If I just try to simply go to \192.168.1.1\share, it will take me there and show me folders/files without even asking for login, but changing anything will freeze the connection, sometimes it will straight up crash the router. Guest access is disabled.

I've tried everything it seems. But Windows 10 just refuses to play nicely with the samba share from OpenWRT. For sanity check I tried to access it on my laptop, but even if I can access the share, changing/adding/deleting anything will utterly crash file explorer.

Try snapshot builds or samba4 on 19.07.x, there is a issue that prevents me from upgrading ksmbd on 19.x. The snapshot updates will be picked-up for 20.x, which should improve stability.

General advice: When switching SMB servers, or SMB server versions, or fiddling around with configurations, it is sensible to delete all the currently open network connections, using

net * /d

and reset Windows' Kerberos credential cache using

klist purge

on the Windows command line (with administrator privileges). If connections are left open and/or cached Kerberos tickets mismatch, it can lead to all kinds of minor and major problems.

2 Likes

Hi, I'm testing the current snapshot r15223. The ksmbd service is always semi-killed at system startup.

  • Kernel message:

[ 29.366912] ksmbd: kill command received

  • system log
root@OpenWrt:~# logread |grep smb
Sun Dec  6 00:26:17 2020 daemon.notice ksmbd: Starting Ksmbd userspace service.
Sun Dec  6 00:26:19 2020 daemon.info ksmbd: triggering kill_server
Sun Dec  6 00:26:19 2020 daemon.notice ksmbd: Starting Ksmbd userspace service.
Sun Dec  6 00:26:19 2020 kern.info kernel: [   29.494030] ksmbd: kill command received

Solved with this patch (sleep added):

diff --git a/net/ksmbd-tools/files/ksmbd.init b/net/ksmbd-tools/files/ksmbd.init
index 5eb347085..a1ec924d2 100644
--- a/net/ksmbd-tools/files/ksmbd.init
+++ b/net/ksmbd-tools/files/ksmbd.init
@@ -169,6 +169,7 @@ start_service()
 	
 	# NOTE: We don't do a soft-reload via signal, since [global] smb.conf setting changes will be ignored, so always reset hard.
 	kill_server
+	sleep 3
 	
 	[ ! -e /sys/module/ksmbd ] && modprobe ksmbd 2> /dev/null
 	if [ ! -e /sys/module/ksmbd ]; then

Probably there is a better way to fix it, but this may help to show the bug.

Regards.
Daniel

1 Like

ping @Andy2244

Just tried to setup a share on the current master branch version
and it no longer works with a $ at the end for a hidden share "c$"
this works with the 19.07 versions
also still not showing capital letters in shares