USB Drive Error
See original GitHub issueDescription of the issue
Despite granting All Files Access picking a folder to sync in external USB storage produces 2 errors:
mkdir /storage/1234-5678: permission denied
Error on folder "name" (abcde-12345): folder path missing
The part of the app responsible for creating .stfolder is successfully using the SAF-chosen & translated path and creating that folder & text file on the USB drive. But, another part of the app appears to be unable to use that path and the actual sync business fails.
From reading the docs it seems like there should exist somewhere a real file path to the USB drive that syncthing can use with All Files Access, but the SAF picker & translator does not apparently create that path? Maybe the Android 11 file picker gear can be updated to detect USB storage paths (‘portable’ storage in the documentation) as well as sdcards (‘reliable’ external storage)?
Reproduction Steps
Create a new folder sync, use SAF to choose a directory on a portable USB drive. Once folder sync setup is completed you will see the errors above in the webgui. Note that removable sdcards that are set up as reliable storage do not produce this error on my Samsung tablet, although I find I cannot write to the sdcard outside of the app’s directory. This also confuses me but that’s another topic.
Version Information
- App Version: 1.15.1.0
- Syncthing Version: v1.15.1
- Android Version: Android 11
- Device manufacturer: Samsung & Google
- Device model: Galaxy Tab S6 tablet & Pixel 4a
Issue Analytics
- State:
- Created 2 years ago
- Comments:8 (4 by maintainers)
Top GitHub Comments
I got it working:
You need to get the correct path, and enter it into the webgui.
If you use the file picker it will return, for example, “/storage/C90F-14E4/Pictures” but this will fail. It’s not the real path. You need to enter “/mnt/media_rw/C90F-14E4/Pictures” (using your own drive’s name and folder path instead of mine). The webgui complained of something but in the end it worked!
I suggest that the file picker be corrected to return /mnt/media_rw and/or update the custom file path tool (the gear) to detect removable storage in a more reliable way. In the meantime you can get the true path using Material Files, which by the way also supports opening folders in the main view.
I get that dialog as well, but inspecting the app’s granted permissions afterwards shows it is not actually granted. I even switched from F-Droid to Play Store to see if there was a difference and there wasn’t for me. Am thinking to check with ADB soon. The docs specifically say the root of USB storage should be available with raw paths but permission is denied to those paths and now it looks like the needed permission is not honored. Weird.