Hi Sara,
I followed with great interest your tutorial on MQTT broker on Raspberry since my goal is to use temp/humid sensors connected to ESP32 sending data that I can receive when connected to a remote PC/smartphone.
I was able to follow the various steps of your tutorial and everything works fine BUT, if I try to enable remore access/authentication, the MQQT broker doesn’t work.
If in the mosquitto.conf I write
listener 1883
allow_anonymous true
MQQT broker works.
If, I put a username ( in my case bruno ) and a passwd (in my case, topo50) I always get the same error when, after having modified the file mosquitto.conf, i run the command
sudo systemctl restart mosquitto
Job for mosquitto.service failed because the control process exited with error code.
See”systemctl status mosquitto.service” and “journalctl -xe” for details
If I run the command systemctl status mosquitto.service
I get this message
mosquitto.service – Mosquitto MQTT v3.1/v3.1.1 Broker
Loaded: loaded (/lib/systemd/system/mosquitto.service; enabled; vendor preset: enabled)
Active: failed (Result: exit-code) since Thu 2023-04-27 21:40:16 CEST; 5min ago
Docs: man:mosquitto.conf(5)
man:mosquitto(8)
Process: 1501 ExecStart=/usr/sbin/mosquitto -c /etc/mosquitto/mosquitto.conf (code=exited, status=1/FAILURE)
Main PID : 1501 (code=exited, status=1/FAILURE)
Apr 27 21:40:16 raspberrypi systemd[1]: mosquitto.service: ServiceRestartSec=100 ms expired, scheduling restart
Apr 27 21:40:16 raspberrypi systemd[1]: mosquitto.service: Scheduled restart job, restart counter is at 5
Apr 27 21:40:16 raspberrypi systemd[1]: Stopped Mosquitto.MQTT v3.1/v3.1.1 Broker
Apr 27 21:40:16 raspberrypi systemd[1]: mosquitto.service:: Start request repeated too quickly
Apr 27 21:40:16 raspberrypi systemd[1]: mosquitto.service:: Failed with result ‘exit-code’.
Apr 27 21:40:16 raspberrypi systemd[1]:Failed to start:Mosquitto MQTT v3.1/v3.1.1 Broker
I tried several times, uninstallin and reainstallin mosquitto but without any result ( and I also googled the web for any useful info, but I just found other people with the same problem and I was not able to understand how they solved it)
Could you help me, please ? Thx in advance
Best
Bruno
Hi.
Can you show me a printscreen of your Raspberry Pi configuration file? To see how it looks after adding those lines for the autentication.
To share a printscreen, upload the picture to google drive or dropbox, or imgur and then share a link to the picture.
Regards,
Sara
Hi,
sorry for the delay in answering your message but I was out of town for work
When you ask for a prontscreen of Raspberry Pi confifuration file do you mean the config.txt of Raspberry that I find in the root or the config file of mqtt ?
Sorry for the question but I’m really a newbie.
Thanks
Bruno
Bruno
Hi.
I’m sorry for the confusion.
It was my mistake.
I meant the mosquito configuration file that you need to edit with these lines:listener 1883
allow_anonymous true
Regards,
Sara
Hi Sara
no problem; I should have understood what you meant.
This is my mqtt config file printscreen AFTER having chosen a user and a password
However i’ve noticed two “strange” facts:
- the first one is that in your tutorial you say that the Mosquitto version running in the Pi should be 2.0.11 or above; on the contrary, even after having updated and upgraded all, mine is 1.5.7 and I don’t know how to install a more recent version ( and the infos on my screen after the command mosquitto -v are different from those shown in your tutorial at page 104)
- when I opened my mqtt config.file, BEFORE adding the lines for enabling the remote access/authentication, however there were differnces when compared to the config file you show at page 107 of your tutorial. In fact I have pid_file /var/run/mosquitto.pid instead of pid_file /run/mosquitto/mosquitto.pid . However I edited the text according to your suggestion.
In summary, my mqtt doesn’t work after having put user and password and the sudo systemctl status moquitto gives the error I already sent to you
At the present I’m completely stuck.
Is there any way of getting out from this situation ?
Thx again for your help
Bruno
Hi.
What version of the Raspberry Pi OS are you running?
Did you start with a fresh installation of the Raspberry Pi OS as mentioned in the eBook?
Regards,
Sara
Hi Sara the version is “Raspbian GNU/Linux 10 (buster)” according to what I get when I run sudo cat /etc/os-release.
I bought from Raspberry vendor a kit containing the Pi400 AND the OS installed on a SD and I just updated and upgraded according to the instructions of tutorial.
I really don’t know if I have to upload another/more recent version
Thanks
Bruno
Hi.
I really recommend installing the operating system recommended on the eBook on that microSD card.
Please follow all the steps in the eBook accordingly.
You need to have the Raspberry Pi OS 64-bit running on your board, otherwise some instructions might be different and some installations might not be compatible (like the influxdb section).
Regards,
Sara