How do I synchronize joplinapp content between an android phone and a PC using Syncthing

Joplin mobile v 2.7.2
Joplin Linux 2.6.10

How do I synchronize Joplin to my android phone using Syncthing? Syncthing seems to work properly with my specified directory /storage/40BE-5197/globalsync but when I try to get the Joplin to sync I get an error.

Last error: Error: Could not initialise synchroniser: Error: Directory could not be created. Path: /storage/40BE-5197/globalsync

1 Like

Not Possible to do so!

Per my personal experience,
It is suggested to sync to a S3 compatible storage (e.g. Storj, 150GB free)

Of course it's possible, however the current Android release is still affected by https://github.com/laurent22/joplin/issues/5779, so you either need to wait for a new release (with the issue already fixed) or use the terminal commands listed in https://github.com/laurent22/joplin/issues/5779#issuecomment-1013874764.

Please be aware that there's also https://github.com/laurent22/joplin/issues/6517, which is very likely to affect local files synchronised with Syncthing. You can use my workaround suggested there (i.e. set the timestamps into the future to force Joplin to rescan the files).

Thank you for your help. I am running android version 12, OneUI version 4.1.

I installed adb sudo apt install -y adb and ran the command adb shell cmd appops set net.cozic.joplin android:no_isolated_storage allow && adb shell cmd appops set net.cozic.joplin android:legacy_storage allow && adb shell am force-stop net.cozic.joplin. it seems to have fixed my problem since I no longer get the error

Last error: Error: Could not initialise synchroniser: Error: Directory could not be created. Path: /storage/40BE-5197/globalsync

I no longer get the error, but joplin does not import the synchronized .md files. I changed syncthing to save the joplin files to /storage/40BE-5197/sync/joplinapp and changed the Joplin to synchronize to that location, but only one of the files has synchronized to my phone.

I can see the files saved on my phone /run/user/1000/gvfs/mtp:host=*/SD card/sync/joplinapp when I check that directory, so I don't know why the rest of the files are not synchronizing. I don't think encryption is the problem because I've configured it on both devices.

I'd suggest to clear the Joplin app data on the phone and try to set it up again from scratch. I had a similar problem before and this is what helped solve it. Basically, the proper order was to install Joplin first, then run the ADB commands, and only then enter the filesystem sync path and try to perform the synchronisation.

It looks like clearing all joplinapp data, running adb shell cmd appops set net.cozic.joplin android:no_isolated_storage allow && adb shell cmd appops set net.cozic.joplin android:legacy_storage allow && adb shell am force-stop net.cozic.joplin again, and enabling storage permissions has fixed the problem. at first the notes would not decrypt, but I forced stopped the app and reopened, which fixed that problem.

I'm not sure what is going on now... Syncthing on my computer says "syncing 70%" and is counting down, Syncthing on my phone says syncing "Idle" and joplin says

Updated remote Items: * (counting up)
Decrypting items */100 counting to 100 and then restarting

I don't know if this means there is conflict as Joplin mobile is performing synchronization... I have syncthing on android set to "receive only" so that none of the files on my PC are changed before the apps are configured correctly, but this may be the source of the problem.

It sounds like a different issue, unrelated to the folder set to "receive only". It should still sync and decrypt the notes, even if you just copied the folder to Android manually instead of using Syncthing, etc.

I don't use Joplin encryption, so I've got no real idea what the problem may be about, but I can only suggest to make a backup of the whole folder on the computer before doing more experiments, just to be extra safe.

I'm not exactly sure why I had that problem, but I suspect it had something to do with improperly configuring Joplin's encryption on my phone...

Either way, I wiped the Joplin & Syncthing data from my phone and restarted with the steps below:

I will do some more troubleshooting but this seems to have solved my problem (including the joplin encryption)

Solution instructions (sync joplinapp from linux to android):

If there are any joplinapp support/staff watching this, you should put these instructions somewhere on Joplinapp dot org so other android users don't have to look very far to get a solution.

  • Enable USB Debugging on the phone and install adb (in linux) sudo apt install -y adb
  • Connect the phone to the PC (and allow access to phone)
  • clear syncthing data on android device and do not turn the app back on (If already paired to the PC)
  • remove the android device from syncthing PC (If already paired to the PC)
  • On PC: Actions > Show ID
  • Syncthing on Phone: Hamburger Menu > Settings > Run Conditions > [Select "Run on Wi-Fi" and "Run on metered Wi-Fi" and "Run on mobile data"]
  • On Phone: [open syncthing] > Devices > "+" [scan ID on PC]
  • On PC: accept new device and share file directory with the new device
  • On Phone: Open dropdown and choose sync directory for new shared folder and copy the directory to Configuration > Synchronization > Directory to synchronize with (absolute path)
  • Open Joplin mobile
  • Use adb to grant file permissions to joplin (adb shell cmd appops set net.cozic.joplin android:no_isolated_storage allow && adb shell cmd appops set net.cozic.joplin android:legacy_storage allow && adb shell am force-stop net.cozic.joplin)
  • Copy syncthing directory plus the joplin-specific items directory and set them in `Configuration > Synchronization > File system
  • Joplin Mobile: Synchronize
  • Configure encryption password when prompted
  • Force close Joplin mobile and reopen
2 Likes

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.