MQTT broker connection refused but all its OK?

My config

Debian GNU/Linux 11 (bullseye)

Kernel = Linux 5.15.84-v8+

Platform = Raspberry Pi 4 Model B Rev 1.2

Uptime = 0 day(s). 4:59:28

CPU Usage = 0% avg over 4 cpu(s) (4 core(s) x 1 socket(s))

CPU Load = 1m: 0.01, 5m: 0.02, 15m: 0.00

Memory = Free: 2.11GB (56%), Used: 1.64GB (44%), Total: 3.75GB

Swap = Free: 2.99GB (100%), Used: 0.00GB (0%), Total: 2.99GB

Root = Free: 22.47GB (81%), Used: 5.10GB (19%), Total: 28.79GB

Updates = 0 apt updates available.

Sessions = 2 session(s)

Processes = 132 running processes of 4194304 maximum processes

I created a brand new OH3 config via the disk image on the web .

Everything works perfectly.
I then installed Mosquitto MQTT Broker on the same RP4 and checked that it was launched and here is the result:
openhabian@openhabian:/ $ sudo systemctl status mosquitto
● mosquitto.service - Mosquitto MQTT Broker
Loaded: loaded (/lib/systemd/system/mosquitto.service; enabled; vendor preset: enabled)
Active: active (running) since Sat 2023-02-11 16:22:47 CET; 1h 27min ago
Docs: man:mosquitto.conf(5)
man:mosquito(8)
Main PID: 2513 (mosquito)
Tasks: 1 (limit: 4915)
CPU: 2.649s
CGroup: /system.slice/mosquitto.service
└─2513 /usr/sbin/mosquitto -c /etc/mosquitto/mosquitto.conf

Feb 11 16:22:47 openhabian systemd[1]: Starting Mosquitto MQTT Broker…
Feb 11 16:22:47 openhabian systemd[1]: Started Mosquitto MQTT Broker.

Everything is ok.
I did some publishing and subscribing tests via the terminal window and everything is ok.

On the other hand, it is impossible to connect with the binding in OH3 or with any utility for that matter.

So far I’m using a dedicated RP3 with Linux Server-xyz 4.19.66-v7+ #1253 SMP Thu Aug 15 11:49:46 BST 2019 armv7l
and it works very well but I would like to recover it for something else and put the MQTT server on the same RP4 as OH3. Thanks for your help.

Have you checked the mosquitto.log file at /var/log/mosquitto/mosquitto.log if it provides any hints like error messages ?

sudo systemctl stop mosquitto.service 
sudo nano /etc/mosquitto/mosquitto.conf

Add and save:

listener 1883
password_file /etc/mosquitto/passwd
allow_anonymous true

sudo systemctl start mosquitto.service

might fix it.

THANKS.
Everything works now

| Ap15e BK
February 11 |

  • | - |
sudo systemctl stop mosquitto.service 
sudo nano /etc/mosquitto/mosquitto.conf

Add and save:

listener 1883
password_file /etc/mosquitto/passwd
allow_anonymous true

sudo systemctl start mosquitto.service

might fix it.

I had this issue with a fresh install of openHABian. Adding password_file /etc/mosquitto/passwd prevented Mosquitto from starting, so I returned mosquitto.conf to the original settings (which already included listener 1883andallow_anonymous true`).

After a reboot of my system, Mosquitto started to work. :man_shrugging:

This topic was automatically closed 41 days after the last reply. New replies are no longer allowed.