L'API YunoHost ne répond pas - moulinette.interfaces.api is not a package

What type of hardware are you using: Virtual machine
What YunoHost version are you running: 12.0
How are you able to access your server: The webadmin
SSH

Describe your issue

Bonjour,
je viens de découvrir une mise à jour pour monter yunohost en v12.1, mais en lançant celle-ci cela a cassé mon installation : “L’API YunoHost ne répond pas”
Erreur: “502”
Action: “GET” /yunohost/api/installed
Mais en console il m’indique que le paquet yunohost-api : “1 not fully installed or removed.”
Et si je veux installer un paquet en ssh j’ai le message joint.

Merci beaucoup de l’aide !

Share relevant logs or error messages

Traceback (most recent call last):
File “/usr/lib/python3.11/logging/config.py”, line 391, in resolve
self.importer(used)
ModuleNotFoundError: No module named ‘moulinette.interfaces.api.APIQueueHandler’; ‘moulinette.interfaces.api’ is not a package

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
File “/usr/lib/python3.11/logging/config.py”, line 562, in configure
handler = self.configure_handler(handlers[name])
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File “/usr/lib/python3.11/logging/config.py”, line 724, in configure_handler
klass = self.resolve(cname)
^^^^^^^^^^^^^^^^^^^
File “/usr/lib/python3.11/logging/config.py”, line 396, in resolve
raise v from e
ValueError: Cannot resolve ‘moulinette.interfaces.api.APIQueueHandler’: No module named ‘moulinette.interfaces.api.APIQueueHandler’; ‘moulinette.interfaces.api’ is not a package

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
File “/usr/bin/yunohost”, line 108, in
main()
File “/usr/bin/yunohost”, line 97, in main
yunohost.cli(
File “/usr/lib/python3/dist-packages/yunohost/init.py”, line 35, in cli
init_logging(interface=“cli”, debug=debug, quiet=quiet)
File “/usr/lib/python3/dist-packages/yunohost/init.py”, line 194, in init_logging
configure_logging(logging_configuration)
File “/usr/lib/python3/dist-packages/moulinette/utils/log.py”, line 86, in configure_logging
dictConfig(logging_config)
File “/usr/lib/python3.11/logging/config.py”, line 812, in dictConfig
dictConfigClass(config).configure()
File “/usr/lib/python3.11/logging/config.py”, line 569, in configure
raise ValueError('Unable to configure handler ’
ValueError: Unable to configure handler ‘api’
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)

Hello,

J’ai le même problème depuis la dernière mise à jour.
Plus d’infos:

systemctl status yunohost-api retourne:


● yunohost-api.service - YunoHost API Server
     Loaded: loaded (/etc/systemd/system/yunohost-api.service; enabled; preset: enabled)
     Active: activating (auto-restart) (Result: exit-code) since Wed 2025-03-19 11:01:49 UTC; 3s ago
    Process: 1563820 ExecStart=/usr/bin/yunohost-api (code=exited, status=1/FAILURE)
   Main PID: 1563820 (code=exited, status=1/FAILURE)
        CPU: 90ms

systemctl is-enabled yunohost-api:

enabled

journalctl -u yunohost-api --no-pager --lines=50:

Mar 19 11:06:28 hosty.nohost.me yunohost-api[1566019]:   File "/usr/bin/yunohost-api", line 71, in <module>
Mar 19 11:06:28 hosty.nohost.me yunohost-api[1566019]:     yunohost.api(debug=opts.debug, host=opts.host, port=opts.port)
Mar 19 11:06:28 hosty.nohost.me yunohost-api[1566019]:   File "/usr/lib/python3/dist-packages/yunohost/__init__.py", line 60, in api
Mar 19 11:06:28 hosty.nohost.me yunohost-api[1566019]:     init_logging(interface="api", debug=debug)
Mar 19 11:06:28 hosty.nohost.me yunohost-api[1566019]:   File "/usr/lib/python3/dist-packages/yunohost/__init__.py", line 209, in init_logging
Mar 19 11:06:28 hosty.nohost.me yunohost-api[1566019]:     configure_logging(logging_configuration)
Mar 19 11:06:28 hosty.nohost.me yunohost-api[1566019]:   File "/usr/lib/python3/dist-packages/moulinette/utils/log.py", line 86, in configure_logging
Mar 19 11:06:28 hosty.nohost.me yunohost-api[1566019]:     dictConfig(logging_config)
Mar 19 11:06:28 hosty.nohost.me yunohost-api[1566019]:   File "/usr/lib/python3.11/logging/config.py", line 812, in dictConfig
Mar 19 11:06:28 hosty.nohost.me yunohost-api[1566019]:     dictConfigClass(config).configure()
Mar 19 11:06:28 hosty.nohost.me yunohost-api[1566019]:   File "/usr/lib/python3.11/logging/config.py", line 569, in configure
Mar 19 11:06:28 hosty.nohost.me yunohost-api[1566019]:     raise ValueError('Unable to configure handler '
Mar 19 11:06:28 hosty.nohost.me yunohost-api[1566019]: ValueError: Unable to configure handler 'api'
Mar 19 11:06:28 hosty.nohost.me systemd[1]: yunohost-api.service: Main process exited, code=exited, status=1/FAILURE
Mar 19 11:06:28 hosty.nohost.me systemd[1]: yunohost-api.service: Failed with result 'exit-code'.
Mar 19 11:06:33 hosty.nohost.me systemd[1]: yunohost-api.service: Scheduled restart job, restart counter is at 26229.
Mar 19 11:06:33 hosty.nohost.me systemd[1]: Stopped yunohost-api.service - YunoHost API Server.
Mar 19 11:06:33 hosty.nohost.me systemd[1]: Started yunohost-api.service - YunoHost API Server.
Mar 19 11:06:33 hosty.nohost.me yunohost-api[1566060]: Traceback (most recent call last):
Mar 19 11:06:33 hosty.nohost.me yunohost-api[1566060]:   File "/usr/lib/python3.11/logging/config.py", line 391, in resolve
Mar 19 11:06:33 hosty.nohost.me yunohost-api[1566060]:     self.importer(used)
Mar 19 11:06:33 hosty.nohost.me yunohost-api[1566060]: ModuleNotFoundError: No module named 'moulinette.interfaces.api.APIQueueHandler'; 'moulinette.interfaces.api' is not a package
Mar 19 11:06:33 hosty.nohost.me yunohost-api[1566060]: The above exception was the direct cause of the following exception:
Mar 19 11:06:33 hosty.nohost.me yunohost-api[1566060]: Traceback (most recent call last):
Mar 19 11:06:33 hosty.nohost.me yunohost-api[1566060]:   File "/usr/lib/python3.11/logging/config.py", line 562, in configure
Mar 19 11:06:33 hosty.nohost.me yunohost-api[1566060]:     handler = self.configure_handler(handlers[name])
Mar 19 11:06:33 hosty.nohost.me yunohost-api[1566060]:               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Mar 19 11:06:33 hosty.nohost.me yunohost-api[1566060]:   File "/usr/lib/python3.11/logging/config.py", line 724, in configure_handler
Mar 19 11:06:33 hosty.nohost.me yunohost-api[1566060]:     klass = self.resolve(cname)
Mar 19 11:06:33 hosty.nohost.me yunohost-api[1566060]:             ^^^^^^^^^^^^^^^^^^^
Mar 19 11:06:33 hosty.nohost.me yunohost-api[1566060]:   File "/usr/lib/python3.11/logging/config.py", line 396, in resolve
Mar 19 11:06:33 hosty.nohost.me yunohost-api[1566060]:     raise v from e
Mar 19 11:06:33 hosty.nohost.me yunohost-api[1566060]: ValueError: Cannot resolve 'moulinette.interfaces.api.APIQueueHandler': No module named 'moulinette.interfaces.api.APIQueueHandler'; 'moulinette.interfaces.api' is not a package
Mar 19 11:06:33 hosty.nohost.me yunohost-api[1566060]: The above exception was the direct cause of the following exception:
Mar 19 11:06:33 hosty.nohost.me yunohost-api[1566060]: Traceback (most recent call last):
Mar 19 11:06:33 hosty.nohost.me yunohost-api[1566060]:   File "/usr/bin/yunohost-api", line 71, in <module>
Mar 19 11:06:33 hosty.nohost.me yunohost-api[1566060]:     yunohost.api(debug=opts.debug, host=opts.host, port=opts.port)
Mar 19 11:06:33 hosty.nohost.me yunohost-api[1566060]:   File "/usr/lib/python3/dist-packages/yunohost/__init__.py", line 60, in api
Mar 19 11:06:33 hosty.nohost.me yunohost-api[1566060]:     init_logging(interface="api", debug=debug)
Mar 19 11:06:33 hosty.nohost.me yunohost-api[1566060]:   File "/usr/lib/python3/dist-packages/yunohost/__init__.py", line 209, in init_logging
Mar 19 11:06:33 hosty.nohost.me yunohost-api[1566060]:     configure_logging(logging_configuration)
Mar 19 11:06:33 hosty.nohost.me yunohost-api[1566060]:   File "/usr/lib/python3/dist-packages/moulinette/utils/log.py", line 86, in configure_logging
Mar 19 11:06:33 hosty.nohost.me yunohost-api[1566060]:     dictConfig(logging_config)
Mar 19 11:06:33 hosty.nohost.me yunohost-api[1566060]:   File "/usr/lib/python3.11/logging/config.py", line 812, in dictConfig
Mar 19 11:06:33 hosty.nohost.me yunohost-api[1566060]:     dictConfigClass(config).configure()
Mar 19 11:06:33 hosty.nohost.me yunohost-api[1566060]:   File "/usr/lib/python3.11/logging/config.py", line 569, in configure
Mar 19 11:06:33 hosty.nohost.me yunohost-api[1566060]:     raise ValueError('Unable to configure handler '
Mar 19 11:06:33 hosty.nohost.me yunohost-api[1566060]: ValueError: Unable to configure handler 'api'
Mar 19 11:06:33 hosty.nohost.me systemd[1]: yunohost-api.service: Main process exited, code=exited, status=1/FAILURE
Mar 19 11:06:33 hosty.nohost.me systemd[1]: yunohost-api.service: Failed with result 'exit-code'.

yunohost tools diagnosis:

Traceback (most recent call last):
  File "/usr/lib/python3.11/logging/config.py", line 391, in resolve
    self.importer(used)
ModuleNotFoundError: No module named 'moulinette.interfaces.api.APIQueueHandler'; 'moulinette.interfaces.api' is not a package

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "/usr/lib/python3.11/logging/config.py", line 562, in configure
    handler = self.configure_handler(handlers[name])
              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.11/logging/config.py", line 724, in configure_handler
    klass = self.resolve(cname)
            ^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.11/logging/config.py", line 396, in resolve
    raise v from e
ValueError: Cannot resolve 'moulinette.interfaces.api.APIQueueHandler': No module named 'moulinette.interfaces.api.APIQueueHandler'; 'moulinette.interfaces.api' is not a package

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "/usr/bin/yunohost", line 108, in <module>
    main()
  File "/usr/bin/yunohost", line 97, in main
    yunohost.cli(
  File "/usr/lib/python3/dist-packages/yunohost/__init__.py", line 35, in cli
    init_logging(interface="cli", debug=debug, quiet=quiet)
  File "/usr/lib/python3/dist-packages/yunohost/__init__.py", line 194, in init_logging
    configure_logging(logging_configuration)
  File "/usr/lib/python3/dist-packages/moulinette/utils/log.py", line 86, in configure_logging
    dictConfig(logging_config)
  File "/usr/lib/python3.11/logging/config.py", line 812, in dictConfig
    dictConfigClass(config).configure()
  File "/usr/lib/python3.11/logging/config.py", line 569, in configure
    raise ValueError('Unable to configure handler '
ValueError: Unable to configure handler 'api'

Can you share the output of dpkg --list | grep 'yunohost\|moulinette'

Thanks for your anwser.

Here is the output of dpkg --list | grep ‘yunohost|moulinette’:

ii  moulinette                            12.0.4+202501201615                          all          prototype interfaces with ease in Python
iF  yunohost                              12.0.12                                      all          manageable and configured self-hosting server
ii  yunohost-admin                        12.0.5+202502112115                          all          web administration interface for yunohost
ii  yunohost-portal                       12.0.8                                       all          user portal designed for yunohost

Dunno how you managed to get unstable versions of moulinette and yunohost-admin … was your server configured to grab unstable versions of yunohost in the past ..?

Anyway the original post was from @CanetSeb who was trying to update to 12.1 …

Indeed, I forgot to mention it, it was an unstable version before. I recently deleted the “unstable” word on the sources list to upgrade everything on stable version. Apparently it worked half.
How can I upgrade everything to the last stable version? The error remain event after yunohost tools update or yunohost tools upgrade system

Yes, the original post is from CanetSeb. I don’t want to interfer. As we have the same error message… The solution can be the same too.

I did same… :face_exhaling:

Hello,

(j’ai vu le tag “French”, je me permet de répondre en français)

Problème résolu, en ce qui me concerne.

Voici ce que j’ai fait, dans l’ordre (pour downgrade Moulinette sur une version stable):

wget https://forge.yunohost.org/debian/pool/stable/m/moulinette/moulinette_12.0.4_all.deb
sudo dpkg -i moulinette_12.0.4_all.deb
sudo apt --fix-broken install
sudo systemctl restart yunohost-api

Vérification que la version stable a bien été installée:

yunohost --version

Ensuite, dernières mises à jours depuis le panel d’administration.
Puis, encore:

yunohost --version

(optionnel, j’y connais pas grand chose et ça m’a semblé pertinent) S’il y’a encore des packages “unstable”: répétition des étapes précédentes pour downgrade ces packages en version “stable” (ssowat pour moi, en l’occurence).

1 Like

Wahou ! Alors là merci mille fois ! Pour quelqu’un qui n’y connaît pas grand chose, tu as réussi un magnifique tour de magie, tu nous as sauvé nos installations.
Toutefois j’ai encore un pb avec le firewall qui ne se lance plus:

Mar 23 14:14:48 systemd[1]: Starting yunohost-firewall.service - YunoHost Firewall...
Mar 23 14:14:49 yunohost[2478]: Traceback (most recent call last):
Mar 23 14:14:49 yunohost[2478]:   File "/usr/bin/yunohost", line 108, in <module>
Mar 23 14:14:49 yunohost[2478]:     main()
Mar 23 14:14:49 yunohost[2478]:   File "/usr/bin/yunohost", line 97, in main
Mar 23 14:14:49 yunohost[2478]:     yunohost.cli(
Mar 23 14:14:49 yunohost[2478]:   File "/usr/lib/python3/dist-packages/yunohost/__init__.py", line 41, in cli
Mar 23 14:14:49 yunohost[2478]:     ret = moulinette.cli(
Mar 23 14:14:49 yunohost[2478]:           ^^^^^^^^^^^^^^^
Mar 23 14:14:49 yunohost[2478]:   File "/usr/lib/python3/dist-packages/moulinette/__init__.py", line 140, in cli
Mar 23 14:14:49 yunohost[2478]:     ).run(args, output_as=output_as, timeout=timeout)
Mar 23 14:14:49 yunohost[2478]:       ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Mar 23 14:14:49 yunohost[2478]:   File "/usr/lib/python3/dist-packages/moulinette/interfaces/cli.py", line 521, in run
Mar 23 14:14:49 yunohost[2478]:     ret = self.actionsmap.process(args, timeout=timeout)
Mar 23 14:14:49 yunohost[2478]:           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Mar 23 14:14:49 yunohost[2478]:   File "/usr/lib/python3/dist-packages/moulinette/actionsmap.py", line 579, in process
Mar 23 14:14:49 yunohost[2478]:     return func(**arguments)
Mar 23 14:14:49 yunohost[2478]:            ^^^^^^^^^^^^^^^^^
Mar 23 14:14:49 yunohost[2478]:   File "/usr/lib/python3/dist-packages/yunohost/firewall.py", line 253, in firewall_reload
Mar 23 14:14:49 yunohost[2478]:     if ssh_port not in firewall_list()["opened_ports"]:
Mar 23 14:14:49 yunohost[2478]:                        ^^^^^^^^^^^^^^^
Mar 23 14:14:49 yunohost[2478]:   File "/usr/lib/python3/dist-packages/yunohost/firewall.py", line 212, in firewall_list
Mar 23 14:14:49 yunohost[2478]:     f = firewall[i]
Mar 23 14:14:49 yunohost[2478]:         ~~~~~~~~^^^
Mar 23 14:14:49 yunohost[2478]: KeyError: 'ipv4'
Mar 23 14:14:49 systemd[1]: yunohost-firewall.service: Main process exited, code=exited, status=1/FAILURE
Mar 23 14:14:49 systemd[1]: yunohost-firewall.service: Failed with result 'exit-code'.
Mar 23 14:14:49 systemd[1]: Failed to start yunohost-firewall.service - YunoHost Firewall.

Merci d’avance pour ton aide.

1 Like

Avec plaisir.

Et j’ai également le même problème avec le firewall :melting_face:

Je pense que ça vient d’un problème avec ipv4, parce qu’une erreur apparaît en le citant. Et j’ai aussi une erreur ‘ipv4’ en essayant de mettre à jour l’application Audiobookshelf.

J’essaye de trouver une solution, mais pas facile…

1 Like

J’ai l’impression que ça vient du contenu du fichier firewall.yml, mais je parviens pas à le configurer correctement…

J’ai essayé de copier / coller le contenu de firewall.yml disponible sur le github de yunohost, mais il y’a toujours l’erreur ipv4