[Galaxy Tab S2 Android Development] retiredtab:
From adb logcat, I see this when trying to load dictionary

W FuseDaemon: Failed to check lock: Invalid argument
W linker : Warning: "/data/app/~~QAIh8jDx6YMCFDB8jWWtDw==/org.koreader.launcher-q_sBXLGGz9JbOQ5z8gKlOA==/lib/arm64/libsdcv.so" unused DT entry: DT_RPATH (type 0xf arg 0x13f4) (ignoring)
W sdcv : type=1400 audit(0.0:461): avc: granted { execute } for path="/data/data/org.koreader.launcher/files/libs/libc++_shared.so" dev="mmcblk0p39" ino=320658 scontext=u:r:untrusted_app_30:s0:c2,c256,c512,c768 tcontext=u:object_r:app_data_file:s0:c2,c256,c512,c768 tclass=file app=org.koreader.launcher
W FuseDaemon: Failed to check lock: Invalid argument

Looking through

https://github.com/koreader/koreader/issues/11604

If I run

adb root
adb shell
cd /data/data/org.koreader.launcher/files

gts210vewifi:/data/data/org.koreader.launcher/files # LD_LIBRARY_PATH="$PWD/libs" ./sdcv --data-dir /storage/emulated/0/koreader/data/dict
WARNING: linker: Warning: "/data/app/~~QAIh8jDx6YMCFDB8jWWtDw==/org.koreader.launcher-q_sBXLGGz9JbOQ5z8gKlOA==/lib/arm64/libsdcv.so" unused DT entry: DT_RPATH (type 0xf arg 0x13f4) (ignoring)
g_mkdir failed: No such file or directory
Enter word or phrase: testing
Nothing similar to testing, sorry :(
Enter word or phrase:

I see an option called --data-dir

I see that

/storage/emulated/0/koreader/data/dict

is mapped to

/data/media/0/koreader/data/dict

If I change to /data/media/0/koreader/data/dict, dictionary works at the CLI.

gts210vewifi:/data/data/org.koreader.launcher/files # LD_LIBRARY_PATH="$PWD/libs" ./sdcv --data-dir /data/media/0/koreader/data/dict
WARNING: linker: Warning: "/data/app/~~QAIh8jDx6YMCFDB8jWWtDw==/org.koreader.launcher-q_sBXLGGz9JbOQ5z8gKlOA==/lib/arm64/libsdcv.so" unused DT entry: DT_RPATH (type 0xf arg 0x13f4) (ignoring)
g_mkdir failed: No such file or directory
save to cache /data/media/0/koreader/data/dict/GNU Collaborative International Dictionary of English/gcide/stardict.idx
save to cache /data/media/0/koreader/data/dict/English Idioms (eng-eng)/stardict-idioms_eng_eng-2.4.2/idioms_eng_eng.idx
save to cache /data/media/0/koreader/data/dict/Douglas Harper's Online Etymology Dictionary/etymonline/stardict.idx
Enter word or phrase: testing
Found 4 items, similar to testing.
0)GNU Collaborative International Dictionary of English-->testing
1)Engligh Idioms (eng-eng)-->test
2)Online Etymology Dictionary, ©Douglas Harper/etymonline.com-->test(1)
3)Online Etymology Dictionary, ©Douglas Harper/etymonline.com-->test(2)
Your choice[-1 to abort]: 0
-->GNU Collaborative International Dictionary of English
-->testing

<p><b style="color: #00b">Testing</b> <i>(?)</i>, <i style="color: #a00">n.</i> <b>1.</b> The act of testing or proving; trial; proof.</p><p><b>2.</b> <span style="color: #00b">(Metal.)</span> The operation of refining gold or silver in a <i>test</i>, or cupel; cupellation.</p><p><b>Testing machine</b> <span style="color: #00b">(Engin.)</span>, a machine used in the determination of the strength of materials, as iron, stone, etc., and their behavior under strains of various kinds, as elongation, bending, crushing, etc.</p>

I don't know why the app doesn't work with /storage/emulated/0/koreader/data/dict and does with /data/media/0/koreader/data/dict?

Hacking the app?

Perhaps, you can hack to koreader program to point the --data-dir to /data/media/0/koreader/data/dict? I'm not a programmer, but when

git clone https://github.com/koreader/koreader.git

$ rg -i "data-dir"
frontend/apps/reader/modules/readerdictionary.lua
780: local args = {"./sdcv", "--utf8-input", "--utf8-output", "--json-output", "--non-interactive", "--data-dir", dict_dir}

spec/unit/util_spec.lua
29: local command = "./sdcv -nj \"words\" \"a lot\" 'more or less' --data-dir=dict"
41: assert.are_same({"./sdcv", "-nj", "words", "a lot", "more or less", "--data-dir=dict"}, argv)

$ rg -i emulated
frontend/ui/widget/filechooser.lua
265:-- (i.e. /storage/emulated/ on Android that we can meet when coming
266:-- from readable /storage/emulated/0/ - so we know it contains "0/")

$ rg -i sdcv
make/android.mk
23: cp -pR $(INSTALL_DIR)/koreader/sdcv $(ANDROID_LIBS_ABI)/libsdcv.so
24: echo "sdcv libsdcv.so" > $(ANDROID_ASSETS)/map.txt
45: '-x!sdcv' \

plugins/japanese.koplugin/main.lua
18:-- have to call sdcv each time) we batch as many candidates as possible
182: -- Calling sdcv is fairly expensive, so reduce the cost by trying every
188: local cancelled, all_results = self.dictionary:rawSdcv(all_words)

frontend/apps/reader/modules/readerdictionary.lua
141: -- sdcv won't use dict that don't have a bookname=
157: -- Prepare the -u options to give to sdcv the dictionary order and if some are disabled
158: self:updateSdcvDictNamesOptions()
181:function ReaderDictionary:updateSdcvDictNamesOptions()
182: -- We cannot tell sdcv which dictionaries to ignore, but we
186: -- that sdcv uses to order its results.
598: self:updateSdcvDictNamesOptions()
757:function ReaderDictionary:rawSdcv(words, dict_names, fuzzy_search, lookup_progress_msg)
758: -- Allow for two sdcv calls : one in the classic data/dict, and
780: local args = {"./sdcv", "--utf8-input", "--utf8-output", "--json-output", "--non-interactive", "--data-dir", dict_dir}
790: table.insert(args, "--") -- prevent words starting with a "-" to be interpreted as a sdcv option
796: -- Some sdcv lookups, when using fuzzy search with many dictionaries
800: -- Because sdcv starts outputing its output only at the end when it has
810: -- definition found, sdcv will output some message on stderr, and
825: -- sdcv can return multiple results if we passed multiple words to
851: logger.warn("sdcv returned a different number of results than the number of words")
858:function ReaderDictionary:startSdcv(word, dict_names, fuzzy_search)
873: -- because sdcv cannot handle CJK text properly when fuzzy searching (with
887: local lookup_cancelled, results = self:rawSdcv(words, dict_names, fuzzy_search, self.lookup_progress_msg or false)
899: -- Flatten the array, removing any duplicates we may have gotten (sdcv
983: local results = self:startSdcv(word, dict_names, fuzzy_search)
1213: self:updateSdcvDictNamesOptions()
1249: self:updateSdcvDictNamesOptions()

frontend/languagesupport.lua
246:--- Called from ReaderHighlight:startSdcv after the selected has text has been
247:-- OCR'd, cleaned, and otherwise made ready for sdcv.

spec/unit/util_spec.lua
29: local command = "./sdcv -nj \"words\" \"a lot\" 'more or less' --data-dir=dict"
41: assert.are_same({"./sdcv", "-nj", "words", "a lot", "more or less", "--data-dir=dict"}, argv)

OR maybe ask the koreader team if they can write something like

if
file open (/storage/emulated/0/koreader/data/dict) == error
then
file open (/data/media/0/koreader/data/dict)

Another option would be to allow the user to choose or specify the dictionary directory so the user can type in /data/media/0/koreader/data/dict?

Oddity

What I also find odd about the app is that it can't see /data/media/0/koreader/data/dict directory. It sees /data/media/0/koreader/data/tessdata, but not dict.

# dict CLEARLY exists, but app can't see it? See screenshot
ls -al koreader/data/
total 8
drwxrwx--- 5 root everybody 4096 2024-06-05 22:04 dict
drwxrwx--- 2 root everybody 4096 2024-06-05 11:24 tessdata

Workaround/Options

If you can't find a workaround, then the only options are

1. Use another rom were koreader works.

2. Fork my github repo code and try to fix it. See below.

3. Use another ereader.

Otherwise, I can't do anymore. I've already spent more time (3 hours) than I had looking at this problem and I've given you options above.

Starting with Android 11, AOSP made a lot of changes with respect to FUSE. It's all documented at

https://source.android.com/s/results?q=fuse&text=fuse

As you can imagine, more changes to FUSE in 12 and 13. It's possible that the rom is missing one of those changes/patches, code, etc. If yes, I won't be looking through thousands, hundreds of thousands of lines of code to see what could possibly be missing.

In addition, my 19.1 and higher builds relies on the LineageOS-UL repo which is a fork of LineageOS with thousands of patches that were either needed or reversed to work on "legacy" devices. This is necessary otherwise these "legacy" devices will never boot/work/compile past 18.1.

So it's possible that there is a commit(s) missing in this repo(s) which is why FUSE may not be working 100% in 18.1+. This is also assuming FUSE is the culprit here. It very well could be something else.