Synapse restoration fail on pkg_resources error (linked to ldap_auth_plugin)

What app is this about, and its version: Any version restored from now
What YunoHost version are you running: lastest today
What type of hardware are you using: Raspberry Pi 3, 4+

Describe your issue

Error in Synapse restoration due to pkg_ressources package not found.
This package is used in ldap_auth_plugin.

Setuptools removed this package (pkg_ressources) starting from the last version of setuptools package.

Method to correct this restoration failure :

The global principle gonna be to force a version of setuptool containing pkg_ressources.

First of all, copy your files .tar, (.tar.gz), .json in another folder. To be sure you can restart the process from zero in case of troubles.

We gonna work with sudo privileges :
sudo su

Go in the folder containing your backups with cd.

If you use compression, you should have a .tar and a .tar.gz files.
Decompress the .tar.gz with gunzip ARCHIVE.tar.gz

Answer yes if it ask ARCHIVE.tar exists, replace ?

From there we work on the ARCHIVE.tar file

Extract the _common.sh script :

tar -xvf YOURBACKUP.tar apps/synapse/settings/scripts/_common.sh

Edit it via nano (or other favorite editor) :

sudo nano apps/synapse/settings/scripts/_common.sh

Modify the _common.sh script (part of the code to be modified to get context, only the 2 lines concerning setuptools and wheel, pip and cfii have to be modified :

# Install synapse in virtualenv
        local pip3="$install_dir/venv"/bin/pip3

        $pip3 install 'setuptools==80.9.0'
        $pip3 install --upgrade wheel pip cffi
        $pip3 install --upgrade -r "$YNH_APP_BASEDIR/conf/requirement_$(lsb_release --codename --short).txt"

Update the tar file you gonna use to restore :

tar --update -f YOURBACKUP.tar apps/synapse/settings/scripts/_common.sh

If you use compression, re-compress the archive ;

gzip ARCHIVE.tar

If you want to be sure, before restoration, the .tar or .gz, you can check the _common.sh modifications by :
tar -xOf YOURBACKUP.tar apps/synapse/settings/scripts/_common.sh | grep -e “setuptools” -e “wheel”

It should look like this :
$pip3 install --upgrade setuptools wheel pip cffi
$pip3 install ‘setuptools==80.9.0’
$pip3 install --upgrade wheel pip cffi

or like this :
$pip3 install ‘setuptools==80.9.0’
$pip3 install --upgrade wheel pip cffi

You can restore your .tar(.gz) file or via CLI or via GUI.

Share relevant logs or error messages

.

4 Likes

Thanks for the post!

The same problem arises when trying to install synapse from scratch. With your information I was able to quickly prepare a patch branch to try it out (it worked).

I’ll see how top report it to the devs.

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