MQTT am OrangePi

  • Ich habe Mosquitto installiert, bin aber nicht in der Lage, den Service automatisch starten zu lassen via "Systemctl enable mosquitto", ...

    service mosquitto status gibt folgende Fehlermeldung:

    × mosquitto.service - Mosquitto MQTT Broker
        Loaded: loaded (/usr/lib/systemd/system/mosquitto.service; enabled; preset: enabled)
        Active: failed (Result: exit-code) since Sat 2025-03-15 07:44:26 CET; 1min 19s ago
    Invocation: 7a54a7c2c0f64538a14b138da73880e9
          Docs: man:mosquitto.conf(5)
                man:mosquitto(8)
       Process: 793 ExecStartPre=/bin/mkdir -m 740 -p /var/log/mosquitto (code=exited, status=0/SUCCESS)
       Process: 800 ExecStartPre=/bin/chown mosquitto:mosquitto /var/log/mosquitto (code=exited, status=0/SUCCESS)
       Process: 804 ExecStartPre=/bin/mkdir -m 740 -p /run/mosquitto (code=exited, status=0/SUCCESS)
       Process: 806 ExecStartPre=/bin/chown mosquitto:mosquitto /run/mosquitto (code=exited, status=0/SUCCESS)
       Process: 811 ExecStart=/usr/sbin/mosquitto -c /etc/mosquitto/mosquitto.conf (code=exited, status=3)
      Main PID: 811 (code=exited, status=3)

    Mar 15 07:44:26 orangepi systemd[1]: mosquitto.service: Scheduled restart job, restart counter is at 5.
    Mar 15 07:44:26 orangepi systemd[1]: mosquitto.service: Start request repeated too quickly.
    Mar 15 07:44:26 orangepi systemd[1]: mosquitto.service: Failed with result 'exit-code'.
    Mar 15 07:44:26 orangepi systemd[1]: Failed to start mosquitto.service - Mosquitto MQTT Broker.

    Ich habe keinen weiteren Ansatz nach Stundenlangem googeln, ... wäre euch sehr dankbar, sollte sich mein Fehler finden...

    danke ;)

    EDIT: Ich kann den Service mit "mosquitto" aber starten, ....

  • [Unit]
    Description=Mosquitto MQTT Broker
    Documentation=man:mosquitto.conf(5) man:mosquitto(8)
    After=network.target
    Wants=network.target

    [Service]
    Type=notify
    NotifyAccess=main
    ExecStart=/usr/sbin/mosquitto -c /etc/mosquitto/mosquitto.conf
    ExecReload=/bin/kill -HUP $MAINPID
    Restart=on-failure
    ExecStartPre=/bin/mkdir -m 740 -p /var/log/mosquitto
    ExecStartPre=/bin/chown mosquitto:mosquitto /var/log/mosquitto
    ExecStartPre=/bin/mkdir -m 740 -p /run/mosquitto
    ExecStartPre=/bin/chown mosquitto:mosquitto /run/mosquitto

    [Install]
    WantedBy=multi-user.target


    wenn diese service datei gemeint ist ;)

  • er gibt zurück auf sudo /usr/sbin/mosquitto -c /etc/mosquitto/mosquitto.conf

    1742026993: Error: Unknown configuration variable "/var/log/mosquitto/mosquitto.log".
    1742026993: Error found at /etc/mosquitto/mosquitto.conf:13


    die mosquitto.conf file

    # 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

    /var/log/mosquitto/mosquitto.log


    die 13. Zeile ist das mit /var/log/mosquitto/mosquitto.log


    Wenn ich ihn selbst händisch starte kommen folgende Zeilen (falls es hilft):
    root@orangepi:~# mosquitto
    1742027463: mosquitto version 2.0.18 starting
    1742027463: Using default config.
    1742027463: Starting in local only mode. Connections will only be possible from clients running on this machine.
    1742027463: Create a configuration file which defines a listener to allow remote access.
    1742027463: For more details see https://mosquitto.org/documentation/authentication-methods/
    1742027463: Opening ipv4 listen socket on port 1883.
    1742027463: Opening ipv6 listen socket on port 1883.
    1742027463: mosquitto version 2.0.18 running

Participate now!

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