Hallo,
ich habe eine Frage. Eigentlich ist mosquitto auf meinem Raspberry 4 so konfiguriert, dass es automatisch als Dienst starten sollte. Das tut es seit ich glaube einer Woche nicht mehr. Wenn ich mosquitto starte mit diesem Befehl, läuft es als Prozess.
sudo mosquitto -c /etc/mosquitto/conf.d/my_mosquitto.conf
1684706246: mosquitto version 2.0.12 starting
1684706246: Config loaded from /etc/mosquitto/conf.d/my_mosquitto.conf.
1684706246: Opening ipv4 listen socket on port 1883.
1684706246: Opening ipv6 listen socket on port 1883.
1684706246: mosquitto version 2.0.12 running
1684706251: New connection from 192.168.0.31:53528 on port 1883.
Display More
Schaue ich allerdings nach dem Status, sehe ich, dass dieser nicht läuft.
sudo service mosquitto status
bzw.
sudo systemctl status mosquitto.service
pi@raspberrypi:~ $ systemctl status mosquitto.service
● mosquitto.service - Mosquitto MQTT Broker
Loaded: loaded (/lib/systemd/system/mosquitto.service; enabled; vendor preset: enabled)
Active: failed (Result: exit-code) since Sun 2023-05-21 23:22:12 CEST; 8min ago
Docs: man:mosquitto.conf(5)
man:mosquitto(8)
Process: 4862 ExecStartPre=/bin/mkdir -m 740 -p /var/log/mosquitto (code=exited, status=0/SUCCESS)
Process: 4863 ExecStartPre=/bin/chown mosquitto /var/log/mosquitto (code=exited, status=0/SUCCESS)
Process: 4864 ExecStartPre=/bin/mkdir -m 740 -p /run/mosquitto (code=exited, status=0/SUCCESS)
Process: 4865 ExecStartPre=/bin/chown mosquitto /run/mosquitto (code=exited, status=0/SUCCESS)
Process: 4866 ExecStart=/usr/sbin/mosquitto -c /etc/mosquitto/mosquitto.conf (code=exited, status=1/FAILURE)
Main PID: 4866 (code=exited, status=1/FAILURE)
CPU: 69ms
Mai 21 23:22:12 raspberrypi systemd[1]: mosquitto.service: Scheduled restart job, restart counter is at 5.
Mai 21 23:22:12 raspberrypi systemd[1]: Stopped Mosquitto MQTT Broker.
Mai 21 23:22:12 raspberrypi systemd[1]: mosquitto.service: Start request repeated too quickly.
Mai 21 23:22:12 raspberrypi systemd[1]: mosquitto.service: Failed with result 'exit-code'.
Mai 21 23:22:12 raspberrypi systemd[1]: Failed to start Mosquitto MQTT Broker.
Display More
Der Output von
sudo service mosquitto restart
Job for mosquitto.service failed because the control process exited with error code.
See "systemctl status mosquitto.service" and "journalctl -xe" for details.
Der Output von
sudo journalctl -xe
░░ Support: https://www.debian.org/support
░░
░░ A start job for unit mosquitto.service has finished with a failure.
░░
░░ The job identifier is 7243 and the job result is failed.
Mai 21 23:43:12 raspberrypi systemd[1]: mosquitto.service: Scheduled restart job, restart counter is at 4.
░░ Subject: Automatic restarting of a unit has been scheduled
░░ Defined-By: systemd
░░ Support: https://www.debian.org/support
░░
░░ Automatic restarting of the unit mosquitto.service has been scheduled, as the result for
░░ the configured Restart= setting for the unit.
Mai 21 23:43:12 raspberrypi systemd[1]: Stopped Mosquitto MQTT Broker.
░░ 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 7312 and the job result is done.
Mai 21 23:43:12 raspberrypi systemd[1]: Starting Mosquitto MQTT Broker...
░░ Subject: A start job for unit mosquitto.service has begun execution
░░ Defined-By: systemd
░░ Support: https://www.debian.org/support
░░
░░ A start job for unit mosquitto.service has begun execution.
░░
░░ The job identifier is 7312.
Mai 21 23:43:12 raspberrypi mosquitto[5614]: 1684705392: Error: Unable to restore persistent database. Unrecognised file format.
Mai 21 23:43:12 raspberrypi mosquitto[5614]: 1684705392: Error: Couldn't open database.
Mai 21 23:43:12 raspberrypi systemd[1]: mosquitto.service: Main process exited, code=exited, status=1/FAILURE
░░ Subject: Unit process exited
░░ Defined-By: systemd
░░ Support: https://www.debian.org/support
░░
░░ An ExecStart= process belonging to unit mosquitto.service has exited.
░░
░░ The process' exit code is 'exited' and its exit status is 1.
Mai 21 23:43:12 raspberrypi 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'.
Mai 21 23:43:12 raspberrypi systemd[1]: Failed to start Mosquitto MQTT Broker.
░░ 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 7312 and the job result is failed.
Mai 21 23:43:13 raspberrypi systemd[1]: mosquitto.service: Scheduled restart job, restart counter is at 5.
░░ Subject: Automatic restarting of a unit has been scheduled
░░ Defined-By: systemd
░░ Support: https://www.debian.org/support
░░
░░ Automatic restarting of the unit mosquitto.service has been scheduled, as the result for
░░ the configured Restart= setting for the unit.
Mai 21 23:43:13 raspberrypi systemd[1]: Stopped Mosquitto MQTT Broker.
░░ 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 7381 and the job result is done.
Mai 21 23:43:13 raspberrypi systemd[1]: mosquitto.service: Start request repeated too quickly.
Mai 21 23:43:13 raspberrypi 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'.
Mai 21 23:43:13 raspberrypi systemd[1]: Failed to start Mosquitto MQTT Broker.
░░ 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 7381 and the job result is failed.
Mai 21 23:43:14 raspberrypi sudo[5615]: pi : TTY=pts/2 ; PWD=/etc/mosquitto ; USER=root ; COMMAND=/usr/bin/journalctl -xe
Mai 21 23:43:14 raspberrypi sudo[5615]: pam_unix(sudo:session): session opened for user root(uid=0) by pi(uid=1000)
Display More
Der Inhalt von
/lib/systemd/system/mosquitto.service
[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 /var/log/mosquitto
ExecStartPre=/bin/mkdir -m 740 -p /run/mosquitto
ExecStartPre=/bin/chown mosquitto /run/mosquitto
[Install]
WantedBy=multi-user.target
Display More
Der Output von
sudo /usr/sbin/mosquitto -c /etc/mosquitto/mosquitto.conf
1684704498: Loading config file /etc/mosquitto/conf.d/my_mosquitto.conf
1684704498: Error: Unable to restore persistent database. Unrecognised file format.
1684704498: Error: Couldn't open database.
Der Inhalt von
/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.gz
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
Display More
Der Inhalt von
/etc/mosquitto/conf.d/my_mosquitto.conf
Der Inhalt vom Logfile
sudo tail -f /var/log/mosquitto/mosquitto.log
1684486475: Saving in-memory database to /var/lib/mosquitto//mosquitto.db.
1684488276: Saving in-memory database to /var/lib/mosquitto//mosquitto.db.
1684490077: Saving in-memory database to /var/lib/mosquitto//mosquitto.db.
1684491878: Saving in-memory database to /var/lib/mosquitto//mosquitto.db.
1684493679: Saving in-memory database to /var/lib/mosquitto//mosquitto.db.
1684495480: Saving in-memory database to /var/lib/mosquitto//mosquitto.db.
1684497281: Saving in-memory database to /var/lib/mosquitto//mosquitto.db.
1684499082: Saving in-memory database to /var/lib/mosquitto//mosquitto.db.
1684500883: Saving in-memory database to /var/lib/mosquitto//mosquitto.db.
Hat jemand eine Idee?
Grüße