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

Upgrading from version 1.108.0~ynh1 to 1.109.0~ynh1 fails #475

Open CodeShakingSheep opened 3 days ago

CodeShakingSheep commented 3 days ago

Describe the bug

Upgrading from version 1.108.0~ynh1 to 1.109.0~ynh1 fails. Fortunately, restoring worked.

Context

Steps to reproduce

Just hit the upgrade button in webadmin.

Expected behavior

Synapse app should be upgraded successfully.

Logs

https://paste.yunohost.org/raw/wecegizotu

Relevant part:

2024-07-02 18:20:42,696: WARNING - Traceback (most recent call last):
2024-07-02 18:20:42,697: WARNING -   File "/usr/bin/j2", line 33, in <module>
2024-07-02 18:20:42,697: WARNING -     sys.exit(load_entry_point('j2cli==0.3.12b0', 'console_scripts', 'j2')())
2024-07-02 18:20:42,698: WARNING -   File "/usr/bin/j2", line 25, in importlib_load_entry_point
2024-07-02 18:20:42,698: WARNING -     return next(matches).load()
2024-07-02 18:20:42,698: WARNING -   File "/usr/lib/python3.9/importlib/metadata.py", line 77, in load
2024-07-02 18:20:42,699: WARNING -     module = import_module(match.group('module'))
2024-07-02 18:20:42,699: WARNING -   File "/usr/lib/python3.9/importlib/__init__.py", line 127, in import_module
2024-07-02 18:20:42,699: WARNING -     return _bootstrap._gcd_import(name[level:], package, level)
2024-07-02 18:20:42,700: WARNING -   File "<frozen importlib._bootstrap>", line 1030, in _gcd_import
2024-07-02 18:20:42,700: WARNING -   File "<frozen importlib._bootstrap>", line 1007, in _find_and_load
2024-07-02 18:20:42,700: WARNING -   File "<frozen importlib._bootstrap>", line 986, in _find_and_load_unlocked
2024-07-02 18:20:42,701: WARNING -   File "<frozen importlib._bootstrap>", line 680, in _load_unlocked
2024-07-02 18:20:42,701: WARNING -   File "<frozen importlib._bootstrap_external>", line 790, in exec_module
2024-07-02 18:20:42,701: WARNING -   File "<frozen importlib._bootstrap>", line 228, in _call_with_frames_removed
2024-07-02 18:20:42,702: WARNING -   File "/usr/lib/python3/dist-packages/j2cli/__init__.py", line 4, in <module>
2024-07-02 18:20:42,702: WARNING -     import pkg_resources
2024-07-02 18:20:42,702: WARNING - ModuleNotFoundError: No module named 'pkg_resources'
2024-07-02 18:20:42,705: DEBUG - + ynh_exit_properly
2024-07-02 18:20:42,706: DEBUG - + [[ upgrade =~ ^install$|^upgrade$|^restore$ ]]
2024-07-02 18:20:44,212: ERROR - Could not upgrade synapse: An error occurred inside the app upgrade script
Josue-T commented 2 days ago

Hello,

Look like clearly an upstream issue related to the new feature https://github.com/YunoHost/yunohost/pull/1851 .

Anyway we can debug it here.

Firstly what is your yunohost version exactly ?

What is the result of theses following commands:

dpkg -l | grep pkg

and

python3 -c 'import pkg_resources; print("OK")'
CodeShakingSheep commented 2 days ago

Thanks for your reply @Josue-T . My YNH version is 11.2.20.1. Also added it to the original post. Here are the outputs of the commands.

dpkg -l | grep pkg

ii  dpkg                                  1.20.13                                            amd64        Debian package management system
ii  dpkg-dev                              1.20.13                                            all          Debian package development tools
ii  libapt-pkg6.0:amd64                   2.2.4                                              amd64        package management runtime library
ii  libdpkg-perl                          1.20.13                                            all          Dpkg perl modules
ii  pkg-config                            0.29.2-1                                           amd64        manage compile and link flags for libraries
ii  python-apt-common                     2.2.1                                              all          Python interface to libapt-pkg (locales)
ii  python3-apt                           2.2.1                                              amd64        Python 3 interface to libapt-pkg
ii  python3-pkg-resources                 52.0.0-4                                           all          Package Discovery and Resource Access using pkg_resources
python3 -c 'import pkg_resources; print("OK")'

Traceback (most recent call last):
  File "<string>", line 1, in <module>
ModuleNotFoundError: No module named 'pkg_resources'
Josue-T commented 2 days ago

Can you share me the list of all app installed on your instance ? Did you do some customization with python packages ?

And also can you share me the result of this command:

apt install tree && tree /usr/lib/python3/dist-packages/pkg_resources

Than can you also try this command:

apt install --reinstall python3-pkg-resources && python3 -c 'import pkg_resources; print("OK")'
CodeShakingSheep commented 2 days ago

I will check the list of all installed apps using python later. No, I didn't do any customization with python packages.

I had tree already installed. The first command tree /usr/lib/python3/dist-packages/pkg_resources prints

/usr/lib/python3/dist-packages/pkg_resources [error opening dir]

0 directories, 0 files

Indeed, the directory pkg_resources is not present in /usr/lib/python3/dist-packages/dist-packages.

Will try your second command later too as I'm on the move right now.

Josue-T commented 2 days ago

I had tree already installed. The first command tree /usr/lib/python3/dist-packages/pkg_resources prints

/usr/lib/python3/dist-packages/pkg_resources [error opening dir]

0 directories, 0 files

Well, look like that your python package python3-pkg-resources is broken. So reinstalling should fix the issue. But it should be interesting to understand why this package was broken. Maybe an other python apps which didn't manage correctly the packages, I don't know but would be interesting to know.