Update Mosquitto to latest version

Hi, i use MDEK and PANS2,
Can i update Mosquitto in my bridges to the latest version or if i update mosquitto the bridge can have issues?

Regards
Ivan

Hi Ivan

I can’t completely advise regarding this, it may break the gateway functionality. I guess the best is to try and revert to the previous image if you see poor performance with the new mosquitto version.

Thanks
Yves

Hi Ivan,

newer version of Mosquitto should work also.

Any MQTT v3.1.1 Broker or Mosquitto version 1.5.1 or newer should be fine.

Cheers,
TDK

1 Like

Hi, following this thread, could/should a Mosquitto upgrade just be done via apt-get on the Pi or another means or was it installed using an alternative approach?

Hi @richb
the Mosquitto on the RPi was compiled from source code because the default one did not had turned on the websocket interface. The current versions of MQTT should support websocket out of box so you can try it via apt-get.

Best regards,
Jiri

Hi @jk-leapslabs - thank you. I’d seen that mosquitto wasn’t in dpkg so thought it must have been from source, but couldn’t figure out why. Nice to know.

I’ve done the following:

  • Added the source list for buster
  • apt-get update
  • Installed a specific version : apt-get install mosquitto=1.5.7-1+deb10u1
  • Dropped the original mosquitto config back in to /etc/mosquitto/mosquitto.conf
  • Restart dwm-1001 service and restart mosquitto service
  • Checked to see if it was working (is node data streaming on the topic?) : sadly not
  • Checked the logs and journalctl for the dwm daemon and mosquitto - nothing obvious
  • Ran /usr/local/bin/dwm-daemon --help (the executable called by the init.d script) - to see if it would fail with an error. It did. This:
/usr/local/bin/dwm-daemon: error while loading shared libraries: libmosquittopp.so.1: cannot open shared object file: No such file or directory
  • I’d squirrelled away the mosquitto files used in your from source installation, so I re-instated that file into the right place and ran sudo ldconfig.
  • Ran /usr/local/bin/dwm-daemon --help again - this time no error (and bonus, I learned how to set the log verbosity for the dwm-daemon :slight_smile: ).
  • Restarted mosquitto and dwm-daemon (with a -v 6 appended to the command in the init.d script to help any debugging.
  • Still no joy - no data coming through, but this now in the /var/log/dwm-daemon.log:
INFO  [5479] [leaps::core::[email protected]] Client decac414c5a55582 reconnect
(over and over)

So, what do I think I know from this:

  • An apt-get based installation of a more recent version (1.5.x) of mosquitto doesn’t quite work (at least, the way I tried it).
  • I think there’s a dependency in the dwm-daemon itself on libmosquittopp.so.1. Edge of my understanding here on what that file does, so I might be off the mark.
  • Perhaps when I installed the more recent version of mosquitto, it bumped versions of libraries that dwm was dependent on which broke something? If that was the case, would executing /usr/local/bin/dwm-daemon --help even work? I would have expected it to error earlier.
  • Not sure whether that reconnect snippet ^ is normal behaviour or as a result of connection failing.

Any answers to any of my questions much appreciated. Any suggestions of config or things I should be doing also hugely appreciated.

And for context, here’s why I’m doing this: I would like to write an ansible playbook/module that automates the build of gateways.

I’ve seen that dwm.ko is compiled against 4.14.50-v7+ so I realise that’s a hard and fast dependency that won’t budge. And I’m cool with using that as the base OS for ansible to run against.

I had hoped I could :

  • Extract the various dwm-related files from the raspbian image - done with a bit of diffing.
  • Make them part of the Ansible deployment/playbook
  • Use Ansible to install any version of mosquitto.
  • Do the other stuff I wanted to do with Ansible (firewall, remove obsolete packages like NodeRed, etc.)

That got me poking at mosquitto and before i knew it, I was up to my neck in it :slight_smile:

If you can think of an easier way for me to achieve the same result, then groovy. Any advice about how the dwm-daemon works with mosquitto that might help me would be massively appreciated too.

Hi @richb

The mosquitto provides the broker and the client library (used by dwm-daemon) which can be installed separately. If the daemon is running, to see why the daemon is not connecting to the broker, I would run the broker manually with verbose debug log and see why is it so. It might give you some useful hits.

Jan.

@leapslabs - ah, cool. Obvious now you say it - it’s the client library for the daemon, makes sense. That was the bit I was missing from my understanding when I wrote:

I’ll try running mosquitto manually and with verbose debug and see what I find. Thank you again :pray: