YunoHost-Apps / synapse_ynh

Matrix server (synapse) package for YunoHost
https://matrix.org/
GNU General Public License v3.0
79 stars 43 forks source link

Upgrade to synapse 1.92.3~ynh1 fails and backup restore fails. Leaving no synapse install. #419

Closed BcBrett closed 8 months ago

BcBrett commented 8 months ago

Describe the bug

Last night I attempted to update my yunohost install, everything went well with system update and getting yunohost to 11.2.5 stable. Everything went well, other apps updated then I went on to synapse to give it a go after recovering from an upgrade that failed on sept 30. This time it failed as well and the restore also failed leaving no synapse app installed at all. it appears the backup tar was corrupt so I finally just went to trying to restore the backup from sept 30, hopefully the only consequence would be missing a few weeks of history which is no big deal. This restore also fails, not sure what I did to make it work last time but doesn't seem to want to work now. I had used the solution in the comments of https://github.com/YunoHost-Apps/synapse_ynh/issues/414 before to get things working

Context

Steps to reproduce

In this instance I am trying to restore a previous backup so I used the solution provided in issue 414 which is now closed but boils down to this: cd /home/yunohost.backup/archives/ ls -l synapse-pre-upgrade* # This is to double check the name of the backup, adjust the file name accordingly later, and take the latest cp synapse-pre-upgrade2.tar synapse-pre-upgrade2.tar.bak # Make a backup of the existing backup before modifying, just in case tar --delete --file synapse-pre-upgrade2.tar apps/synapse/backup/opt/yunohost/matrix-synapse/lib/python3.9/site-packages/setuptools_rust apps/synapse/backup/opt/yunohost/matrix-synapse/lib/python3.9/site-packages/setuptools_rust-1.7.0.dist-info yunohost backup restore synapse-pre-upgrade2 (I added the --app synapse to this also, fails either way, just 1 less warning)

the above via cli didnt work and neither did restore from web admin. These are the logs that the failure generated: https://paste.yunohost.org/raw/avomoginuf

Not sure where it all goes wrong but there's probably plenty its not happy with. Full log is at the link above, the last bit of it is pasted below

Expected behavior

I'd like to restore my backup, but it seems the odds or my lack of knowledge are stacked against me, honestly not sure how I made it work for the last 5 or so years. I guess that's a complement to the yunohost team, pulling off nextcloud, invidious, synapse and synapse admin for this long is only because of the great job they have done.

Logs

2023-10-14 14:04:48,047: DEBUG - Oct 14 14:04:47 python[74951]: File "/usr/lib/python3.9/runpy.py", line 197, in _run_module_as_main 2023-10-14 14:04:48,047: DEBUG - Oct 14 14:04:47 python[74951]: return _run_code(code, main_globals, None, 2023-10-14 14:04:48,047: DEBUG - Oct 14 14:04:47 python[74951]: File "/usr/lib/python3.9/runpy.py", line 87, in _run_code 2023-10-14 14:04:48,047: DEBUG - Oct 14 14:04:47 python[74951]: exec(code, run_globals) 2023-10-14 14:04:48,048: DEBUG - Oct 14 14:04:47 python[74951]: File "/opt/yunohost/matrix-synapse/lib/python3.9/site-packages/synapse/app/homeserver.py", line 28, in 2023-10-14 14:04:48,048: DEBUG - Oct 14 14:04:47 python[74951]: from synapse.api.urls import ( 2023-10-14 14:04:48,048: DEBUG - Oct 14 14:04:47 python[74951]: File "/opt/yunohost/matrix-synapse/lib/python3.9/site-packages/synapse/api/urls.py", line 22, in 2023-10-14 14:04:48,048: DEBUG - Oct 14 14:04:47 python[74951]: from synapse.config.homeserver import HomeServerConfig 2023-10-14 14:04:48,048: DEBUG - Oct 14 14:04:47 python[74951]: File "/opt/yunohost/matrix-synapse/lib/python3.9/site-packages/synapse/config/homeserver.py", line 51, in 2023-10-14 14:04:48,049: DEBUG - Oct 14 14:04:47 python[74951]: from .tls import TlsConfig 2023-10-14 14:04:48,049: DEBUG - Oct 14 14:04:47 python[74951]: File "/opt/yunohost/matrix-synapse/lib/python3.9/site-packages/synapse/config/tls.py", line 20, in 2023-10-14 14:04:48,049: DEBUG - Oct 14 14:04:47 python[74951]: from OpenSSL import SSL, crypto 2023-10-14 14:04:48,049: DEBUG - Oct 14 14:04:47 python[74951]: ModuleNotFoundError: No module named '\''OpenSSL'\'' 2023-10-14 14:04:48,049: DEBUG - Oct 14 14:04:47 systemd[1]: matrix-synapse.service: Control process exited, code=exited, status=1/FAILURE 2023-10-14 14:04:48,050: DEBUG - Oct 14 14:04:47 systemd[1]: matrix-synapse.service: Failed with result '\''exit-code'\''. 2023-10-14 14:04:48,050: DEBUG - Oct 14 14:04:47 systemd[1]: Failed to start Synapse Matrix homeserver. 2023-10-14 14:04:48,050: DEBUG - Oct 14 14:04:47 systemd[1]: matrix-synapse.service: Consumed 1.290s CPU time.' 2023-10-14 14:04:48,050: DEBUG - + '[' -e /var/log/matrix-synapse/homeserver.log ']' 2023-10-14 14:04:48,051: DEBUG - + ynh_clean_check_starting 2023-10-14 14:04:48,051: DEBUG - + '[' -n 74945 ']' 2023-10-14 14:04:48,051: DEBUG - + kill -SIGTERM 74945 2023-10-14 14:04:48,051: DEBUG - + '[' -n /tmp/tmp.20ECfSAyp7 ']' 2023-10-14 14:04:48,051: DEBUG - + ynh_secure_remove --file=/tmp/tmp.20ECfSAyp7 2023-10-14 14:04:48,052: WARNING - [Error] Oct 14 13:05:53 systemd[1]: matrix-synapse.service: Failed with result 'exit-code'. 2023-10-14 14:04:48,053: WARNING - Oct 14 14:04:46 systemd[1]: Starting Synapse Matrix homeserver... 2023-10-14 14:04:48,053: WARNING - Oct 14 14:04:47 python[74951]: Traceback (most recent call last): 2023-10-14 14:04:48,053: WARNING - Oct 14 14:04:47 python[74951]: File "/usr/lib/python3.9/runpy.py", line 197, in _run_module_as_main 2023-10-14 14:04:48,053: WARNING - Oct 14 14:04:47 python[74951]: return _run_code(code, main_globals, None, 2023-10-14 14:04:48,053: WARNING - Oct 14 14:04:47 python[74951]: File "/usr/lib/python3.9/runpy.py", line 87, in _run_code 2023-10-14 14:04:48,054: WARNING - Oct 14 14:04:47 python[74951]: exec(code, run_globals) 2023-10-14 14:04:48,054: WARNING - Oct 14 14:04:47 python[74951]: File "/opt/yunohost/matrix-synapse/lib/python3.9/site-packages/synapse/app/homeserver.py", line 28, in 2023-10-14 14:04:48,054: WARNING - Oct 14 14:04:47 python[74951]: from synapse.api.urls import ( 2023-10-14 14:04:48,054: WARNING - Oct 14 14:04:47 python[74951]: File "/opt/yunohost/matrix-synapse/lib/python3.9/site-packages/synapse/api/urls.py", line 22, in 2023-10-14 14:04:48,054: WARNING - Oct 14 14:04:47 python[74951]: from synapse.config.homeserver import HomeServerConfig 2023-10-14 14:04:48,055: WARNING - Oct 14 14:04:47 python[74951]: File "/opt/yunohost/matrix-synapse/lib/python3.9/site-packages/synapse/config/homeserver.py", line 51, in 2023-10-14 14:04:48,055: WARNING - Oct 14 14:04:47 python[74951]: from .tls import TlsConfig 2023-10-14 14:04:48,055: WARNING - Oct 14 14:04:47 python[74951]: File "/opt/yunohost/matrix-synapse/lib/python3.9/site-packages/synapse/config/tls.py", line 20, in 2023-10-14 14:04:48,055: WARNING - Oct 14 14:04:47 python[74951]: from OpenSSL import SSL, crypto 2023-10-14 14:04:48,056: WARNING - Oct 14 14:04:47 python[74951]: ModuleNotFoundError: No module named 'OpenSSL' 2023-10-14 14:04:48,056: WARNING - Oct 14 14:04:47 systemd[1]: matrix-synapse.service: Control process exited, code=exited, status=1/FAILURE 2023-10-14 14:04:48,056: WARNING - Oct 14 14:04:47 systemd[1]: matrix-synapse.service: Failed with result 'exit-code'. 2023-10-14 14:04:48,056: WARNING - Oct 14 14:04:47 systemd[1]: Failed to start Synapse Matrix homeserver. 2023-10-14 14:04:48,057: WARNING - Oct 14 14:04:47 systemd[1]: matrix-synapse.service: Consumed 1.290s CPU time. 2023-10-14 14:04:48,077: DEBUG - + return 1 2023-10-14 14:04:48,077: DEBUG - + ynh_exit_properly 2023-10-14 14:04:48,077: DEBUG - + [[ restore =~ ^install$|^upgrade$|^restore$ ]] 2023-10-14 14:04:48,581: DEBUG - + ynh_clean_setup 2023-10-14 14:04:48,582: DEBUG - + ynh_clean_check_starting 2023-10-14 14:04:48,582: DEBUG - + '[' -n '' ']' 2023-10-14 14:04:48,582: DEBUG - + '[' -n '' ']' 2023-10-14 14:04:49,585: ERROR - Could not restore synapse: An error occured inside the app restore script

Thanks for your help.

BcBrett commented 8 months ago

Solved by getting rid of the whole instance. 5ish years is a good run for someone who doesn't know what they are doing. Fresh server, fresh yunohost, going to try xmpp again.