Lan plugin refuses to work with new ksmbd server

Support for Android version of Total Commander

Moderators: white, Hacker, petermad, Stefan2

Post Reply
S.V.D.
Junior Member
Junior Member
Posts: 6
Joined: 2022-09-02, 11:19 UTC

Lan plugin refuses to work with new ksmbd server

Post by *S.V.D. »

After I've moved from samba to ksmbd(kernel smb implementation https://docs.kernel.org/filesystems/cifs/ksmbd.html) LAN plugin is not working anymore
With 3.3x branch I receive these errors:

Code: Select all

09-02 14:21:41.578  1488  1835 E VerityUtils: Failed to measure fs-verity, errno 1: /data/app/~~byHM0OVRcXcuGYrHVIWqcw==/com.ghisler.tcplugins.LAN-hVwMSXdbWxjrDxN5SikWNg==/base.apk
09-02 14:24:44.696  1488  1755 I ActivityManager: Start proc 32553:com.ghisler.tcplugins.LAN/u0a597 for service {com.ghisler.tcplugins.LAN/com.android.tcplugins.FileSystem.PluginService}
09-02 14:24:44.770 32553 32553 V GraphicsEnvironment: ANGLE Developer option for 'com.ghisler.tcplugins.LAN' set to: 'default'
09-02 14:24:44.771 32553 32553 V GraphicsEnvironment: ANGLE GameManagerService for com.ghisler.tcplugins.LAN: false
09-02 14:24:45.574  1488  2914 I ActivityTaskManager: START u0 {flg=0x10000000 cmp=com.ghisler.tcplugins.LAN/com.android.tcplugins.FileSystem.LoadingActivity (has extras)} from uid 10294
09-02 14:24:45.596 31886 31906 D TC:LAN  : CONNECT BLAZER
09-02 14:24:45.752 31886 31906 D TC:LAN  : SMB2 CONNECT:java.util.concurrent.ExecutionException: com.hierynomus.smbj.common.f: com.hierynomus.protocol.transport.f: java.io.EOFException: EOF while reading packet
09-02 14:24:47.419 31886 31904 D TC:LAN  : SMB2 CONNECT:java.util.concurrent.ExecutionException: com.hierynomus.smbj.common.f: com.hierynomus.protocol.transport.f: java.io.EOFException: EOF while reading packet
09-02 14:24:49.083 31886 31936 D TC:LAN  : SMB2 CONNECT:java.util.concurrent.ExecutionException: com.hierynomus.smbj.common.f: com.hierynomus.protocol.transport.f: java.io.EOFException: EOF while reading packet
09-02 14:24:50.751 31886 31936 D TC:LAN  : SMB2 CONNECT:java.util.concurrent.ExecutionException: com.hierynomus.smbj.common.f: com.hierynomus.protocol.transport.f: java.io.EOFException: EOF while reading packet
With 3.2x and earlier these errors:

Code: Select all

09-02 14:27:29.449 31886 31936 D TC:LAN  : CONNECT BLAZER
09-02 14:27:29.869 31886 31936 D TC:LAN  : SMB2 CONNECT:java.util.concurrent.ExecutionException: com.b.k.b.d: com.b.h.b.e: java.io.EOFException: EOF while reading packet
09-02 14:27:31.544 31886 31936 D TC:LAN  : SMB2 CONNECT:java.util.concurrent.ExecutionException: com.b.k.b.d: com.b.h.b.e: java.io.EOFException: EOF while reading packet
09-02 14:27:33.219 31886 31905 D TC:LAN  : SMB2 CONNECT:java.util.concurrent.ExecutionException: com.b.k.b.d: com.b.h.b.e: java.io.EOFException: EOF while reading packet
09-02 14:27:34.925 31886 31905 D TC:LAN  : SMB2 CONNECT:java.util.concurrent.ExecutionException: com.b.k.b.d: com.b.h.b.e: java.io.EOFException: EOF while reading packet
Windows and linux smbclient both work fine
User avatar
ghisler(Author)
Site Admin
Site Admin
Posts: 48021
Joined: 2003-02-04, 09:46 UTC
Location: Switzerland
Contact:

Re: Lan plugin refuses to work with new ksmbd server

Post by *ghisler(Author) »

I'm using the following library:
https://github.com/hierynomus/smbj

I cannot find any bug reports regarding ksmbd there. Either no one is using smbj clients with ksmbd yet, or there is a configuration error on your side.
The error "EOF while reading packet" seems to indicate that ksmbd is returning malformed/incomplete data packets. Windows clients may ignore the missing data, but smbj apparently isn't.
Author of Total Commander
https://www.ghisler.com
S.V.D.
Junior Member
Junior Member
Posts: 6
Joined: 2022-09-02, 11:19 UTC

Re: Lan plugin refuses to work with new ksmbd server

Post by *S.V.D. »

ghisler(Author) wrote: 2022-09-02, 15:08 UTC no one is using smbj clients with ksmbd yet
I think it's possible. Most of productive systems still use 4.x kernel, Even RHEL 9 kernel version is 5.14. And I've swithed to ksmbd only because bugs in newest samba version.
I don't think that my server is misconfigured, it uses default config, which comes from repo, but as I understand - you cant't do alot untill that library will be fixed by it's author
User avatar
ghisler(Author)
Site Admin
Site Admin
Posts: 48021
Joined: 2003-02-04, 09:46 UTC
Location: Switzerland
Contact:

Re: Lan plugin refuses to work with new ksmbd server

Post by *ghisler(Author) »

I have now installed ksmbd in VirtualBox (with Fedora Linux 37), and i was able to reproduce the error. It happens in the so-called multi-protocol negotiation which the smbj library does: This is an SMB1 call which checks for the available SMB versions (either 1 or 2 or newer). ksmbd does not respond to this request, and instead just closes the connection.

Now I have written a workaround to this ksmbd problem. It is available in the latest beta version available via Play Store or my own F-Droid repository:
https://play.google.com/apps/testing/com.ghisler.tcplugins.LAN
or
https://www.ghisler.com/fdroid.htm

Please try it and report any new problems here!
Author of Total Commander
https://www.ghisler.com
Post Reply