Page 1 of 1

Mosquitto MQTT broker v2.0.0

Posted: Friday 05 March 2021 16:15
by FireWizard
This information might be important for everyone who uses the Mosquitto MQTT broker in combination with Domoticz.

Eclipse has released a new Mosquitto MQTT Broker, version 2.0. See: https://mosquitto.org/

Currently version 2.0.8 is available and it may soon reach or have already reached the various repositories.
Users may install this version coincidentally, while doing an upgrade, e.g.:

Code: Select all

sudo apt upgrade
The new version of Mosquitto has breaking changes. (Thanks to the Node Red forum)

You may well need to make some changes to your Mosquitto configuration file and restart in order to let e.g. Node-RED and Domoticz work correctly.

Eclipse has produced a document to support users to migrate from version 1.x to 2.0.
See: https://mosquitto.org/documentation/migrating-to-2-0/

Re: Mosquitto MQTT broker v2.0.0

Posted: Friday 05 March 2021 19:09
by EddyG
A short "fix" is to put a 'conf' file in /etc/mosquitto/conf/
Filename fix-temp.conf content and put a '#' before the log_type you do not want.

Code: Select all

listener 1883
log_type error
log_type notice
log_type information
log_type debug
log_type all
log_dest topic
log_type warning
allow_anonymous true
connection_messages true
max_keepalive 10
log_timestamp true
log_timestamp_format %Y-%m-%dT%H:%M:%S
After that

Code: Select all

sudo systemctl restart mosquitto.service
Then you are good for the time being. ;)

Re: Mosquitto MQTT broker v2.0.0

Posted: Saturday 06 March 2021 12:29
by McMelloW
Thanks for this update. To be sure, is this my current mosquitto version?

Code: Select all

~ $ mosquitto --version
Error: Unknown option '--version'.
mosquitto version 1.5.7

Re: Mosquitto MQTT broker v2.0.0

Posted: Saturday 06 March 2021 12:45
by waaren
McMelloW wrote: Saturday 06 March 2021 12:29 To be sure, is this my current mosquitto version?
Below commands will show you the versions of the mosquitto program and its clients.

Code: Select all

mosquitto -h | grep version
mosquitto_sub --help | grep version | grep mosquitto_
mosquitto_pub --help | grep version | grep mosquitto_

Re: Mosquitto MQTT broker v2.0.0

Posted: Saturday 06 March 2021 13:00
by McMelloW
waaren wrote: Saturday 06 March 2021 12:45 Below commands will show you the versions of the mosquitto program and its clients.

Code: Select all

mosquitto -h | grep version
mosquitto_sub --help | grep version | grep mosquitto_
mosquitto_pub --help | grep version | grep mosquitto_
Thanks a lot.

I guess this will have affect zigbee2mqtt too?

Re: Mosquitto MQTT broker v2.0.0

Posted: Saturday 06 March 2021 14:52
by AllesVanZelf
FireWizard, thank you for this warning. I'm running 1.5.7 right now.
I created a conf file in /etc/mosquitto/conf.d
with this content:

Code: Select all

listener 1883
log_type error
log_type notice
log_type information
log_type debug
log_type all
log_dest topic
log_type warning
#allow_anonymous true
connection_messages true
max_keepalive 10
log_timestamp true
log_timestamp_format %Y-%m-%dT%H:%M:%S 
In /etc/mosquitto I have a mosquitto.conf file with this content:

Code: Select all

pid_file /var/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
password_file /etc/mosquitto/mospass 
With this config, Mosquitto will 1.5.7 not (re)start. :cry:
Am I missing something here?

edit: I missed your warning: "and put a '#' before the log_type you do not want".
If I reduce the config to:

Code: Select all

listener 1883
log_type error
connection_messages true
log_timestamp true
Then it is able to start. With one of the others mosquitto cannot start. even the "log_timestamp_format %Y-%m-%dT%H:%M:%S" gives me problem.

Re: Mosquitto MQTT broker v2.0.0

Posted: Saturday 06 March 2021 18:06
by waaren
McMelloW wrote: Saturday 06 March 2021 13:00 I guess this will have affect zigbee2mqtt too?
Not directly but mosquitto is an essential part of the link between zigbee and domoticz.

Re: Mosquitto MQTT broker v2.0.0

Posted: Saturday 06 March 2021 19:39
by FireWizard
Hi,

@McMelloW wrote.
Thanks for this update. To be sure, is this my current mosquitto version?
If you execute the commands @waaren proposed you will see that:

Code: Select all

pi@RPi1:~ $ mosquitto -h | grep version
mosquitto version 1.5.7
pi@RPi1:~ $ mosquitto_sub --help | grep version | grep mosquitto_
mosquitto_sub version 1.5.7 running on libmosquitto 1.5.7.
pi@RPi1:~ $ mosquitto_pub --help | grep version | grep mosquitto_
mosquitto_pub version 1.5.7 running on libmosquitto 1.5.7.
pi@RPi1:~ $ 
If you prefer to use a graphical environment, you will see it also under $SYS topic.

Screenshot_MQTT-SYS.png
Screenshot_MQTT-SYS.png (43.49 KiB) Viewed 6992 times
The intention of the initial post was not to encourage users to upgrade, but to inform the users, that if they upgrade, either by purpose or accidentally, there are breaking changes, you should be aware of. As long as you use version 1.x.x and it works as expected, there is no reason to modify the mosquitto.conf files. There is no such as a fix or whatever, because there is nothing to fix.

As far as I know, version 1.5.7 is the latest version in the 1.x.x. series.

I do not expect, that in case of an upgrade to version 2.x.x it will break clients, but you should be aware that you have to create a mosquitto.conf file and probably have to modify an existing one.

Special attention for:

Change default listener from port 1883 to listener 1883(if you have in your conf file a line "port 1883")
Include allow_anonymous true (If you want that anonymous clients can connect. it defaults to false)

Regards

Re: Mosquitto MQTT broker v2.0.0

Posted: Saturday 06 March 2021 19:43
by Lizard
FireWizard wrote: Saturday 06 March 2021 19:39
[..]

As far as I know, version 1.5.7 is the latest version in the 1.x.x. series.

[..]
On my RPI running the latest Buster I had v1.6.12 running before the upgrade to 2.0.8.

Another option is to hold the package, so it will not get updated:

Code: Select all

apt-mark hold mosquitto
Of course then you will miss out on security fixes, but I hope your mqtt isn't internet facing. :)

Re: Mosquitto MQTT broker v2.0.0

Posted: Saturday 06 March 2021 21:12
by AllesVanZelf
Now I understand that I just could add listener to the mosquitto.conf file and I'm ready for the upgrade. :D
I'm on Raspberry buster. fully updated en upgraded and still on 1.5.7

Re: Mosquitto MQTT broker v2.0.0

Posted: Saturday 06 March 2021 21:47
by FireWizard
Hello @Lizard,

You wrote:
On my RPI running the latest Buster I had v1.6.12 running before the upgrade to 2.0.8.
In that case you had probably an additional repository enabled, as the latest version available in the official Debian (Rasberry Pi OS, formerly Raspbian) repository is 1.5.7. The latest version in the 1.x.x series, released by Eclipse is version 1.6.13. In the Debian repository, I didn't see a version 2.0.x, but that might change of course sooner or later.

Regards

Re: Mosquitto MQTT broker v2.0.0

Posted: Sunday 07 March 2021 19:18
by EddyG
FireWizard wrote: Saturday 06 March 2021 19:39 There is no such as a fix or whatever, because there is nothing to fix.
I corrected my above post to "fix", because of course you are right it is not a fix.

Re: Mosquitto MQTT broker v2.0.0

Posted: Sunday 21 March 2021 21:04
by Havym
When version 2.0.8 is installed, can i go back to version 1.5.7?
And how can i do that? I'm not good with code.