[SOLVED] Mosquitto stopped working after upgrade to v 1.5

Hello,

just did today the apt-upgrade and I saw that Mosquitto was upgraded to the version 1.5.
However, MQTT stopped working. Looking at the mosquitto.log it was the following information:

1527548294: mosquitto version 1.5 starting
1527548294: Config loaded from /etc/mosquitto/mosquitto.conf.
1527548294: Opening ipv4 listen socket on port 1883.
1527548294: Opening ipv4 listen socket on port 1883.
1527548294: Error: Address already in use

I tried to stop the service, rebooted the raspberry pi, but it didn’t work.

Any help would be appreciated!

Paulo

post your mosquitto.conf

try to comment out the following lines in it:

# include_dir /etc/mosquitto/conf.d
# listener 1883 0.0.0.0

After commenting the lines, I could see that the connection from the devices to mosquitto were done, but MQTT is not listening to the commands, nothing is working…

my mosquitto.conf :

pid_file /var/run/mosquitto.pid
persistence true
persistence_location /var/lib/mosquitto/
log_dest file /var/log/mosquitto/mosquitto.log
include_dir /etc/mosquitto/conf.d
password_file /etc/mosquitto/passwd
allow_anonymous false
listener 1883 0.0.0.0

oh, my OH was upgraded to 2.3.0 too…

Hello,
i had the same problem, i commented out the line with “listener” and everything worked again (OH2.2, mosquitto 1.5).

1 Like

I made the following modification at mosquitto.conf (I indented the listener). The devices are connecting but mqtt is not listening to the messages:

pid_file /var/run/mosquitto.pid
persistence true
persistence_location /var/lib/mosquitto/
log_dest file /var/log/mosquitto/mosquitto.log
include_dir /etc/mosquitto/conf.d
password_file /etc/mosquitto/passwd
allow_anonymous false
"# listener 1883 0.0.0.0

To comment out use

# listener 1883 0.0.0.0

Check your /etc/mosquitto/conf.d/mosquitto.conf for any valid listeners, for example

listener 1883

I did that, # listener 1883.0.0.0 (just typed wrong).

When I take out the comment the devices doesn’t connect.

Looking at the log, I can see that the devices are connecting but mqtt is not listening to the port 13

1527624926: New connection from 192.168.0.18 on port 1883.
1527624926: New client connected from 192.168.0.18 as DVES_A5E292 (c1, k15, u’openhabian’).
1527624953: New connection from 192.168.0.16 on port 1883.
1527624953: New client connected from 192.168.0.16 as DVES_0741B21 (c1, k15, u’openhabian’).
1527624968: New connection from 192.168.0.21 on port 1883.
1527624968: New client connected from 192.168.0.21 as DVES_A7A901 (c1, k15, u’openhabian’).
1527625003: New connection from 192.168.0.22 on port 1883.
1527625003: New client connected from 192.168.0.22 as DVES_A74C9F (c1, k15, u’openhabian’).
1527625009: New connection from 127.0.0.1 on port 1883.
1527625009: New client connected from 127.0.0.1 as openHAB2 (c1, k60, u’openhabian’).
1527625461: Client openHAB2 disconnected.
1527625545: Client DVES_0741B21 has exceeded timeout, disconnecting.
1527625545: Socket error on client DVES_0741B21, disconnecting.
1527625549: New connection from 192.168.0.16 on port 1883.
1527625549: New client connected from 192.168.0.16 as DVES_0741B21 (c1, k15, u’openhabian’).

How can I know which process is using the port 1883? But as far as I know there is no process using this port.

lsof -i :1883

lsof -i :1883

nothing appeared… so strange…

Any clues?

[12:28:32] pi@raspberrypi:~$ lsof -i :1883
[12:31:42] pi@raspberrypi:~$ mosquitto -p 1883
1527697965: mosquitto version 1.5 starting
1527697965: Using default config.
1527697965: Opening ipv4 listen socket on port 1883.
1527697965: Error: Address already in use

I tried this command:

sudo lsof -i TCP:1883
COMMAND PID USER FD TYPE DEVICE SIZE/OFF NODE NAME
mosquitto 480 mosquitto 4u IPv4 11931 0t0 TCP *:1883 (LISTEN)
mosquitto 480 mosquitto 5u IPv6 11932 0t0 TCP *:1883 (LISTEN)
mosquitto 480 mosquitto 7u IPv4 9968 0t0 TCP 192.168.0.2:1883->192.1 68.0.8:13146 (ESTABLISHED)

yeah. i forgot to tell you to use sudo
(I always sudo su first :))

so… the Mosquitto MQTT Broker is up and running and listening to 1833.
You also have 1 client connected
Try to debug the OH2 connection
see troubleshooting section on MQTT Binding (v1.11) Getting Started 101

1 Like

Hello, finally MQTT started to work.

I had to disable and enable MQTT Binding and comment this line:

listener 1883 0.0.0.0

After this everything went ok!!

Thanks for your help!

Paulo

So you used this or commented this out with # ?
I am struggling with the same issue

EDIT: I got the connection from my phone (Owntracks) by commenting out the following

#include_dir /etc/mosquitto/conf.d

in

/etc/mosquitto/mosquitto.conf

and mosquitto still reports to listen on port 1883 (I don’t have listen in the config above).

And openhab is obviously connecting:

New client connected from 127.0.0.1 as openHAB (c1, k60, u'mosquitto').

but I get no updates in OH

EDIT 2:
I restarted mqtt transport and mqtt binding from karaf.
It seemed to have solved the issue.
The root cause (using another config than before) is still unknown.