YunoHost-Apps / synapse_ynh

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

Fresh Install Fails: "cannot import name _OpenSSLECCurve" #49

Closed KibaFox closed 6 years ago

KibaFox commented 6 years ago

I'm currently evaluating migrating my self hosting solutions over to Yunohost and after a fresh install on Digital Ocean, I cannot install the Synapse application.

I'm using Digital Ocean's Debian 8.10 x64 image as a base and I followed the instructions to install manually.

I've repeated this a couple of times and found the same result.

Here is the output from attempting to install from the command line.

$ sudo yunohost app install synapse
Available domains:
- ***.***.***
Choose a domain for Synapse (default: ***.***.***):
Is it a public server ? [0 | 1] (default: 0):
Warning: Generating DH parameters, 2048 bit long safe prime, generator 2
Warning: This is going to take a long time
Warning: .......................+.......................+................................+....+.............................................................................................................
.+..........................................................................................+............................................................................................+..................
....+............................................................+...................................................................................+......................................................
.................................................................................................................................+.........+................................................................
............................................................................................................................................................................................................
................................................................................+........................................................................................................++*++*
Extracting templates from packages: 100%
Warning: Synchronizing state for postgresql.service with sysvinit using update-rc.d...
Warning: Executing /usr/sbin/update-rc.d postgresql defaults
Warning: Executing /usr/sbin/update-rc.d postgresql enable
Warning: 2018-05-24 07:01:51 URL:https://codeload.github.com/matrix-org/synapse/tar.gz/v0.27.2 [932894] -> "synapse_source.tar.gz" [1]
Warning: Created symlink from /etc/systemd/system/multi-user.target.wants/matrix-synapse.service to /etc/systemd/system/matrix-synapse.service.
Warning: Created symlink from /etc/systemd/system/multi-user.target.wants/coturn-synapse.service to /etc/systemd/system/coturn-synapse.service.
Warning: Starting of matrix-synapse
Warning: Job for matrix-synapse.service failed. See 'systemctl status matrix-synapse.service' and 'journalctl -xn' for details.
Warning: !!
Warning:   synapse's script has encountered an error. Its execution was cancelled.
Warning: !!
Warning:
Warning: Removed symlink /etc/systemd/system/multi-user.target.wants/matrix-synapse.service.
Warning: Removed symlink /etc/systemd/system/multi-user.target.wants/coturn-synapse.service.
Warning: Port 8448 is already closed for IPv4 connections
Warning: Port 8448 is already closed for IPv6 connections
Warning: Remove the user matrix-synapse
Success! The SSOwat configuration has been generated
Error: Installation failed

It fails to start the matrix-synapse.service via Systemd and aborts the install. When I check the logs via journalctl I see this:

$ sudo journalctl -u matrix-synapse.service
-- Logs begin at Thu 2018-05-24 06:51:47 UTC, end at Thu 2018-05-24 07:04:27 UTC. --
May 24 07:02:49 test.neokitsune.com systemd[1]: Starting Synapse Matrix homeserver...
May 24 07:02:49 test.neokitsune.com python[11550]: Traceback (most recent call last):
May 24 07:02:49 test.neokitsune.com python[11550]: File "/usr/lib/python2.7/runpy.py", line 162, in _run_module_as_main
May 24 07:02:49 test.neokitsune.com python[11550]: "__main__", fname, loader, pkg_name)
May 24 07:02:49 test.neokitsune.com python[11550]: File "/usr/lib/python2.7/runpy.py", line 72, in _run_code
May 24 07:02:49 test.neokitsune.com python[11550]: exec code in run_globals
May 24 07:02:49 test.neokitsune.com python[11550]: File "/opt/yunohost/matrix-synapse/lib/python2.7/site-packages/synapse/app/homeserver.py", line 31, in <module>
May 24 07:02:49 test.neokitsune.com python[11550]: from synapse.crypto import context_factory
May 24 07:02:49 test.neokitsune.com python[11550]: File "/opt/yunohost/matrix-synapse/local/lib/python2.7/site-packages/synapse/crypto/context_factory.py", line 17, in <module>
May 24 07:02:49 test.neokitsune.com python[11550]: from twisted.internet._sslverify import _OpenSSLECCurve, _defaultCurveName
May 24 07:02:49 test.neokitsune.com python[11550]: ImportError: cannot import name _OpenSSLECCurve
May 24 07:02:49 test.neokitsune.com systemd[1]: matrix-synapse.service: control process exited, code=exited status=1
May 24 07:02:49 test.neokitsune.com systemd[1]: Failed to start Synapse Matrix homeserver.
May 24 07:02:49 test.neokitsune.com systemd[1]: Unit matrix-synapse.service entered failed state.
May 24 07:02:50 test.neokitsune.com systemd[1]: Stopping Synapse Matrix homeserver...
May 24 07:02:50 test.neokitsune.com systemd[1]: Stopped Synapse Matrix homeserver.

The key error here appears to be: cannot import name _OpenSSLECCurve

KibaFox commented 6 years ago

Here is a snippet from official.json at the time of the issue.

"synapse": {
    "git": {
        "branch": "master",
        "revision": "3e91f1c31620d68d5d1f5007ef690c7404aa3f7c",
        "url": "https://github.com/YunoHost-Apps/synapse_ynh"
    },
    "lastUpdate": 1523908838
}
alexAubin commented 6 years ago

Indeed, the list points to an old commit which does not include the recent fixes ... we need to update https://github.com/YunoHost/apps/blob/master/official.json (and ideally really think about using 'HEAD' as a long-term solution to avoid all these headaches of forgetting to update the list ...)

In the meantime, installing from the explicit URL "https://github.com/YunoHost-Apps/synapse_ynh" should work

KibaFox commented 6 years ago

Thank you, @alexAubin!

KibaFox commented 6 years ago

@alexAubin - do you mean putting using 'HEAD' as the revision in the official.json list? Seeing that would make me a little nervous, since it relies on the master branch to always be stable.

You could possibly adopt something like Docker tags, where the default is to pull the latest tag. When you want to release a version of master, you move the latest tag. This is still something to remember to do, but it shifts the responsibility to this project rather than updating the official.json.

Just a thought. I'm not familiar with your release process.

alexAubin commented 6 years ago

Yes, this was something we started discussing a while ago now. Thing is, we already do (as far as (at least) official apps are concerned) all development in a testing branch and merge it in master once it's dimmed stable. So updating the commit in official.json is just another step that can be automated - hence the use of HEAD.

We could indeed have other strategies, using proper tags and release, but that also implies some more knowledge of git/github in general and would need to change existing processes.

On the "security aspect" side, using master/HEAD as stable means that any people with push-permissions to the repo can trigger an upgrade on people's instance, but those people are actually the same people with push-permissions to YunoHost/Apps so :wink:

KibaFox commented 6 years ago

That makes sense and I think that'll simplify the process a lot. :)

KibaFox commented 6 years ago

Installation succeeds. Since it's not an issue with this project, I'm going to go ahead and close the ticket.