Working rhough SMART HOME with Raspberry Pi, ESP32, and ESP8266 page 107 after successfully entering usename andpassword and modifyiying the conf file andrestarting I still get a connection refused error. I also note that sudo systemctl status mosquitto
command gives a status of:
Active: active (exited) not running as per your book.
Did you follow the instructions shown in the eBook, or did you already have another mosquitto installation?
Try to rerun the following command:
sudo systemctl restart mosquitto
Then, reboot your raspberry pi
Then, check the status of mosquitto again after the RPi restarts.
sudo systemctl status mosquitto
Let me know the results.
No change after following your instruction.
pi@raspberrypi:~ $ sudo systemctl status mosquitto
● mosquitto.service – LSB: mosquitto MQTT v3.1 message broker
Loaded: loaded (/etc/init.d/mosquitto; generated; vendor preset: enabled)
Active: active (exited) since Tue 2022-09-27 20:22:58 AEST; 1min 31s ago
Process: 318 ExecStart=/etc/init.d/mosquitto start (code=exited, status=0/SUCC
Tasks: 0 (limit: 4915)
Sep 27 20:22:57 raspberrypi systemd: Starting LSB: mosquitto MQTT v3.1 messag
Sep 27 20:22:58 raspberrypi mosquitto: Starting network daemon:: mosquitto.
Sep 27 20:22:58 raspberrypi systemd: Started LSB: mosquitto MQTT v3.1 message
lines 1-11/11 (END)
I have followed the steps in your book apart from the actual pi install. I had one allready set up and readyto go. This did not include mosquitto however.
I examined the password file with nano and it showed the usernames I had put corectly. Passsowrd was scrambled as expected.
Broker responded correctly without authentication but after authentication is added I get this.
mosquitto_pub -d -t testTopic -m “Hello world!” -u mal -P mal
Error: Connection refused
this is my conf file
# Place your local configuration in /etc/mosquitto/conf.d/
# A full description of the configuration file is at
log_dest file /var/log/mosquitto/mosquitto.log
Thank you for your help.
I’m not sure why you’re getting that issue.
Did you start a new installation of the OS when you started the eBook? Did you install the mosquito from start or did you already have mosquito installed? I’m trying to understand what might be the cause.
I found a similar issue: https://github.com/eclipse/mosquitto/issues/641
They mention that if you set the persistence setting to false instead of true in the configuration file, it solves the problem:
Let me know if this helps with your issue.
Try only this if the previous workaround doesn’t work.
Also, try changing the following line:
Thanks for your time Sara.
Tried all the above but no joy so I blew away the old installation and restrated from scratch with a fresh install everything is now OK and status now says running and not exited. Authenticated messages now working