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

I have learned my lesson not to report anything because I will make it worse for others :expressionless: .

Currently I have and it works OK:
OpenWrt 22.03-SNAPSHOT / LuCI openwrt-22.03 branch git-22.083.69105-af8e91c

ksmbd-server	3.4.2-1
ksmbd-utils	3.4.2-1
kmod-fs-ksmbd	5.10.108+3.4.3-220330.56946

can you show your config ?

I use 22.03 rc1
ksmbd-server 3.4.2-2
ksmbd-utils 3.4.2-2
kmod-fs-ksmbd 5.10.111+3.4.3-1

Thanks

here it is
run this from default
then fix up the uuid for you device under "Mount Points"
wsdd2 is broken after V21 so may show up may not

opkg update 
opkg install block-mount kmod-usb-storage e2fsprogs kmod-fs-ext4 kmod-fs-f2fs ntfs-3g 
opkg install luci-app-ksmbd ksmbd-utils wsdd2 

uci add fstab mount # =cfg024d78
uci set fstab.@mount[-1].enabled='1'
uci set fstab.@mount[-1].uuid='557ab60c-1249-47c4-ae52-ca9edefadf60'
uci set fstab.@mount[-1].target='/mnt/sda1'
uci set fstab.@mount[-1].enabled_fsck='1'
uci commit fstab

uci add ksmbd share # =cfg02b538
uci add ksmbd share # =cfg03b538
uci set ksmbd.cfg013b09.interface='lan'
uci set ksmbd.cfg02b538.name='Media'
uci set ksmbd.cfg02b538.read_only='no'
uci set ksmbd.cfg02b538.guest_ok='yes'
uci set ksmbd.cfg02b538.create_mask='0666'
uci set ksmbd.cfg02b538.dir_mask='0777'
uci set ksmbd.cfg02b538.path='/mnt/sda1/Media/'
uci set ksmbd.@share[-1].name='c$'
uci set ksmbd.@share[-1].path='/mnt/sda1/'
uci set ksmbd.@share[-1].read_only='no'
uci set ksmbd.@share[-1].force_root='1'
uci set ksmbd.@share[-1].users='user'
uci set ksmbd.@share[-1].guest_ok='no'
uci set ksmbd.@share[-1].create_mask='0666'
uci set ksmbd.@share[-1].dir_mask='0777'
uci commit ksmbd
ksmbd.adduser -d user 
echo -e "password\npassword" | (ksmbd.adduser -a user)

I suppose I've also fallen into the 'not working ksmbd' ship!

I've just sys-upgraded my TP-Link c2600 from 21.02.2 => 21.02.3 release
All seems OK apart from ksmbd not playing ball!

21.02.2 worked fine using:
ksmbd-server - 3.4.4-1
kmod-fs-ksmbd - 5.4.179+3.4.4-1
luci-app-ksmbd - git-21.295.66827-c592d0a

now not working with 21.02.3:
ksmbd-server 3.4.2-2
kmod-fs-ksmbd 5.4.188+3.4.4-1
luci-app-ksmbd git-21.295.66827-c592d0a

I'm really limited for space so want to try and keep ksmbd working.

Is it possible to downgrade the .03 versions to the .02 versions? I tried but saying there for a different architecture.
Or is there another way or fix?

Followed this advise - https://github.com/openwrt/openwrt/issues/9639#issuecomment-1106182954

Shares work on virtual x86/64

Negative result on Archer C7v4:

kmod-fs-ksmbd 5.4.188+3.4.4-1
ksmbd-server - 3.4.4-1 = Snapshot ksmbd-server_3.4.4-1_mips_24kc.ipk (Feb 15)

Are the ksmbd packages going to be updated (in master) for a fix before the next Openwrt release?

1 Like

Hi there, I'm using openwrt (OpenWrt 21.02-SNAPSHOT r16521-b1c3539868) with ksmbd (3.4.4) and everything works except accessing shares on macosx 10.13 sierra (it's old but laptop is old without the possibility to update it). Once I try to connect to share i'm getting an error saying 'Perhaps server doesn't exist or is unavailable this time. Check server name or IP and make sure your connection works properly' or 'no shares available or you don't have rights to access it' depending on whether i try to access via smb:// or cifs://. The thing is I can see samba host in Finder. Anyone knows how to solve that issue? Thanks.

Edit: ok, creating /etc/nsmb.conf file in MacOS and adding the following line (it forces SMBv2) solved that issue

protocol_vers_map=2

Update, I tried 22.03- rc1 again and now ksmbd seems to be working with me (with 3.4.4 versions). The packages must've been updated since my first try (unless I did something wrong first time or I'm going crazy). Using ea6350v3 (linksys) router.

Good day.

I have a WDR4300 and I successfully managed to get ksmbd working. I have a 500GB HDD with exFAT plugged into USB2.0 in my router, and I can see my shared drive and write to it in Windows 11. The problem is that it hangs on copying anything bigger than couple hundred megabytes. When I copy small files (<1GB) the speeds are acceptable to me ~12MB/s. But on bigger files Windows shows unexpected network error. Afterwards when I try to delete the ghost file from the shared drive, dmesg outputs "ksmbd: Failed to send message: -32", fails to delete it and the router completely crashes.

I'm on 22.03-rc1

I've installed latest ksmbd from master branch on Belkin RT3200 and configured it but the share doesn't show up under Network on Windows 10/11. It shows when I put IP address of the server.

\\192.168.1.1\share

Is there anything I've missed. Thanks.

Yes the wsdd2 package.

2 Likes

Super.
image
Working now... Thanks a lot.

Unicode name contains characters that cannot be converted to character set default.  You might want to try to use the mount option nls=utf8.

This is what I get using NTFS file system on a USB drive.

nls=utf8 should probably be default.

I've had bad to terrible performance using either ntfs or exfat partitions. Ext4 has been working great for me for quite awhile now. You may want to give that a try. I've been able to copy multi-GB files with no issues.

Hi all!

Could you help me with a problem? I hope I'm not SPAM-ing this topic.

My problem is that I can't create new files/folders and I also can't rename them on ksmbd. The config is basic and I can't find our the cause of it. The permissions are also should be OK.

Because of other version mismatch issues I installed the latest snapshot.
I can overwrite files if they are already there and if they have "777" permission.
The partition of the HDD is an ext4 partition (mkfs.ext4 /dev/sda1).

Here are some system info:

root@NG-R6260:/mnt/hdd1# dmesg
[    0.000000] Linux version 5.10.120 (builder@buildhost) (mipsel-openwrt-linux-musl-gcc (OpenWrt GCC 11.3.0 r19767-fbf6992f2b) 11.3.0, GNU ld (GNU Binutils) 2.37) #0 SMP Mon Jun 6 17:20:28 2022
[    0.000000] SoC Type: MediaTek MT7621 ver:1 eco:3
[    0.000000] printk: bootconsole [early0] enabled
[    0.000000] CPU0 revision is: 0001992f (MIPS 1004Kc)
[    0.000000] MIPS: machine is Netgear R6260
[    0.000000] Initrd not found or empty - disabling initrd
[    0.000000] VPE topology {2,2} total 4
[    0.000000] Primary instruction cache 32kB, VIPT, 4-way, linesize 32 bytes.
[    0.000000] Primary data cache 32kB, 4-way, PIPT, no aliases, linesize 32 bytes
[    0.000000] MIPS secondary cache 256kB, 8-way, linesize 32 bytes.
[    0.000000] Zone ranges:
[    0.000000]   Normal   [mem 0x0000000000000000-0x0000000007ffffff]
[    0.000000]   HighMem  empty
[    0.000000] Movable zone start for each node
[    0.000000] Early memory node ranges
[    0.000000]   node   0: [mem 0x0000000000000000-0x0000000007ffffff]
[    0.000000] Initmem setup node 0 [mem 0x0000000000000000-0x0000000007ffffff]
[    0.000000] On node 0 totalpages: 32768
[    0.000000]   Normal zone: 288 pages used for memmap
[    0.000000]   Normal zone: 0 pages reserved
[    0.000000]   Normal zone: 32768 pages, LIFO batch:7
[    0.000000] percpu: Embedded 15 pages/cpu s30256 r8192 d22992 u61440
[    0.000000] pcpu-alloc: s30256 r8192 d22992 u61440 alloc=15*4096
[    0.000000] pcpu-alloc: [0] 0 [0] 1 [0] 2 [0] 3
[    0.000000] Built 1 zonelists, mobility grouping on.  Total pages: 32480
[    0.000000] Kernel command line: console=ttyS0,57600 rootfstype=squashfs,jffs2
[    0.000000] Dentry cache hash table entries: 16384 (order: 4, 65536 bytes, linear)
[    0.000000] Inode-cache hash table entries: 8192 (order: 3, 32768 bytes, linear)
[    0.000000] Writing ErrCtl register=000145d0
[    0.000000] Readback ErrCtl register=000145d0
[    0.000000] mem auto-init: stack:off, heap alloc:off, heap free:off
[    0.000000] Memory: 118896K/131072K available (7028K kernel code, 626K rwdata, 1412K rodata, 1288K init, 244K bss, 12176K reserved, 0K cma-reserved, 0K highmem)
[    0.000000] SLUB: HWalign=32, Order=0-3, MinObjects=0, CPUs=4, Nodes=1
[    0.000000] rcu: Hierarchical RCU implementation.

Here is the ksmbd config and file+folder details. And I wrote into the comments what I tried before I collected the logs

root@NG-R6260:/# cat /etc/ksmbd/smb.conf
[global]
        netbios name = NG-R6260
        server string = Ksmbd on OpenWrt
        workgroup = WORKGROUP
        interfaces = br-lan
        bind interfaces only = no
        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 #########

[hdd]
        path = /mnt/hdd1
        create mask = 0777
        directory mask = 0777
        read only = no
        guest ok = yes
        hide dot files = no

root@NG-R6260:/# ls /mnt -l
drwsrwsrwt    7 root     root          4096 Jun  8 01:36 hdd1

root@NG-R6260:/# ls /mnt/hdd1 -l
drwsrwsrwt    2 root     root          4096 Jun  8 10:05 Downloads
drwsrwsrwt    2 root     root          4096 Jun  8 01:38 OpenWRT
drwsrwsrwt    2 root     root          4096 Jun  8 01:07 Other
drwsrwsrwt    4 root     root          4096 Jun  8 01:41 cams
drwsrwsrwt    2 root     root         16384 Jun  8 00:44 lost+found

##########################################################
# I uploaded test files with FTP and with WinSCP
##########################################################

root@NG-R6260:/mnt/hdd1# ls ./Downloads -l
-rwxrwxrwx    1 root     root         19664 Aug  4  2021 ftp-upload_with_root.htm
-rw-r--r--    1 root     root         19664 Aug  4  2021 winscp-upload_with_root.htm

##########################################################
# After the FTP uploads I tried to use ksmbd
# I was able to upload and overrite "ftp-upload_with_root.htm"
# I was unable to upload and overrite "ftp-upload_with_root.htm". No error logs were generated
# I was unable to upload a new file "ksmbd-upload_with_guest.htm". This time error logs were generated
##########################################################

root@NG-R6260:/mnt/hdd1# logread | tail -n 20
Wed Jun  8 22:40:54 2022 kern.err kernel: [ 2681.916220] ksmbd: path create failed for Downloads/ksmbd-upload_with_guest.htm, err -13
Wed Jun  8 22:40:54 2022 kern.err kernel: [ 2681.935372] ksmbd: path create failed for Downloads/ksmbd-upload_with_guest.htm, err -13
Wed Jun  8 22:40:54 2022 kern.err kernel: [ 2681.954486] ksmbd: path create failed for Downloads/ksmbd-upload_with_guest.htm, err -13
Wed Jun  8 22:40:54 2022 kern.err kernel: [ 2681.973240] ksmbd: path create failed for Downloads/ksmbd-upload_with_guest.htm, err -13
Wed Jun  8 22:40:54 2022 kern.err kernel: [ 2681.992042] ksmbd: path create failed for Downloads/ksmbd-upload_with_guest.htm, err -13
Wed Jun  8 22:42:00 2022 kern.err kernel: [ 2748.445195] ksmbd: path create failed for Downloads/ksmbd-upload_with_guest.htm, err -13
Wed Jun  8 22:42:00 2022 kern.err kernel: [ 2748.463825] ksmbd: path create failed for Downloads/ksmbd-upload_with_guest.htm, err -13
Wed Jun  8 22:42:00 2022 kern.err kernel: [ 2748.484109] ksmbd: path create failed for Downloads/ksmbd-upload_with_guest.htm, err -13
Wed Jun  8 22:42:00 2022 kern.err kernel: [ 2748.505877] ksmbd: path create failed for Downloads/ksmbd-upload_with_guest.htm, err -13
Wed Jun  8 22:42:00 2022 kern.err kernel: [ 2748.525767] ksmbd: path create failed for Downloads/ksmbd-upload_with_guest.htm, err -13
Wed Jun  8 22:42:00 2022 kern.err kernel: [ 2748.547236] ksmbd: path create failed for Downloads/ksmbd-upload_with_guest.htm, err -13
Wed Jun  8 22:42:00 2022 kern.err kernel: [ 2748.566396] ksmbd: path create failed for Downloads/ksmbd-upload_with_guest.htm, err -13
Wed Jun  8 22:42:00 2022 kern.err kernel: [ 2748.586055] ksmbd: path create failed for Downloads/ksmbd-upload_with_guest.htm, err -13
Wed Jun  8 22:42:00 2022 kern.err kernel: [ 2748.604813] ksmbd: path create failed for Downloads/ksmbd-upload_with_guest.htm, err -13
Wed Jun  8 22:42:00 2022 kern.err kernel: [ 2748.624344] ksmbd: path create failed for Downloads/ksmbd-upload_with_guest.htm, err -13
Wed Jun  8 22:42:00 2022 kern.err kernel: [ 2748.643572] ksmbd: path create failed for Downloads/ksmbd-upload_with_guest.htm, err -13
Wed Jun  8 22:42:00 2022 kern.err kernel: [ 2748.664415] ksmbd: path create failed for Downloads/ksmbd-upload_with_guest.htm, err -13
Wed Jun  8 22:42:00 2022 kern.err kernel: [ 2748.685803] ksmbd: path create failed for Downloads/ksmbd-upload_with_guest.htm, err -13
Wed Jun  8 22:42:00 2022 kern.err kernel: [ 2748.704880] ksmbd: path create failed for Downloads/ksmbd-upload_with_guest.htm, err -13
Wed Jun  8 22:42:00 2022 kern.err kernel: [ 2748.726297] ksmbd: path create failed for Downloads/ksmbd-upload_with_guest.htm, err -13


##########################################################
# If I try to rename a folder I get this error logs
##########################################################

root@NG-R6260:/mnt/hdd1# logread | tail -n 3
Wed Jun  8 22:42:00 2022 kern.err kernel: [ 2748.726297] ksmbd: path create failed for Downloads/ksmbd-upload_with_guest.htm, err -13
Wed Jun  8 22:50:43 2022 kern.err kernel: [ 3270.931419] ksmbd: vfs_rename failed err -1
Wed Jun  8 22:50:43 2022 kern.err kernel: [ 3270.951258] ksmbd: vfs_rename failed err -1

How do you mount the drive?

I used this to mount:

uci add fstab mount # =cfg024d78
uci set fstab.@mount[-1].enabled='1'
uci set fstab.@mount[-1].uuid='632e8c42-502f-45ea-8206-08d31a8edba6'
uci set fstab.@mount[-1].target='/mnt/hdd1'
uci set fstab.@mount[-1].enabled_fsck='1'
uci commit fstab

But what is strange to me, is that I can write, if the file is already there and the permissions of the file are 777. In that case I can upload it again.

But the folder has 777 permission, but I can't upload new files or rename old ones. Something about the new path ... ¯_(ツ)_/¯

Here is the output of mount

root@NG-R6260:~# mount -v | grep 'dev/s'
/dev/sda1 on /mnt/hdd1 type ext4 (rw,relatime)

Have you tried?

chmod 777 -R /mnt/hdd1

Or

chmod 777 -R /mnt/hdd1/*

Did you name the share?

I did chmod it a few times but no success with these:
chmod 777 -R /mnt/hdd1
chmod 777 -R /mnt/hdd1/*
chmod 777 /mnt/hdd1

But I thought let's try this, and it worked :sweat_smile:
chmod 777 -R /mnt

Strange (at least to me, but I'm not a linux expert :slightly_smiling_face: )

Thanks for taking the time and trying to help me! I think I would have not try this if you would have not make your suggestion.