My synapse upgrade from 1.157.2~ynh1 to 1.160.0 failed because there were not enough space left on disk.
The restore process failed too.
After freeing up some disk space, the restore process keeps failing, because Go is apparently missing:
DEBUG - + sudo -u synapse env PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin COREPACK_ENABLE_DOWNLOAD_PROMPT=0 NPM_CONFIG_UPDATE_NOTIFIER=false go build -o lk-jwt-service .
DEBUG - env: ‘go’: No such file or directory
This topic describes a similar problem but didn’t find a solution in it.
After restoring the archive in CLI with --no-remove-on-failure I forced the upgrade and synapse is working again!
But after reconnect my differents clients (element on desktop, element on mobile), it’s look like an empty server (I loose all my channels/conversations).
Is there anything I can do to recover the data?
(It seems my backup contains the data… And folder /home/yunohost.app/synapse is still full of media)
Here’s how the story ends:
The synapse database was simply empty because it couldn’t be restored—the restore script failed before reaching that step.
So here are the steps to resolve this restoration issue if anyone else finds themselves in the same situation: (thanks a lot @otm33 for your help and @Lapineige for further details)
Check that you have enough available disk space
Restore the backup using the --no-remove-on-failure flag: yunohost backup restore synapse-pre-upgrade1 --no-remove-on-failure
Make a copy of your synapse backup (or rename it) in order to prevent it from being removed in the next step (you’ll need it in step 8)
Force the application upgrade: yunohost app upgrade synapse -b --force
Extract the database dump from synapse backup: tar -xf /home/yunohost.backup/archives/SYNAPSE_ARCHIVE.tar -C /tmp/synapse-backup apps/synapse/backup/dump.sql
Restore the db dump into postgresql: sudo -u postgres psql -d synapse < /tmp/synapse-backup/apps/synapse/backup/dump.sql
Start Synapse service sudo systemctl start synapse
Note that all your devices will need to be verified again. I didn’t find a way to avoid that (but there might be a trick to doing it?)
For readers : please note that -b option, that will result in that forced upgrade not making a backup prior to the upgrade. If that were the case, your synapse-pre-upgradeX backup would be removed !
I dropped the database: sudo -u postgres psql -c "DROP DATABASE synapse;"
Then I recreated it with correct encoding: sudo -u postgres psql -c "CREATE DATABASE synapse OWNER synapse ENCODING 'UTF8' LC_COLLATE 'C' LC_CTYPE 'C' TEMPLATE template0;"
I extracted the database dump from my synapse backup: tar -xf /home/yunohost.backup/archives/SYNAPSE_ARCHIVE.tar -C /tmp/synapse-backup apps/synapse/backup/dump.sql
I restored the db dump into postgresql: sudo -u postgres psql -d synapse < /tmp/synapse-backup/apps/synapse/backup/dump.sql
Indeed, I had to enter my recovery secret to be verified again… But in my memories it has worked.
May be there is a trick to avoid this annoying step (one of my user did not have its recovery secret), but I didn’t find how to do that)
I’m not asked for the recovery secret, only to reset everything, verify the device (which fails) or give the recovery keys file (which I don’t have with me right now so I can’t try it yet).
And I guess the recovery key sync on server side is lost/not working ?
In fact I’m not sure if my server is correctly restored, but I can’t restore my verification key (I tried an old one, it does nothing), or if the server stays empty.
I’ve been logged out of every session btw.
It’s a pity, I don’t even have access to message history in the client app if the server is messed up…
Does someone knows how I can check if there is any data on the server ?
And if it’s possible to dump the recovery key (which are supposed to be backed up on server side) ?