Syncthing running as root cannot access files with "permission denied"


I have this problem on one Android device. I suspect that something may be wrong with the ROM (which is an unofficial release of LineageOS), but still. Basically, despite that fact that Syncthing is running as root, it cannot access some files with permission errors as follows.

to hash: xxx File{Name:"xxx", Sequence:0, Permissions:0660, ModTime:2021-01-24 10:42:55.57532183 +0000 UTC, Version:{[{TX7YPBI 1613674468}]}, VersionHash:, Length:3558124, Deleted:false, Invalid:false, LocalFlags:0x0, NoPermissions:true, BlockSize:131072, Blocks:[], BlocksHash:}
open: open /sdcard/xxx: permission denied
hash error: xxx open /sdcard/xxx: permission denied

My knowledge on Linux, etc. is limited, but what can be the cause for a program with root access to have problems accessing files like that?


it could be the mount options (the os used) or seLinux enforcing policy. In Android 5 times, I used some script to disable selinux to be able to use tasker for shell’ing commands to the system protected levels.

Yeah, I suspect some misconfiguration in the ROM, as I have encountered some other problems, e.g. when trying to download a file using the Web browser, etc.

However, if I use adb shell with su, then I can access/modify/delete the files, so the behaviour is not consistent. I am going to downgrade to the last official version of LineageOS and see whether the issue stands there too.

FWIW, one of the reasons my computers use FUSE encfs systems is because root cannot read the plaintext mount; it can read the encrypted volume, good for backup and restore, but meaningless gibberish until mounted properly.

I don’t know enough about Android to know if this matters.