unknown_service error when saving configs for app

I’m developing a package for a personal app I’m working on. You can see the Yunohost package here: GitHub - endorama/test_ynh

The app is still in development, the package is still in development. Basically will be distributed as a single binary. I plan to open source it and offer a Yunohost package, as I really love the platform, but it’s my first package and I’m struggling with an error message that I’m not able to troubleshoot.

In my package I configured a setting in config_panel.toml that I want to expose to the user. It works, is shown in the UI and it updates the correct setting. But when saving, I see an error message displayed, Servizio 'kakeibo' sconosciuto (Unknown service 'kakeibo' in English) and the app is not actually restarted, making any UI action useless (a restart is needed for the new value to be picked up).

The API PUT call to https://server/yunohost/api/apps/kakeibo/config/main returns a 400 and shows this content:

{
"error": "Unknown service 'kakeibo'",
"error_key": "service_unknown",
"service": "kakeibo"}

I’m assuming this refers to a systemd service, but the service exists and is running:

# systemctl status kakeibo
● kakeibo.service - Kakeibo Family Financial App
     Loaded: loaded (/etc/systemd/system/kakeibo.service; enabled; preset: enabled)
     Active: active (running) since Sun 2025-10-19 18:59:40 UTC; 2h 17min ago
   Main PID: 2157280 (kakeibo)
      Tasks: 8 (limit: 4530)
     Memory: 13.8M
        CPU: 10.365s
     CGroup: /system.slice/kakeibo.service
             └─2157280 /var/www/kakeibo/kakeibo --config /var/www/kakeibo/config.yaml serve

Oct 19 18:59:40 server systemd[1]: Started kakeibo.service - Kakeibo Family Financial App.

Any idea how to troubleshoot this? I found these lines in the log for the operation (/var/log/yunohost/operations/), but they do not provide much details.

2025-10-19 21:26:04,724: INFO - Reloading services...
2025-10-19 21:26:04,910: DEBUG - Reloading service kakeibo
<log ends here>

Thank you!

digging in code i would think is it def _get_services(): of service.py that does not find service in configured service known by yunohost in SERVICES_CONF = “/etc/yunohost/services.yml”.

1 Like

After first install, did you need to manually start kakeibo service or did the install script start it?

Your script is a little hard to read. As you can notice, all yunohost packages have some comments, blocks delimiting sections, to help other packagers.
What is missing in your install script is :

yunohost service add "$app" --description="Kakeibo Family Financial App" --log="/var/log/$app/$app.log"

Set the correct log filename.

You can notice you don’t have a service named “Kakeibo” in tools>services with your install script.

2 Likes

Yes it does, using

ynh_systemd_action --service_name=$app --action="start" --line_match="Starting server on"

Have a look at /etc/yunohost/services.yml and follow the instructions from @jarod5001

This worked like a charm! Thank you and thanks all for helping me out!

(I also added some comments to improve scripts readability upon your suggestion)

I’d like to understand some more about services: I don’t remember reading about them in the documentation. Is yunohost add service required when using a systemd service? When acting on a service (es stop, reload, restart) should I prefer systemctl or yunohost service <action>?

I’m happy to contribute to the documentation to clarify this, but I’d need to understand a bit better service purpose.

So, there are a lot of systemd services on your Yunohost server but not all of them appear in the webadmin >tools >services.
For a specific service to be added to yunohost services, you have to add it using that command, which is not in the helpers but in the core of yunohost (you can find more details using yunohost service --help)

1 Like

Thank you!