Cannot restore synapse from backup


My YunoHost server

Hardware: VPS bought online
YunoHost version:
I have access to my server : Through SSH
Are you in a special context or did you perform some particular tweaking on your YunoHost instance ? : no

Description of my issue

After a failed synapse upgrade, I can’t restore from backup. When restoring, I get a “Nothing was restored” error message and the following logs:

Crucial error message seems to be:

[4624]:   File "/opt/yunohost/matrix-synapse/lib/python3.7/site-packages/twisted/internet/", line 19, in <module>
    from twisted.internet import error, tcp, udp
  File "/opt/yunohost/matrix-synapse/lib/python3.7/site-packages/twisted/internet/", line 38, in <module>
    from twisted.internet._newtls import (
  File "/opt/yunohost/matrix-synapse/lib/python3.7/site-packages/twisted/internet/", line 18, in <module>
    from twisted.protocols.tls import TLSMemoryBIOFactory, TLSMemoryBIOProtocol
  File "/opt/yunohost/matrix-synapse/lib/python3.7/site-packages/twisted/protocols/", line 45, in <module>
    from twisted.internet._sslverify import _setAcceptableProtocols
  File "/opt/yunohost/matrix-synapse/lib/python3.7/site-packages/twisted/internet/", line 1829, in <module>
  File "/opt/yunohost/matrix-synapse/lib/python3.7/site-packages/twisted/internet/", line 1808, in fromOpenSSLCipherString
  File "/opt/yunohost/matrix-synapse/lib/python3.7/site-packages/twisted/internet/", line 1735, in _expandCipherString
    ctx = SSL.Context(method)
  File "/opt/yunohost/matrix-synapse/lib/python3.7/site-packages/OpenSSL/", line 674, in __init__
    res = _lib.SSL_CTX_set_ecdh_auto(context, 1)
AttributeError: module 'lib' has no attribute 'SSL_CTX_set_ecdh_auto'

I also can’t install new instance of synapse because there are some leftovers from the previous installation:

The user ‘synapse’ already exists

I can’t delete that user:

$ sudo yunohost user delete synapse
Error: Unknown user: synapse

EDIT: I retried the fresh installation and it worked. Now, to somehow recover the data from backup…

I managed to solve this issue by using the following steps:

  1. Download the backup
  2. Install a fresh instance of synapse
  3. Stop the matrix-synapse service
  4. Download the contents of /opt/yunohost/matrix-synapse/lib/
  5. Unpack the backup from step 1. Then, replace the contents of the apps/synapse/backup/opt/yunohost/matrix-synapse/lib with the files downloaded in step 4
  6. Replace the contents of app/synapse/backup/opt/yunohost/matrix-synapse/lib/pyhon3.7/site-packages/jinja2 with this:
  7. Tar the unpacked modified backup directory and upload it in place of the original one to /home/yunohost.backup/archives.

The restore went green and I can see some of the old messages. I seem to have lost the uploaded media, though

1 Like

Nice that you have your Matrix back!

Bummer :frowning:

Uploads are in the /home/*-directories.

The files are encrypted by the clients before they are sent to Synapse, so Synapse only stores the encrypted data.

Are there files in those directories? If not, do you see them in the backup?

1 Like

Ah. There are three directories:


the third one is the largest. But the first one already has things in it… not sure if I can merge them somehow?

The directories you mention, are they in the backup or in the /home/

In the latter case, do you think there are already many new uploads? I think those are in the directory without a timestamp.

I would myself: create a backup directory, copy things from the first dir (without timestamp) to the backup dir. Then copy things from the 20221005-dir to the first dir, and check whether you got your uploads back.


I decided against doing any merging… I’ll try to be mindful of that directory the next time an update fails :stuck_out_tongue:

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