[Solved] Synapse upgrade fails, restore fails (setuptools 60 vs 68? psycopg2?)

Solved!

The solution was indeed removing the if/else that @CatsLover71 mentioned!

So, for the next victim I’ll copy the commands I used:


cd /home/yunohost.backup/archives/
tar -czf synapse-pre-upgrade2.tar.gz.org synapse-pre-upgrade2.tar
tar tvf synapse-pre-upgrade2.tar |grep common
tar xf synapse-pre-upgrade2.tar apps/synapse/settings/scripts/_common.sh
vi apps/synapse/settings/scripts/_common.sh 
tar uvf synapse-pre-upgrade2.tar apps/synapse/settings/scripts/_common.sh
rm -rf apps/
yunohost backup restore synapse-pre-upgrade2

There was some trialing and erroring, so I redacted the commands for clarity’s sake but did not re-run to test them afterwards.
The long story, based on the commands above, is:

  • go to your archives
  • make a (compressed) backup of the backup that you might damage while experimenting
  • search the Synapse-backup for the common.sh file
  • extract the file
  • edit to reflect catslovers71’s suggestion
  • update the tarball with the changed common.sh file
  • tidy: remove the directory that was created when extracting the file
  • restore the backup

My actual commands differed a bit, also because I first tried if Synapse still was installable at all on my system:

yunohost app remove synapse
cd /home/yunohost.app/matrix-synapse/
mv matrix-synapse/ matrix-synapse/tmp
cp -r matrix-synapse20231013.223321/ matrix-synapse/

I was smart enough to remove the temporary installation of Synapse, but restore didn’t work: it complained about the app-dir. I removed the app dir, and renamed th ereserve copy that was created on installation (it renamed the existing directory).

Another thing that broke, was the link between the yaml-file and the actual backup. At first I compressed synapse-pre-upgrade2.tar to synapse-pre-upgrade2.tar.gz, which seemed a good idea at that point. I think there is some logic that tries to first find backupfilename.tar.gz with a corresponding backupfilename.yaml, and only if it not exists, tries to find backupfilename.tar. So when I compressed to synapse-pre-upgrade2.tar.gz, that file was found by yunohost backup restore synapse , but no corresponding yaml, ending in error.

Nearing the end of this post, I got this nagging feeling I forgot something. I actually did: the restore is done, but upgrade not yet!

To be continued…