Syncthing-fork: New config format prevents migration from legacy Syncthing app

Today I went to migrate from Syncthing to Syncthing-fork and found out that the import/export format was just changed. Oops!

I had to install an older version of Syncthing-fork from F-Droid, import the config, and then update the app.

Would it be possible to have the new app support both formats (only for importing), preferring the new format if present? This would make it possible for users to migrate even after the current oldest F-Droid version is removed.

It seems that starting from a certain sub-version of 1.29, the format of the backup file has changed from separate files to packaged zip files.

The difference between the two is limited to this. You can manually compress the config folder of the old version into config.zip to import the new version of the application, or decompress config.zip to import the old version of the application (not recommended, only between v1 versions, because v2 version has modified the database type and configuration file format).

It should be noted that the config.zip automatically generated when exporting the configuration in version 1.29 may have format errors, resulting in failure to decompress normally, and of course, failure to import. In any case, backing up the entire config folder is a necessary operation.

This is not true. I tried compressing the files exported by the older Syncthing app into a ZIP service and Syncthing-fork would not import it:

importConfig: Failed to open zip, No file found with name sharedpreferences.dat in zip file

The export from Syncthing doesn’t include any file with this name.

I ran multiple tests last Saturday night, but all were between sub-versions of 1.29. Is your program before 1.29?

I just noticed a problem I overlooked. The official version of Syncthing’s Android app is at 1.28.1, and the backup format of Syncthing/Syncthing-Fork changed in 1.29. However, to switch from Syncthing to Syncthing-Fork, you must export the configuration file and then re-import it. Therefore, the current upgrade path for the Android version must be: Syncthing 1.28.x → Syncthing-Fork 1.28.x → Syncthing-Fork 1.29.x/2.x

If you want to switch to the Debug version of Syncthing-Fork at the same time, the situation will be more complicated: Syncthing 1.28.x → Syncthing-Fork 1.28.x/1.29.x (use config folder) → Compress config folder → Syncthing-Fork Debug 1.29.y (use config zip) → Syncthing-Fork Debug 2.x

Syncthing-Fork is just a wrapper, and its behavior should be the same across different operating systems, so @calmh maybe need to add compatibility with non-zip version backup file import.

I’m not sure in which version the sharedpreferences.dat file was added, which may make compatibility more complicated.

I have no involvement whatsoever with the Android apps, neither ours nor Catfriend1s fork. Don’t pull me into it :stuck_out_tongue:

2 Likes

There’s a step by step instruction on how to do the migration correctly: GitHub - Catfriend1/syncthing-android: Syncthing-Fork - A Syncthing Wrapper for Android.

If the checkpoint release v1.29.7.1 won’t be available on F-Droid in the future, you can still find it on the GitHub release page.

https://github.com/Catfriend1/syncthing-android/releases/download/v1.29.7.1/com.github.catfriend1.syncthingandroid_fdroid_1290701.apk

Zipping up the files yourself is a bad idea, as three files are missing. The new import function has a validator in place, to prevent “any zip with wrong stuff” from extracting.

I am not sure if it’s a good idea to write extra code to use the old bare-file import. Maybe that won’t go smoothly when the version jump between the last Syncthing-Android official and the fork increases over time.

3 Likes

Can you add a description in the app? Many people don’t read all the documentation carefully. :smiling_face_with_three_hearts:

Please feel free to PR one. I’m currently not in the mood putting for work into this as the deprecated app won’t get updates anymore. If it is revived someday, we could PR the ZIP export mechanism to make the both compatible again when users like to switch.

3 Likes

I just tried this from the Google Play version of Syncthing-Fork (v1.29.4.0) and it didn’t work on my wife’s phone. Both the GitHub and F-Droid 1.29.7.1 versions refused to install (“unknown error”) until I cleared the app data (even after uninstalling) the app.

Importing the backup from the export also failed (but of course I failed to write down the error message because I was in a hurry).

I’ll do some experimenting with upgrades on my wife’s old phone once I’ve finished transferring all the data (with Syncthing-Fork!), it might be a couple of days.