Mosquitto MQTT broker v2.0.0

Topics (not sure which fora)
when not sure where to post, post here and mods will move it to right forum.

Moderators: leecollings, remb0

Post Reply
User avatar
FireWizard
Posts: 1747
Joined: Tuesday 25 December 2018 12:11
Target OS: Raspberry Pi / ODroid
Domoticz version: Beta
Location: Voorthuizen (NL)
Contact:

Mosquitto MQTT broker v2.0.0

Post 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/
Last edited by FireWizard on Monday 15 March 2021 21:15, edited 3 times in total.
EddyG
Posts: 1042
Joined: Monday 02 November 2015 5:54
Target OS: -
Domoticz version:

Re: Mosquitto MQTT broker v2.0.0

Post 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. ;)
Last edited by EddyG on Sunday 07 March 2021 19:16, edited 1 time in total.
User avatar
McMelloW
Posts: 427
Joined: Monday 20 November 2017 17:01
Target OS: Raspberry Pi / ODroid
Domoticz version: V2024.1
Location: Harderwijk, NL
Contact:

Re: Mosquitto MQTT broker v2.0.0

Post 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
Greetings McMelloW
User avatar
waaren
Posts: 6028
Joined: Tuesday 03 January 2017 14:18
Target OS: Linux
Domoticz version: Beta
Location: Netherlands
Contact:

Re: Mosquitto MQTT broker v2.0.0

Post 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_
Debian buster, bullseye on RPI-4, Intel NUC.
dz Beta, Z-Wave, RFLink, RFXtrx433e, P1, Youless, Hue, Yeelight, Xiaomi, MQTT
==>> dzVents wiki
User avatar
McMelloW
Posts: 427
Joined: Monday 20 November 2017 17:01
Target OS: Raspberry Pi / ODroid
Domoticz version: V2024.1
Location: Harderwijk, NL
Contact:

Re: Mosquitto MQTT broker v2.0.0

Post 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?
Greetings McMelloW
AllesVanZelf
Posts: 265
Joined: Monday 05 February 2018 8:42
Target OS: Raspberry Pi / ODroid
Domoticz version: 12467
Location: Netherlands, near Haarlem
Contact:

Re: Mosquitto MQTT broker v2.0.0

Post 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.
Domoticz 2020.1 (12230) on Raspberry Pi 3B with Raspian Buster. Besides Domoticz, Rpi is running Pi-Hole.
User avatar
waaren
Posts: 6028
Joined: Tuesday 03 January 2017 14:18
Target OS: Linux
Domoticz version: Beta
Location: Netherlands
Contact:

Re: Mosquitto MQTT broker v2.0.0

Post 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.
Debian buster, bullseye on RPI-4, Intel NUC.
dz Beta, Z-Wave, RFLink, RFXtrx433e, P1, Youless, Hue, Yeelight, Xiaomi, MQTT
==>> dzVents wiki
User avatar
FireWizard
Posts: 1747
Joined: Tuesday 25 December 2018 12:11
Target OS: Raspberry Pi / ODroid
Domoticz version: Beta
Location: Voorthuizen (NL)
Contact:

Re: Mosquitto MQTT broker v2.0.0

Post 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 6994 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
Last edited by FireWizard on Thursday 18 March 2021 17:09, edited 1 time in total.
Lizard
Posts: 7
Joined: Wednesday 04 October 2017 0:44
Target OS: Raspberry Pi / ODroid
Domoticz version: beta
Contact:

Re: Mosquitto MQTT broker v2.0.0

Post 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. :)
AllesVanZelf
Posts: 265
Joined: Monday 05 February 2018 8:42
Target OS: Raspberry Pi / ODroid
Domoticz version: 12467
Location: Netherlands, near Haarlem
Contact:

Re: Mosquitto MQTT broker v2.0.0

Post 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
Domoticz 2020.1 (12230) on Raspberry Pi 3B with Raspian Buster. Besides Domoticz, Rpi is running Pi-Hole.
User avatar
FireWizard
Posts: 1747
Joined: Tuesday 25 December 2018 12:11
Target OS: Raspberry Pi / ODroid
Domoticz version: Beta
Location: Voorthuizen (NL)
Contact:

Re: Mosquitto MQTT broker v2.0.0

Post 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
EddyG
Posts: 1042
Joined: Monday 02 November 2015 5:54
Target OS: -
Domoticz version:

Re: Mosquitto MQTT broker v2.0.0

Post 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.
Havym
Posts: 29
Joined: Tuesday 08 October 2019 12:54
Target OS: Raspberry Pi / ODroid
Domoticz version: 2023.2
Location: Enschede (NL)
Contact:

Re: Mosquitto MQTT broker v2.0.0

Post 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.
Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest