Bugreport in linuxmuster-api7 unter Python

Hallo Zusammen,

ich habe heute beim Aktualisieren einer unserer Linuxmuster Server festgestellt, dass der Dienst linuxmuster-api nicht mehr lief und sich auch nicht starten ließ:

● linuxmuster-api.service - linuxmuster.net API
     Loaded: loaded (/usr/lib/systemd/system/linuxmuster-api.service; enabled; preset: enabled)
     Active: failed (Result: exit-code) since Wed 2026-03-04 16:37:24 CET; 5min ago
   Duration: 4.260s
    Process: 3614 ExecStart=/opt/linuxmuster/bin/python3 /usr/lib/python3/dist-packages/linuxmusterApi/main.py (code=exited, status=1/FAILURE)
   Main PID: 3614 (code=exited, status=1/FAILURE)
        CPU: 4.259s

Mär 04 16:37:24 server.lan python3[3614]:   File "/usr/lib/python3/dist-packages/linuxmusterApi/main.py", line 50, in <module>
Mär 04 16:37:24 server.lan python3[3614]:     from routers_v1 import (
Mär 04 16:37:24 server.lan python3[3614]:   File "/usr/lib/python3/dist-packages/linuxmusterApi/routers_v1/devices.py", line 9, in <module>
Mär 04 16:37:24 server.lan python3[3614]:     from utils.sophomorix import lmn_getSophomorixValue
Mär 04 16:37:24 server.lan python3[3614]:   File "/usr/lib/python3/dist-packages/linuxmusterApi/utils/sophomorix.py", line 10, in <module>
Mär 04 16:37:24 server.lan python3[3614]:     from checks import check_tmp_dir
Mär 04 16:37:24 server.lan python3[3614]: ModuleNotFoundError: No module named 'checks'
Mär 04 16:37:24 server.lan systemd[1]: linuxmuster-api.service: Main process exited, code=exited, status=1/FAILURE
Mär 04 16:37:24 server.lan systemd[1]: linuxmuster-api.service: Failed with result 'exit-code'.
Mär 04 16:37:24 server.lan systemd[1]: linuxmuster-api.service: Consumed 4.259s CPU time.

Es betrifft die Version

linuxmuster-api7:
  Installiert:           7.3.31
  Installationskandidat: 7.3.31

Ursache ist wohl eine Änderung des Importverhaltens unter Python ≥ 3.12

Behoben habe ich das Problem wie folgt:

In

/usr/lib/python3/dist-packages/linuxmusterApi/utils/sophomorix.py

steht:

from checks import check_tmp_dir

Python sucht dabei ein globales Modul checks und nicht:

linuxmusterApi.utils.checks

Früher hat das anscheinend funktioniert, jetzt nicht mehr.


Lösung

Datei öffnen

sudo nano /usr/lib/python3/dist-packages/linuxmusterApi/utils/sophomorix.py

ALT

from checks import check_tmp_dir

NEU

from .checks import check_tmp_dir

Speichern, dann:

sudo systemctl restart linuxmuster-api
sudo systemctl status linuxmuster-api

Der Dienst startet danach sofort.

● linuxmuster-api.service - linuxmuster.net API
     Loaded: loaded (/usr/lib/systemd/system/linuxmuster-api.service; enabled; preset: enabled)
     Active: active (running) since Wed 2026-03-04 16:48:21 CET; 11s ago
   Main PID: 3896 (python3)
      Tasks: 1 (limit: 19092)
     Memory: 93.2M (peak: 93.4M)
        CPU: 1.993s
     CGroup: /system.slice/linuxmuster-api.service
             └─3896 /opt/linuxmuster/bin/python3 /usr/lib/python3/dist-packages/linuxmusterApi/main.py

Mär 04 16:48:21 server.lan systemd[1]: Started linuxmuster-api.service - linuxmuster.net API.
Mär 04 16:48:23 server.lan python3[3896]: 2026-03-04 16:48:23,495 - uvicorn.error - INFO - Started server process [3896]
Mär 04 16:48:23 server.lan python3[3896]: 2026-03-04 16:48:23,496 - uvicorn.error - INFO - Waiting for application startup.
Mär 04 16:48:23 server.lan python3[3896]: 2026-03-04 16:48:23,497 - uvicorn.error - INFO - Application startup complete.
Mär 04 16:48:23 server.lan python3[3896]: 2026-03-04 16:48:23,497 - uvicorn.error - INFO - Uvicorn running on https://0.0.0.0:8001 (Press CTRL+C to quit)

Ich hoffe das hilft anderen weiter die vielleicht in den selben Fehler laufen bzw. es kann mit einem Update zentral gefixt werden.

Viele Grüße
Luca

Hallo Luca,

Danke für die Mitteilung.

Ich habe sofort meine Typo in einem neuen Paket korrigiert :slight_smile:

Gruß

Arnaud