Synapse cannot be updated - shutdown

What type of hardware are you using: VPS bought online
What YunoHost version are you running: 12.0.17
What app is this about: Synapse

Describe your issue

I was executing the upgrade of Synapse matrix server app from the web admin UI. That failed with an internal error (log included). The script then tried to restore the old state from backup, which failed too, see logs.

In either case, the message said an error occured inside the app upgrade script and app restore script, respectively.

Since there are some users actively using the matrix server, it would be nice to solve the problem.
Any help will be appreciated!

Share relevant logs or error messages

Upgrade log:
https://paste.yunohost.org/raw/oditusutak

Restore log:
https://paste.yunohost.org/raw/qexocofowu

I tried to restore the last backup again. The same errror with my own translation:

Could not restore synapse: An error occured in restore script of the application

That sound quite summary. I don’t see any details.

Is there any chance to get more debug information somewhere?

So far, my synapse server has been uninstalled and deleted.

Thank you in advance!

It would be great if someone could have a look into the error. Thanks.

It seem to be an issue with the go helper, but I wasn’t able to investigate more because it’s not easy to debug remotely and the log don’t give a lot of details why it crashed. And I didn’t have time to investigate more deeply around this. The way to debug would be to run manually the helper to have maybe more details what happen.

Thanks for your response! I was away and offline for four days.

What can I do to run the “helper”?

Same here

Back from one week holidays, I am going to look into this problem again.

Since Synapse is claimed to be uninstalled anyway, I tried to install Synapse from ground. This failed even before I could enter the Synapse settings like subdomain etc.

There is no log at all.

The error is contained in a popup window in the browser, message: An internal error has occured, we are really sorry.

Fehler: "500"
Aktion: "GET" /yunohost/api/domains/*/cert?full&locale=de

Stacktrace:

Traceback (most recent call last):
  File "/usr/lib/python3/dist-packages/moulinette/utils/filesystem.py", line 83, in read_json
    loaded_json = json.loads(file_content)
                  ^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.11/json/__init__.py", line 346, in loads
    return _default_decoder.decode(s)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.11/json/decoder.py", line 337, in decode
    obj, end = self.raw_decode(s, idx=_w(s, 0).end())
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.11/json/decoder.py", line 355, in raw_decode
    raise JSONDecodeError("Expecting value", s, err.value) from None
json.decoder.JSONDecodeError: Expecting value: line 1 column 1 (char 0)

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/usr/lib/python3/dist-packages/yunohost/certificate.py", line 98, in certificate_status
    _check_domain_is_ready_for_ACME(domain)
  File "/usr/lib/python3/dist-packages/yunohost/certificate.py", line 788, in _check_domain_is_ready_for_ACME
    Diagnoser.get_cached_report(
  File "/usr/lib/python3/dist-packages/yunohost/diagnosis.py", line 524, in get_cached_report
    report = read_json(cache_file)
             ^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3/dist-packages/moulinette/utils/filesystem.py", line 85, in read_json
    raise MoulinetteError("corrupted_json", ressource=file_path, error=str(e))
moulinette.core.MoulinetteError: Beschädigtes JSON gelesen von /var/cache/yunohost/diagnosis/dnsrecords.json (reason: Expecting value: line 1 column 1 (char 0))

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/usr/lib/python3/dist-packages/moulinette/interfaces/api.py", line 498, in process
    ret = self.actionsmap.process(arguments, timeout=30, route=_route)
          ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3/dist-packages/moulinette/actionsmap.py", line 579, in process
    return func(**arguments)
           ^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3/dist-packages/yunohost/domain.py", line 968, in domain_cert_status
    return certificate_status(domain_list, full)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3/dist-packages/yunohost/certificate.py", line 101, in certificate_status
    if e.key == "certmanager_domain_not_diagnosed_yet":
       ^^^^^
AttributeError: 'MoulinetteError' object has no attribute 'key'

The same error occurs when installing any application. It is not a Synapse issue.

I solved the last problem (Unable to install any app - #7 by matalb), now back to this one.

Doing e fresh installation of the Synapse app, I got a similar error as before An error occured in the installation script. No details.

Log :
https://paste.yunohost.org/raw/enahagilel

The loglevel is on DEBUG, why can we not see the error reason?

Where is the “go helper” located? Is it Synapse-specific or general to Yunohost?

I believe the install script is buggy because it does not show the error properly.

Since I am not sure if it is Synapse-specific, I need some help about hat. Has every app its own install script?

The go helper is a generic Yunohost helper so it’s not specific to Synapse.

You have the source of the helper here: yunohost/helpers/helpers.v2.1.d/go at dev · YunoHost/yunohost · GitHub

Thanks for your response.

How can the diagnostic output (logs etc.) be improved? Maybe by setting environment variables?

Which script(s) are run when installing Synapse?

Well the issue is that we use goenv whish is an external project and it seem that the crash is around this.

We install go in the synapse package here: synapse_ynh/scripts/_common.sh at 358fbb9078e5d92bce386918199bf663f1137370 · YunoHost-Apps/synapse_ynh · GitHub

And the install script is here: synapse_ynh/scripts/install at 358fbb9078e5d92bce386918199bf663f1137370 · YunoHost-Apps/synapse_ynh · GitHub

I am not used to bash scripts, so my ideas might sound primitive to experienced users.

Is it possible to increase the amount of output messages in some way?

As I remeber of Windowes batch files, there I can set echo on in the first line and every statement is written out. Then I could see the last statement before the crash.

That may be what happens anyway, but I cannot find the DEBUG log statements in the install script.

On Yunohost side we already execute all bash script with -x whish show everything. But the issue here is that we execute an extra script from external project so it could be a bit more complex to debug. Would probably need to investigate more around the external goenv project.

Is it that line #64 where go is being installed (synapse_ynh/scripts/_common.sh at 358fbb9078e5d92bce386918199bf663f1137370 · YunoHost-Apps/synapse_ynh · GitHub)?

It reads

ynh_hide_warnings ynh_go_install

I would desperately like to know what is going wrong while line #64 is being executed. Instead of ynh_hide_warnings something like ynh_log_debug would be very helpful.

Note that following the implementation it just redirect stderr to stdout cf: yunohost/helpers/helpers.v2.1.d/logging at 477bf84bf40cae532da7b152ba766a072046b3a2 · YunoHost/yunohost · GitHub

So the full log you have all log, nothing is lost.