Mosquitto

  • Hallo,

    ich bekomme Mosquitto einfach nicht zum Laufen ich habe jetzt schon mehrere Stunden probiert das Internet durch sucht und auch echt fast jede Anleitung probiert aber es klappt einfach nicht. Das ist das was er mir die ganze Zeit als Fehler sagt. Hoffe es hilft als info ansonsten würde ich auch alles was noch benötig wird nach tragen.


    sudo systemctl restart mosquitto
    Job for mosquitto.service failed because the control process exited with error code.
    See "systemctl status mosquitto.service" and "journalctl -xeu mosquitto.service" for details.
    patrick@raspberrypi5:~ $ systemctl status mosquitto.service
    × mosquitto.service - Mosquitto MQTT Broker
    Loaded: loaded (/lib/systemd/system/mosquitto.service; enabled; preset: enabled)
    Active: failed (Result: exit-code) since Sun 2024-10-06 22:24:46 CEST; 42s ago
    Docs: man:mosquitto.conf(5)
    man:mosquitto(8)
    Process: 3456 ExecStartPre=/bin/mkdir -m 740 -p /var/log/mosquitto (code=exited, status=0/SUCCESS)
    Process: 3457 ExecStartPre=/bin/chown mosquitto /var/log/mosquitto (code=exited, status=0/SUCCESS)
    Process: 3458 ExecStartPre=/bin/mkdir -m 740 -p /run/mosquitto (code=exited, status=0/SUCCESS)
    Process: 3459 ExecStartPre=/bin/chown mosquitto /run/mosquitto (code=exited, status=0/SUCCESS)
    Process: 3460 ExecStart=/usr/sbin/mosquitto -c /etc/mosquitto/mosquitto.conf (code=exited, status>
    Main PID: 3460 (code=exited, status=1/FAILURE)
    CPU: 15ms

    Okt 06 22:24:46 raspberrypi5 systemd[1]: mosquitto.service: Scheduled restart job, restart counter is>
    Okt 06 22:24:46 raspberrypi5 systemd[1]: Stopped mosquitto.service - Mosquitto MQTT Broker.
    Okt 06 22:24:46 raspberrypi5 systemd[1]: mosquitto.service: Start request repeated too quickly.
    Okt 06 22:24:46 raspberrypi5 systemd[1]: mosquitto.service: Failed with result 'exit-code'.
    Okt 06 22:24:46 raspberrypi5 systemd[1]: Failed to start mosquitto.service - Mosquitto MQTT Broker.
    lines 1-18/18 (END)...skipping...


    ░ The process' exit code is 'exited' and its exit status is 1.
    Okt 06 22:24:45 raspberrypi5 systemd[1]: mosquitto.service: Failed with result 'exit-code'.
    ░░ Subject: Unit failed
    ░░ Defined-By: systemd
    ░░ Support: https://www.debian.org/support


    The unit mosquitto.service has entered the 'failed' state with result 'exit-code'.
    Okt 06 22:24:46 raspberrypi5 systemd[1]: Failed to start mosquitto.service - Mosquitto MQTT Broker.
    ░░ Subject: A start job for unit mosquitto.service has failed
    ░░ Defined-By: systemd
    ░░ Support: https://www.debian.org/support

  • :~ $ cat /etc/mosquitto/mosquitto.conf
    # Place your local configuration in /etc/mosquitto/conf.d/
    #
    # A full description of the configuration file is at
    # /usr/share/doc/mosquitto/examples/mosquitto.conf.example

    pid_file /run/mosquitto/mosquitto.pid

    persistence true
    persistence_location /var/lib/mosquitto/

    log_dest file /var/log/mosquitto/mosquitto.log

    include_dir /etc/mosquitto/conf.d

    listener 1883
    allow_anonymous true


    ~ $ journalctl -xeu mosquitto.service
    Okt 07 00:06:32 raspberrypi5 systemd[1]: Stopped mosquitto.service - Mosquitto >
    ░░ Subject: A stop job for unit mosquitto.service has finished
    ░░ Defined-By: systemd
    ░░ Support: https://www.debian.org/support
    ░░
    ░░ A stop job for unit mosquitto.service has finished.
    ░░
    ░░ The job identifier is 1011 and the job result is done.
    Okt 07 00:06:32 raspberrypi5 systemd[1]: mosquitto.service: Start request repea>
    Okt 07 00:06:32 raspberrypi5 systemd[1]: mosquitto.service: Failed with result >
    ░░ Subject: Unit failed
    ░░ Defined-By: systemd
    ░░ Support: https://www.debian.org/support
    ░░
    ░░ The unit mosquitto.service has entered the 'failed' state with result 'exit->
    Okt 07 00:06:32 raspberrypi5 systemd[1]: Failed to start mosquitto.service - Mo>
    ░░ Subject: A start job for unit mosquitto.service has failed
    ░░ Defined-By: systemd
    ░░ Support: https://www.debian.org/support
    ░░
    ░░ A start job for unit mosquitto.service has finished with a failure.
    ░░
    ░░ The job identifier is 1011 and the job result is failed.
    lines 233-255/255 (END)

  • Ok, gut.

    Gibt es eine Logfile /var/log/mosquitto/mosquitto.log und wenn ja, steht da evtl. etwas Nützliches zum fehlgeschlagenen Startprozess drin?

    Zur Info: Meine Configurationsfiles (Ich habe mehrere Broker in Betrieb an verschiedenen Orten) sieht so aus und ist nur geringfügig "fetter" . Deine ist aber m.E. vollkommen ausreichend.

    Du kannst testweise mal diese nehmen... wenn das dann immer noch fehlschlägt:

    Wie hast du mosquitto installiert? (Nativ per apt get oder in einem Container oder in Docker?)

  • Okt 06 22:24:46 raspberrypi5 systemd[1]: mosquitto.service: Start request repeated too quickly.

    Das hatte ich auch schon mal, bei mir half das auskommentieren der Zeile:

    Code
    #pid_file /var/run/mosquitto/mosquitto.pid

    Sonst kannst du ja mal versuchen im Terminal zu starten, dann ist er gesprächiger:

    sudo /usr/sbin/mosquitto -c /etc/mosquitto/mosquitto.conf

  • Er sagt mir da das ich keine berechtiging habe bin aber sogar als root angemeldet.


    /var/log/mosquitto/mosquitto.log
    bash: /var/log/mosquitto/mosquitto.log: Keine Berechtigung


    Als erstes über einen container (Docker) da läuft auch grafana nodered influxdb das geht alles nur mosquitto nicht. dann hab ich alles gelöscht und mit apt probiert geht auch nicht.

  • /var/log/mosquitto/mosquitto.log
    bash: /var/log/mosquitto/mosquitto.log: Keine Berechtigung

    Mosquitto startet als Prozess mit einer eigenen Benutzerberechtigung.

    /var/run ist ein virtuelles Dateisystem, in dem nur "root" rechte hat, Verzeichnisse und Dateien anzulegen.

    Ich dachte, dass die das endlich in der Prozess-Start-Definition ordentlich geregelt haben, doch es scheint imer noch nicht richtig eingestellt zu sein.


    Du musst, bevor der Prozess "moqsuitto" startet, das Verzeichnis /var/log/masquitto anlegen und dem Mosquitto-Prozesse Schreibrechte auf dieses Verzeichnis geben.


    Aus RE: Mqtt Dienst startet nicht

    diese beiden Zeilen müssen eventuell eingefügt werden:

    ExecStartPre=/bin/mkdir -m 740 -p /var/log/mosquitto

    ExecStartPre=/bin/chown mosquitto /var/log/mosquitto

    denn sie erzeugen das Verzeichnis, damit der Prozess selber dort seine PID ablegen kann

    Computer ..... grrrrrr

  • Der pi läuft bei mir ja über eine ssd worauf ich es immer versucht hatte. hab ja dann immer alles mit purge mosquitto gelöscht hatte aber das gefühl das nicht alles weg ist. hab ihn jetzt mit der sd karte gebootet und da es nochmal probiert läuft beim ersten anlauf. werde wohl die ssd nochmal komplett löschen und alles von vorne beginnen

  • Hm, mich wundern deine Probleme grundsätzlich:

    Ich habe Pihole seit Jahren im Einsatz auf verschiedenen Systemen (NUC, RasPi, VMs) und die SW lief IMMER "von scratch" direkt aus der Installation.

    Anyway => Hier mal meine Installation, damit du einen Vergleich hast bzw. abgleichen kannst, ob bei dir etwas anders ist.:

    Hier z.B. die FTL Service so, wie sie aus der Installation kommt (und läuft):

    Da wird GRUNDSÄTZLICH das Log-Verzeichnis angelegt und die Rechte gesetzt. Warum da in #7 der Hint kommt, das zu ergänzen, erschließt sich mir nicht. Das geht "von Scratch"...
    In das Logverzeichnis wird auch fleißig geschrieben...

    Der Service dazu:

    Man sieht z.B., dass PiHole in einem Container (CGROUP) läuft.

    Ist das jetzt ein Problem unter dem RasPi, weil da eine SSD drin ist? Kann ich mir schwer vorstellen.

  • Warum da in #7 der Hint kommt, das zu ergänzen, erschließt sich mir nicht.

    Weil das einmal ein Problem war, dass nämlich kein PID-Datei angelegt wurde und somit der mosquitto nicht starten konnte, eben mit genau dieser Fehlermeldung.


    Wenn er das Problem hatte, dass auch "root" das Verzeichnis nicht anlegen und die Berechtigung ändern kann, dann hat er ein komplett anderes Problem, welches mit dem mosqitto nicht zusammenhängt, sondern nur durch ihn verdeutlicht wird.

    Computer ..... grrrrrr

Participate now!

Don’t have an account yet? Register yourself now and be a part of our community!