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

mhh @neheb @hnyman any input on this request?

I guess its possible, by having min protocol = smb2.1 in the default template and than adjust this via a UCI config option.

PS: Its really a shame and a mystery why google removed there official smbv3 client. I was using this a couple of years back on ChromeOS + Android. Than one day it vanished from the playstore....

I use FX on Android. Works fine. Then again I don't do annonimous.access.

@Andy2244 could work. Strange that it is needed...

The apps I tested so far:

AndSMB: fails with NT Status: STATUS_DATA_ERROR (0xc000003e)
Filemanager (flashlight + Clock): uses SMB1.0
GMT Subtitles: uses SMB1.0
VLC: no issues :slight_smile:
X-plore: fails with NT Status: STATUS_DATA_ERROR (0xc000003e)

And some other clients that also failed.

FX File Explorer seems to work fine.

@luizluca ok new PR are out that enable smb1 support in conjunction with the new uci/luci option allow_legacy_protocols = yes.
All android file managers and smb-tools work, i tested AndSMB, X-plore, Astro-filemanager and some others.

Update: PR for 19.07 are up.

3 Likes

Not working on 19.07.1 wrt1900acs. With samba4 stopped and disabled. Samba4 with was running well. Here's some detail info.
OpenWrt version:

 BusyBox v1.30.1 () built-in shell (ash)

  _______                     ________        __
 |       |.-----.-----.-----.|  |  |  |.----.|  |_
 |   -   ||  _  |  -__|     ||  |  |  ||   _||   _|
 |_______||   __|_____|__|__||________||__|  |____|
          |__| W I R E L E S S   F R E E D O M
 -----------------------------------------------------
 OpenWrt 19.07.1, r10911-c155900f66
 -----------------------------------------------------
root@WRT1900ACS:~# uname -a
Linux WRT1900ACS 4.14.167 #0 SMP Wed Jan 29 16:05:35 2020 armv7l GNU/Linux

Tried to install but it prompts dependency error.

Installing luci-app-ksmbd (git-20.052.76937-657407f-1) to root...
Downloading http://downloads.openwrt.org/releases/19.07.1/packages/arm_cortex-a9_vfpv3/luci/luci-app-ksmbd_git-20.052.76937-657407f-1_all.ipk
Collected errors:
 * satisfy_dependencies_for: Cannot satisfy the following dependencies for luci-app-ksmbd:
 * 	kernel (= 4.14.167-1-a92a3f5c5bed2671533484c7ace9d5b5)
 * opkg_install_cmd: Cannot install package luci-app-ksmbd.

Force installed it with following command.

root@WRT1900ACS:~# opkg install luci-app-ksmbd --force-depends
root@WRT1900ACS:~# opkg list_installed | grep ksmbd
kmod-fs-ksmbd - 4.14.167+3.1.1-1
ksmbd-avahi-service - 3.2.1-1
ksmbd-server - 3.2.1-1
ksmbd-utils - 3.2.1-1
luci-app-ksmbd - git-20.052.76937-657407f-1

Add user, also a system user was added.

root@WRT1900ACS:~# ksmbd.adduser -a yding
root@WRT1900ACS:~# id yding
uid=1000(yding) gid=1000(samba) groups=1000(samba)

ksmbd config.

root@WRT1900ACS:~# uci show ksmbd
ksmbd.@globals[0]=globals
ksmbd.@globals[0].workgroup='WORKGROUP'
ksmbd.@globals[0].description='WRT1900ACS'
ksmbd.@globals[0].interface='lan'
ksmbd.@globals[0].allow_legacy_protocols='1'
ksmbd.@share[0]=share
ksmbd.@share[0].create_mask='0744'
ksmbd.@share[0].dir_mask='0777'
ksmbd.@share[0].read_only='no'
ksmbd.@share[0].guest_ok='no'
ksmbd.@share[0].users='yding'
ksmbd.@share[0].name='nas'
ksmbd.@share[0].path='/mnt/nas'

Start ksmbd and see logs.

Sun Feb 23 16:01:52 2020 daemon.info ksmbd: Legacy Protocols allowed, don't use this option for secure environments!
Sun Feb 23 16:01:52 2020 daemon.notice ksmbd: Starting Ksmbd userspace service.
Sun Feb 23 16:01:52 2020 kern.err kernel: [   82.130384] ksmbd: iface_exists:546: Device br-lan is down
Sun Feb 23 16:01:52 2020 kern.err kernel: [   82.135922] ksmbd: ksmbd_tcp_set_interfaces:594: Unknown interface: br-lan

Dvice br-lan is up and running. SSH is actually though lan connection.

root@WRT1900ACS:~# ifconfig
br-lan    Link encap:Ethernet  HWaddr -hided-  
          inet addr:172.24.2.1  Bcast:172.24.2.255  Mask:255.255.255.0
          inet6 addr: --hided--/60 Scope:Global
          inet6 addr: --hided--/60 Scope:Global
          inet6 addr: --hided--/64 Scope:Link
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:79218 errors:0 dropped:0 overruns:0 frame:0
          TX packets:92130 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000 
          RX bytes:9101006 (8.6 MiB)  TX bytes:74416870 (70.9 MiB)

Restart ksmbd and see logs.

Sun Feb 23 16:23:02 2020 daemon.notice ksmbd: Stopping Ksmbd userspace service.
Sun Feb 23 16:23:02 2020 daemon.info ksmbd: triggering kill_server
Sun Feb 23 16:23:02 2020 daemon.err ksmbd: module still loaded after kill_server?
Sun Feb 23 16:23:02 2020 kern.err kernel: [ 1352.378835] ksmbd: kill_server_store:437: kill command received

To see if process is running.

root@WRT1900ACS:~# ps | grep ksmbd
 5559 root      1024 S    /usr/sbin/ksmbd.mountd --n
 5561 root      1052 S    /usr/sbin/ksmbd.mountd --n
 5568 root      1072 R    grep ksmbd

To see if ksmbd is listening on port 445. Nothing.

root@WRT1900ACS:~# netstat -an | grep 445
root@WRT1900ACS:~# 

Tried to unload kernel module manually. Failed.

root@WRT1900ACS:~# service ksmbd stop
root@WRT1900ACS:~# rmmod ksmbd
unloading the module failed
root@WRT1900ACS:~# lsmod | grep ksmbd
ksmbd                 143360  0 [permanent]

Also tried reboot router. Still the same behavior.

Kinda weird error Device br-lan is down if its actually up, never had this error before and works fine for myself and others. Its also strange that the shutdown fails, again never seen this after i added the "kill_server" logic. Not much i can think of atm, but i will build a new version next week to address some big-endian bugs, so if this error persists after the next update i can try debug it more.

If you ping your device does it show the ports open for smb access? I’m having a similar issue (but I’m a OpenWRT newb so I put it down to that).

When I ping the device I get nothing open for smb, should I be changing the default firewall settings?

OK, I’ll test again when new version available.

I tried Finder on macOS to connect but it failed. With samba4 server, it works fine. Tried the following command to see if port 445 is listened by ksmbd but got nothing. For sure it’s not listening the port.

netstat -an | grep 445

It happens when you use mismatch versions between kernel module (kmod-fs-ksmbd) and userland program (ksmbd-server). OpenWrt publishes package updates when they hit repo but they only compile with the current kernel, which normally does no match any of the OpenWrt released kernel version.

Everytime ksmbd gets update in a stable branch, it might break or, at least, make you force it to install until the next dot version is released.

You need to force the kernel module too. You could also build ksmbd kernel module using 19.07.1 SDK.

1 Like

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.