Error during Migration 0028_delete_legacy_xmpp_permission

What type of hardware are you using: Other(?)
What YunoHost version are you running: 12.0.7
How are you able to access your server: The webadmin
SSH
Are you in a special context or did you perform specific tweaking on your YunoHost instance ?: No

Describe your issue

Hello!

I’ve done the Bookworm upgrade this evening via ssh.

The upgrade didn’t complete the first time, finishing with this error:

Info: Starting YunoHost core upgrade…
Info: Downloading...
Info: [....................] > 0.0% Installing python3-all
Info: [....................] > 2.7% Installing lua-rex-pcre2
Info: [#...................] > 5.4% Installing lua-basexx
Info: [#...................] > 8.2% Installing lua-luaossl
Info: [##..................] > 10.9% Installing lua-logging
Info: [##..................] > 13.6% Installing lua-cjson
Info: [###.................] > 16.3% Installing ssowat
Info: [###.................] > 19.0% Installing python3-passlib
Info: [####................] > 21.8% Installing python3-magic
Info: [####................] > 24.5% Installing python3-typing-extensions
Info: [#####...............] > 27.2% Installing python3-pydantic
Info: [#####...............] > 29.9% Installing python3-email-validator
Info: [######..............] > 32.7% Installing libmilter1.0.1
Info: [#######.............] > 35.4% Installing opendkim
Info: [#######.............] > 38.1% Installing moulinette
Info: [########............] > 40.8% Installing yunohost
Warning: E: Sub-process /usr/bin/dpkg returned an error code (1)
Warning: Traceback (most recent call last):
Warning:   File "/usr/bin/yunohost", line 77, in <module>
Warning:     yunohost.cli(
Warning:   File "/usr/lib/python3/dist-packages/yunohost/__init__.py", line 41, in cli
Warning:     ret = moulinette.cli(
Warning:           ^^^^^^^^^^^^^^^
Warning:   File "/usr/lib/python3/dist-packages/moulinette/__init__.py", line 115, in cli
Warning:     ).run(args, output_as=output_as, timeout=timeout)
Warning:       ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Warning:   File "/usr/lib/python3/dist-packages/moulinette/interfaces/cli.py", line 498, in run
Warning:     ret = self.actionsmap.process(args, timeout=timeout)
Warning:           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Warning:   File "/usr/lib/python3/dist-packages/moulinette/actionsmap.py", line 561, in process
Warning:     return func(**arguments)
Warning:            ^^^^^^^^^^^^^^^^^
Warning:   File "/usr/lib/python3/dist-packages/yunohost/app.py", line 1658, in app_ssowatconf
Warning:     default_app = _get_raw_domain_settings(domain).get("default_app")
Warning:                   ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Warning: AttributeError: 'NoneType' object has no attribute 'get'
Warning: dpkg: error processing package yunohost (--configure):
Warning:  installed yunohost package post-installation script subprocess returned error exit status 1
Warning: Errors were encountered while processing:
Warning:  yunohost
Info: [....................] > 0.0% Installing yunohost
Warning: E: Sub-process /usr/bin/dpkg returned an error code (1)
Warning: Traceback (most recent call last):
Warning:   File "/usr/bin/yunohost", line 77, in <module>
Warning:     yunohost.cli(
Warning:   File "/usr/lib/python3/dist-packages/yunohost/__init__.py", line 41, in cli
Warning:     ret = moulinette.cli(
Warning:           ^^^^^^^^^^^^^^^
Warning:   File "/usr/lib/python3/dist-packages/moulinette/__init__.py", line 115, in cli
Warning:     ).run(args, output_as=output_as, timeout=timeout)
Warning:       ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Warning:   File "/usr/lib/python3/dist-packages/moulinette/interfaces/cli.py", line 498, in run
Warning:     ret = self.actionsmap.process(args, timeout=timeout)
Warning:           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Warning:   File "/usr/lib/python3/dist-packages/moulinette/actionsmap.py", line 561, in process
Warning:     return func(**arguments)
Warning:            ^^^^^^^^^^^^^^^^^
Warning:   File "/usr/lib/python3/dist-packages/yunohost/app.py", line 1658, in app_ssowatconf
Warning:     default_app = _get_raw_domain_settings(domain).get("default_app")
Warning:                   ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Warning: AttributeError: 'NoneType' object has no attribute 'get'
Warning: dpkg: error processing package yunohost (--configure):
Warning:  installed yunohost package post-installation script subprocess returned error exit status 1
Warning: Errors were encountered while processing:
Warning:  yunohost
Error: Migration 0027_migrate_to_bookworm did not complete, aborting. Error: Failed to run command 'aptitude full-upgrade --show-why -o Dpkg::Options::='--force-confold' yunohost yunohost-admin yunohost-portal moulinette ssowat libluajit2-5.1-2 '
Info: The operation 'Run migrations' could not be completed. Please share the full log of this operation using the command 'yunohost log share 20241123-212137-tools_migrations_migrate_forward' to get help

I still had access to the web admin, while the portal ends up on a 404.
In the admin, going into the “update” section, I still had those packages listed:

libconfig-inifiles-perl (from 3.000003-1 to 3.000003-2)
yunohost-admin (from 11.3.0 to 12.0.3.5) 

And a warning for the remaining migrations.

I launched the migration again, and ended up with this error message this time:

mt@server:~$ sudo yunohost tools migrations run --accept-disclaimer
Info: Running migration 0028_delete_legacy_xmpp_permission…
Info: Creating a backup of LDAP database and apps settings prior to the actual migration.
Info: The operation 'Delete permission 'xmpp'' could not be completed. Please share the full log of this operation using the command 'yunohost log share 20241123-222054-permission_delete-xmpp' to get help
Warning: Could not migrate… trying to roll back the system.
Info: System rolled back.
Error: Migration 0028_delete_legacy_xmpp_permission did not complete, aborting. Error: 'NoneType' object has no attribute 'get'
Info: The operation 'Run migrations' could not be completed. Please share the full log of this operation using the command 'yunohost log share 20241123-222052-tools_migrations_migrate_forward' to get help
Info: Running migration 0029_postgresql_13_to_15…
Info: No YunoHost app seem to require postgresql... Skipping!
Success! Migration 0029_postgresql_13_to_15 completed
Info: Running migration 0030_rebuild_python_venv_in_bookworm…
Success! Migration 0030_rebuild_python_venv_in_bookworm completed
Info: Running migration 0031_terms_of_services…
Success! Migration 0031_terms_of_services completed

Now, the migration list only displays 28. migration_description_0028_delete_legacy_xmpp_permission.

Before trying anything else, I wanted to check if there was a known workaround.

Thank you!

Share relevant logs or error messages

Full log for the first migration error:
https://paste.yunohost.org/raw/uzikekewej

Log for the retry:
https://paste.yunohost.org/raw/ivebupunup

Good morning!

After looking at the migration script, I’ve tried moving forward with this command:

aptitude full-upgrade --show-why -o Dpkg::Options::='--force-confold' yunohost yunohost-admin yunohost-portal moulinette ssowat libluajit2-5.1-2 

The issue seem to stem from configuring yunohost itself:

Regenerating configuration, this might take a while...
Traceback (most recent call last):
  File "/usr/bin/yunohost", line 77, in <module>
    yunohost.cli(
  File "/usr/lib/python3/dist-packages/yunohost/__init__.py", line 41, in cli
    ret = moulinette.cli(
          ^^^^^^^^^^^^^^^
Full log
mt@server:~$ sudo aptitude full-upgrade --show-why -o Dpkg::Options::='--force-confold' yunohost yunohost-admin yunohost-portal moulinette ssowat libluajit2-5.1-2 
yunohost is already installed at the latest version (12.0.7), so it will not be upgraded
moulinette is already installed at the latest version (12.0.3), so it will not be upgraded
ssowat is already installed at the latest version (12.0.3), so it will not be upgraded
libluajit2-5.1-2 is already installed at the latest version (2.1-20230119-1), so it will not be upgraded
yunohost is already installed at the latest version (12.0.7), so it will not be upgraded
moulinette is already installed at the latest version (12.0.3), so it will not be upgraded
ssowat is already installed at the latest version (12.0.3), so it will not be upgraded
libluajit2-5.1-2 is already installed at the latest version (2.1-20230119-1), so it will not be upgraded
The following NEW packages will be installed:
  yunohost-portal  
The following packages will be upgraded:
  yunohost-admin  
The following partially installed packages will be configured:
  yunohost  
1 packages upgraded, 1 newly installed, 0 to remove and 1 not upgraded.
Need to get 0 B/6,371 kB of archives. After unpacking 2,034 kB will be used.
Do you want to continue? [Y/n/?] Y
Reading changelogs... Done               
Setting up yunohost (12.0.7) ...
Regenerating configuration, this might take a while...
Traceback (most recent call last):
  File "/usr/bin/yunohost", line 77, in <module>
    yunohost.cli(
  File "/usr/lib/python3/dist-packages/yunohost/__init__.py", line 41, in cli
    ret = moulinette.cli(
          ^^^^^^^^^^^^^^^
  File "/usr/lib/python3/dist-packages/moulinette/__init__.py", line 115, in cli
    ).run(args, output_as=output_as, timeout=timeout)
      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3/dist-packages/moulinette/interfaces/cli.py", line 498, in run
    ret = self.actionsmap.process(args, timeout=timeout)
          ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3/dist-packages/moulinette/actionsmap.py", line 561, in process
    return func(**arguments)
           ^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3/dist-packages/yunohost/app.py", line 1658, in app_ssowatconf
    default_app = _get_raw_domain_settings(domain).get("default_app")
                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
AttributeError: 'NoneType' object has no attribute 'get'
dpkg: error processing package yunohost (--configure):
 installed yunohost package post-installation script subprocess returned error exit status 1
Errors were encountered while processing:
 yunohost
E: Sub-process /usr/bin/dpkg returned an error code (1)
Setting up yunohost (12.0.7) ...
Regenerating configuration, this might take a while...
Traceback (most recent call last):
  File "/usr/bin/yunohost", line 77, in <module>
    yunohost.cli(
  File "/usr/lib/python3/dist-packages/yunohost/__init__.py", line 41, in cli
    ret = moulinette.cli(
          ^^^^^^^^^^^^^^^
  File "/usr/lib/python3/dist-packages/moulinette/__init__.py", line 115, in cli
    ).run(args, output_as=output_as, timeout=timeout)
      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3/dist-packages/moulinette/interfaces/cli.py", line 498, in run
    ret = self.actionsmap.process(args, timeout=timeout)
          ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3/dist-packages/moulinette/actionsmap.py", line 561, in process
    return func(**arguments)
           ^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3/dist-packages/yunohost/app.py", line 1658, in app_ssowatconf
    default_app = _get_raw_domain_settings(domain).get("default_app")
                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
AttributeError: 'NoneType' object has no attribute 'get'
dpkg: error processing package yunohost (--configure):
 installed yunohost package post-installation script subprocess returned error exit status 1
Errors were encountered while processing:
 yunohost

If this can help with debugging:

mt@server:~$ sudo dpkg --list | grep "yunohost\|moulinette"
ii  moulinette                            12.0.3                                         all          prototype interfaces with ease in Python
iF  yunohost                              12.0.7                                         all          manageable and configured self-hosting server
ii  yunohost-admin                        11.3.0                                         all          web administration interface for yunohost