Cannot upgrade/restore/install Synapse - cryptography build fails

My YunoHost server

Hardware: VPS, amd64 arch
YunoHost version: 4.3.2
I have access to my server : all means
Are you in a special context or did you perform some particular tweaking on your YunoHost instance ? : no

Upgrading Synapse from 1.38.0 to 1.42.0.

Description of my issue

After 4.3.2 upgrade, I upgraded my apps and Synapse failed to upgrade, then restore. Separate reinstallation also fails, all with same error regarding cryptography build.

Full log: https://paste.yunohost.org/raw/yatasotenu

Log excerpt:

2021-11-06 10:40:38,927: DEBUG -   running build_rust
2021-11-06 10:40:38,927: DEBUG -       Updating crates.io index
2021-11-06 10:40:38,928: DEBUG - 
2021-11-06 10:40:38,928: DEBUG -       =============================DEBUG ASSISTANCE=============================
2021-11-06 10:40:38,928: DEBUG -       If you are seeing a compilation error please try the following steps to
2021-11-06 10:40:38,928: DEBUG -       successfully install cryptography:
2021-11-06 10:40:38,928: DEBUG -       1) Upgrade to the latest pip and try again. This will fix errors for most
2021-11-06 10:40:38,928: DEBUG -          users. See: https://pip.pypa.io/en/stable/installing/#upgrading-pip
2021-11-06 10:40:38,929: DEBUG -       2) Read https://cryptography.io/en/latest/installation/ for specific
2021-11-06 10:40:38,929: DEBUG -          instructions for your platform.
2021-11-06 10:40:38,929: DEBUG -       3) Check our frequently asked questions for more information:
2021-11-06 10:40:38,929: DEBUG -          https://cryptography.io/en/latest/faq/
2021-11-06 10:40:38,929: DEBUG -       4) Ensure you have a recent Rust toolchain installed:
2021-11-06 10:40:38,929: DEBUG -          https://cryptography.io/en/latest/installation/#rust
2021-11-06 10:40:38,929: DEBUG - 
2021-11-06 10:40:38,931: DEBUG -       Python: 3.7.3
2021-11-06 10:40:38,931: DEBUG -       platform: Linux-4.19.0-18-cloud-amd64-x86_64-with-debian-10.11
2021-11-06 10:40:38,931: DEBUG -       pip: 18.1
2021-11-06 10:40:38,931: DEBUG -       setuptools: 58.5.3
2021-11-06 10:40:38,931: DEBUG -       setuptools_rust: 0.12.1
2021-11-06 10:40:38,931: DEBUG -       =============================DEBUG ASSISTANCE=============================
2021-11-06 10:40:38,931: DEBUG - 
2021-11-06 10:40:38,931: DEBUG -   Traceback (most recent call last):
2021-11-06 10:40:38,932: DEBUG -     File "<string>", line 1, in <module>
2021-11-06 10:40:38,932: DEBUG -     File "/tmp/pip-install-hbh8_ycq/cryptography/setup.py", line 54, in <module>
2021-11-06 10:40:38,932: DEBUG -       rust_version=">=1.41.0",
2021-11-06 10:40:38,932: DEBUG -     File "/tmp/pip-build-env-ywwbbygt/lib/python3.7/site-packages/setuptools/__init__.py", line 159, in setup
2021-11-06 10:40:38,932: DEBUG -       return distutils.core.setup(**attrs)
2021-11-06 10:40:38,932: DEBUG -     File "/usr/lib/python3.7/distutils/core.py", line 148, in setup
2021-11-06 10:40:38,932: DEBUG -       dist.run_commands()
2021-11-06 10:40:38,932: DEBUG -     File "/usr/lib/python3.7/distutils/dist.py", line 966, in run_commands
2021-11-06 10:40:38,932: DEBUG -       self.run_command(cmd)
2021-11-06 10:40:38,932: DEBUG -     File "/usr/lib/python3.7/distutils/dist.py", line 985, in run_command
2021-11-06 10:40:38,932: DEBUG -       cmd_obj.run()
2021-11-06 10:40:38,932: DEBUG -     File "/tmp/pip-build-env-ywwbbygt/lib/python3.7/site-packages/wheel/bdist_wheel.py", line 299, in run
2021-11-06 10:40:38,933: DEBUG -       self.run_command('build')
2021-11-06 10:40:38,933: DEBUG -     File "/usr/lib/python3.7/distutils/cmd.py", line 313, in run_command
2021-11-06 10:40:38,933: DEBUG -       self.distribution.run_command(command)
2021-11-06 10:40:38,933: DEBUG -     File "/usr/lib/python3.7/distutils/dist.py", line 985, in run_command
2021-11-06 10:40:38,933: DEBUG -       cmd_obj.run()
2021-11-06 10:40:38,933: DEBUG -     File "/usr/lib/python3.7/distutils/command/build.py", line 135, in run
2021-11-06 10:40:38,933: DEBUG -       self.run_command(cmd_name)
2021-11-06 10:40:38,933: DEBUG -     File "/usr/lib/python3.7/distutils/cmd.py", line 313, in run_command
2021-11-06 10:40:38,933: DEBUG -       self.distribution.run_command(command)
2021-11-06 10:40:38,933: DEBUG -     File "/usr/lib/python3.7/distutils/dist.py", line 985, in run_command
2021-11-06 10:40:38,933: DEBUG -       cmd_obj.run()
2021-11-06 10:40:38,933: DEBUG -     File "/tmp/pip-build-env-ywwbbygt/lib/python3.7/site-packages/cffi/setuptools_ext.py", line 144, in run
2021-11-06 10:40:38,933: DEBUG -       base_class.run(self)
2021-11-06 10:40:38,934: DEBUG -     File "/tmp/pip-build-env-ywwbbygt/lib/python3.7/site-packages/setuptools_rust/setuptools_ext.py", line 103, in run
2021-11-06 10:40:38,934: DEBUG -       build_rust.run()
2021-11-06 10:40:38,934: DEBUG -     File "/tmp/pip-build-env-ywwbbygt/lib/python3.7/site-packages/setuptools_rust/command.py", line 52, in run
2021-11-06 10:40:38,934: DEBUG -       self.run_for_extension(ext)
2021-11-06 10:40:38,934: DEBUG -     File "/tmp/pip-build-env-ywwbbygt/lib/python3.7/site-packages/setuptools_rust/build.py", line 92, in run_for_extension
2021-11-06 10:40:38,934: DEBUG -       dylib_paths = self.build_extension(ext)
2021-11-06 10:40:38,934: DEBUG -     File "/tmp/pip-build-env-ywwbbygt/lib/python3.7/site-packages/setuptools_rust/build.py", line 131, in build_extension
2021-11-06 10:40:38,934: DEBUG -       metadata = json.loads(check_output(metadata_command))
2021-11-06 10:40:38,934: DEBUG -     File "/usr/lib/python3.7/subprocess.py", line 395, in check_output
2021-11-06 10:40:38,934: DEBUG -       **kwargs).stdout
2021-11-06 10:40:38,934: DEBUG -     File "/usr/lib/python3.7/subprocess.py", line 487, in run
2021-11-06 10:40:38,935: DEBUG -       output=stdout, stderr=stderr)
2021-11-06 10:40:38,935: DEBUG -   subprocess.CalledProcessError: Command '['cargo', 'metadata', '--manifest-path', 'src/rust/Cargo.toml', '--format-version', '1']' died with <Signals.SIGSEGV: 11>.
2021-11-06 10:40:38,939: DEBUG - 
2021-11-06 10:40:38,939: DEBUG -   ----------------------------------------
2021-11-06 10:40:38,939: WARNING -   Failed building wheel for cryptography
2021-11-06 10:40:38,943: DEBUG -   Running setup.py clean for cryptography
2021-11-06 10:40:39,819: DEBUG - Failed to build cryptography
2021-11-06 10:40:40,318: DEBUG - Installing collected packages: cryptography
2021-11-06 10:40:40,319: DEBUG -   Found existing installation: cryptography 3.4.7
2021-11-06 10:40:40,387: DEBUG -     Uninstalling cryptography-3.4.7:
2021-11-06 10:40:40,409: DEBUG -       Successfully uninstalled cryptography-3.4.7
2021-11-06 10:40:40,410: DEBUG -   Running setup.py install for cryptography: started
2021-11-06 10:40:41,775: DEBUG -     Running setup.py install for cryptography: finished with status 'error'
2021-11-06 10:40:41,776: DEBUG -     Complete output from command /opt/yunohost/matrix-synapse/bin/python3 -u -c "import setuptools, tokenize;__file__='/tmp/pip-install-hbh8_ycq/cryptography/setup.py';f=getattr(tokenize, 'open', open)(__file__);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, __file__, 'exec'))" install --record /tmp/pip-record-748aq9sd/install-record.txt --single-version-externally-managed --compile --install-headers /opt/yunohost/matrix-synapse/include/site/python3.7/cryptography:

Since then I have upgraded pip3 to v21.3.1, to no avail.

I noticed this bit in the log,


2021-11-06 10:40:25,912: DEBUG - Collecting cryptography>=3.4.7
2021-11-06 10:40:26,371: DEBUG -   Downloading https://files.pythonhosted.org/packages/10/91/90b8d4cd611ac2aa526290ae4b4285aa5ea57ee191c63c2f3d04170d7683/cryptography-35.0.0.tar.gz (559kB)
2021-11-06 10:40:26,596: DEBUG -   Installing build dependencies: started
2021-11-06 10:40:36,078: DEBUG -   Installing build dependencies: finished with status 'done'
2021-11-06 10:40:36,995: DEBUG - Requirement already satisfied, skipping upgrade: cffi>=1.12 in /opt/yunohost/matrix-synapse/lib/python3.7/site-packages (from cryptography>=3.4.7) (1.14.6)
2021-11-06 10:40:36,997: DEBUG - Requirement already satisfied, skipping upgrade: pycparser in /opt/yunohost/matrix-synapse/lib/python3.7/site-packages (from cffi>=1.12->cryptography>=3.4.7) (2.20)
2021-11-06 10:40:36,999: DEBUG - Building wheels for collected packages: cryptography
2021-11-06 10:40:37,000: DEBUG -   Running setup.py bdist_wheel for cryptography: started
2021-11-06 10:40:38,892: DEBUG -   Running setup.py bdist_wheel for cryptography: finished with status 'error'
2021-11-06 10:40:38,892: DEBUG -   Complete output from command /opt/yunohost/matrix-synapse/bin/python3 -u -c "import setuptools, tokenize;__file__='/tmp/pip-install-hbh8_ycq/cryptography/setup.py';f=getattr(tokenize, 'open', open)(__file__);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, __file__, 'exec'))" bdist_wheel -d /tmp/pip-wheel-0rmpq051 --python-tag cp37:
2021-11-06 10:40:38,892: DEBUG -   /tmp/pip-build-env-ywwbbygt/lib/python3.7/site-packages/setuptools/__init__.py:151: SetuptoolsDeprecationWarning: setup_requires is deprecated. Supply build dependencies using PEP 517 pyproject.toml build-requires.
2021-11-06 10:40:38,893: DEBUG -     SetuptoolsDeprecationWarning,

especially 2021-11-06 10:40:38,892: DEBUG - Running setup.py bdist_wheel for cryptography: finished with status 'error'
but the installation just continues after that.

Even earlier there is mention of the kernel version:


2021-11-06 10:39:57,652: DEBUG - ++ uname -m
2021-11-06 10:39:57,656: DEBUG - + '[' -n '' ']'
2021-11-06 10:39:57,657: DEBUG - + export PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/opt/yunohost/matrix-synapse/.cargo/bin:/opt/yunohost/matrix-synapse/.local/bin:/usr/local/sbin
2021-11-06 10:39:57,657: DEBUG - + PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/opt/yunohost/matrix-synapse/.cargo/bin:/opt/yunohost/matrix-synapse/.local/bin:/usr/local/sbin
2021-11-06 10:39:57,657: DEBUG - + '[' -e /opt/yunohost/matrix-synapse/.rustup ']'
2021-11-06 10:39:57,657: DEBUG - + sudo -u matrix-synapse env PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/opt/yunohost/matrix-synapse/.cargo/bin:/opt/yunohost/matrix-synapse/.local/bin:/usr/local/sbin rustup update
2021-11-06 10:39:57,974: WARNING - info: syncing channel updates for 'stable-x86_64-unknown-linux-gnu'
2021-11-06 10:39:58,164: WARNING - info: latest update on 2021-11-01, rust version 1.56.1 (59eed8a2a 2021-11-01)

In another thread (let me check… edit: I can’t find it anymore; perhaps in an issue for Yunohost on Github, but I don’t know how to search comments there) there was a problem compiling from source because there was no matching linux-headers package. Could this be similar?

So, I was able to restore the app by patching the backup and replace its _common.sh file by the one of Testing by alexAubin · Pull Request #288 · YunoHost-Apps/synapse_ynh · GitHub

To anyone having a similar issue, wait for the merge of this PR before attempting to install or upgrade. :wink:

1 Like

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