I followed this tutorial . https://randomnerdtutorials.com/cloud-mqtt-mosquitto-broker-access-anywhere-digital-ocean/
Everything ws ok . But if I modify the configuration file as follows
- at top >> per_listener_settings true
- at bottom >>
allow_anonymous false
listener 1883
password_file /etc/mosquitto/passwd
I get error.
Here is error log
root@mqtt:~# 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.
root@mqtt:~# sudo 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 Mon 2024-01-29 03:56:25 UTC; 8s ago
Duration: 4min 45.990s
Docs: man:mosquitto.conf(5)
man:mosquitto(8)
Process: 21241 ExecStartPre=/bin/mkdir -m 740 -p /var/log/mosquitto (code=exited, status=0/SUCCESS)
Process: 21242 ExecStartPre=/bin/chown mosquitto:mosquitto /var/log/mosquitto (code=exited, status=>
Process: 21243 ExecStartPre=/bin/mkdir -m 740 -p /run/mosquitto (code=exited, status=0/SUCCESS)
Process: 21244 ExecStartPre=/bin/chown mosquitto:mosquitto /run/mosquitto (code=exited, status=0/SU>
Process: 21245 ExecStart=/usr/sbin/mosquitto -c /etc/mosquitto/mosquitto.conf (code=exited, status=>
Main PID: 21245 (code=exited, status=13)
CPU: 17ms
Jan 29 03:56:25 mqtt systemd[1]: mosquitto.service: Main process exited, code=exited, status=13/n/a
Jan 29 03:56:25 mqtt systemd[1]: mosquitto.service: Failed with result ‘exit-code’.
Jan 29 03:56:25 mqtt systemd[1]: Failed to start mosquitto.service – Mosquitto MQTT Broker.
Jan 29 03:56:25 mqtt systemd[1]: mosquitto.service: Scheduled restart job, restart counter is at 5.
Jan 29 03:56:25 mqtt systemd[1]: Stopped mosquitto.service – Mosquitto MQTT Broker.
Jan 29 03:56:25 mqtt systemd[1]: mosquitto.service: Start request repeated too quickly.
Jan 29 03:56:25 mqtt systemd[1]: mosquitto.service: Failed with result ‘exit-code’.
Jan 29 03:56:25 mqtt systemd[1]: Failed to start mosquitto.service – Mosquitto MQTT Broker.
Hello mosaddeq,
You’ll also need to follow the instructions to Enable Remote Access and add Authentication, read the section “Mosquitto Broker Enable Remote Access (Authentication: user and password)”
Hello,
I followed the instructions several times, uninstalled Mosquitto, did it again, coped the text from the website and fron the Ebook in the file, but mosquitto did not restart. I also made the user with password successfully. Lokal still works. Restart doies not work at all. What can I O ?
Text in Confing-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
per_listener_settings true
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
allow_anonymous false
listener 1883
password_file /etc/mosquitto/passwd
I have a raspberrypi 5 (new) All Steps in the tutorial worked as decribed to that point
Best Regards, Kai
Addititon:
sudo systemctl restart mosquitto
Job for mosquitto.service failed because the control process exi ted with error code.
See “systemctl status mosquitto.service” and “journalctl -xeu mo squitto.service” for details.
sudo systemctl status mosquitto
× mosquitto.service – Mosquitto MQTT Broker
Loaded: loaded (/lib/systemd/system/mosquitto.service; ena>
Active: failed (Result: exit-code) since Thu 2024-12-05 23>
Docs: man:mosquitto.conf(5)
man:mosquitto(8)
Process: 3473 ExecStartPre=/bin/mkdir -m 740 -p /var/log/mo>
Process: 3474 ExecStartPre=/bin/chown mosquitto /var/log/mo>
Process: 3475 ExecStartPre=/bin/mkdir -m 740 -p /run/mosqui>
Process: 3476 ExecStartPre=/bin/chown mosquitto /run/mosqui>
Process: 3477 ExecStart=/usr/sbin/mosquitto -c /etc/mosquit>
Main PID: 3477 (code=exited, status=3)
CPU: 14ms
Dec 05 23:54:49 XXXXXXXXXXXXXXXXX systemd[1]: mosquitto.service: >
Dec 05 23:54:49 XXXXXXXXXXXXXXXXX systemd[1]: Stopped mosquitto.s>
Dec 05 23:54:49 XXXXXXXXXXXXXXXXX systemd[1]: mosquitto.service: >
Dec 05 23:54:49 XXXXXXXXXXXXXXXXX systemd[1]: mosquitto.service: >
Dec 05 23:54:49 XXXXXXXXXXXXXXXXX systemd[1]: Failed to start mos>
lines 1-18/18 (END)
× mosquitto.service – Mosquitto MQTT Broker
Loaded: loaded (/lib/systemd/system/mosquitto.service; enabled; preset: enabled)
Active: failed (Result: exit-code) since Thu 2024-12-05 23:54:49 CET; 11s ago
Docs: man:mosquitto.conf(5)
man:mosquitto(8)
Process: 3473 ExecStartPre=/bin/mkdir -m 740 -p /var/log/mosquitto (code=exited, status=0/SUCCESS)
Process: 3474 ExecStartPre=/bin/chown mosquitto /var/log/mosquitto (code=exited, status=0/SUCCESS)
Process: 3475 ExecStartPre=/bin/mkdir -m 740 -p /run/mosquitto (code=exited, status=0/SUCCESS)
Process: 3476 ExecStartPre=/bin/chown mosquitto /run/mosquitto (code=exited, status=0/SUCCESS)
Process: 3477 ExecStart=/usr/sbin/mosquitto -c /etc/mosquitto/mosquitto.conf (code=exited, status=3)
Main PID: 3477 (code=exited, status=3)
CPU: 14ms
Dec 05 23:54:49 XXXXXXXXXXXXXXXXX[1]: mosquitto.service: Scheduled restart job, restart counter is at 5.
Dec 05 23:54:49 XXXXXXXXXXXXXXXXX[1]: Stopped mosquitto.service – Mosquitto MQTT Broker.
Dec 05 23:54:49 XXXXXXXXXXXXXXXXX[1]: mosquitto.service: Start request repeated too quickly.
Dec 05 23:54:49 XXXXXXXXXXXXXXXXX[1]: mosquitto.service: Failed with result ‘exit-code’.
Dec 05 23:54:49 XXXXXXXXXXXXXXXXX[1]: Failed to start mosquitto.service – Mosquitto MQTT Broker.
Hi.
Can you tell me the exact tutorials that you’re following?
Is it from an eBook? Which one? And on which page are you getting stuck?
Regards,
Sara
Thank you for the quick response. It is the follwoing E-book:
SMART HOME with Raspberry Pi, ESP32, and ESP8266
… and I stuck on page 113 doing the restart od Mosquitto:
sudo systemctl restart mosquitto
Wait a few seconds. Then to check if Mosquitto is running, you can type the following
command:
sudo systemctl status mosquitto
Now, you have authentication with username and password enabled.
If
Did the same today, removed everything,
sudo apt remove mosquitto
sudo apt purge mosquitto
sudo apt install mosquitto
installes again, followed the inst´ructions and it worked (???).
Again thank you for yuor help.