FlyingDrMike
Posts: 8
Joined: Thu Sep 07, 2017 5:21 pm

Re: STRECH and MQTT

Thu Sep 07, 2017 6:29 pm

Dear all

I have the identical problem as the first posting here. This is on a clean install of Raspbian Stretch. The only software loaded beforehand was NodeRed. I used: sudo wget http://repo.mosquitto.org/debian/mosquitto-stretch.list.

I looked at Aptitude but was not sure if either of the references from a search on Mosquito were correct.

The issue on the mosquitto GitHub does not have any assignees so not sure how quickly a solution will be found.

Response to apt-cache policy mosquitto is:

mosquitto:
Installed: (none)
Candidate: 1.4.12-0mosquitto1
Version table:
1.4.12-0mosquitto1 500
500 http://repo.mosquitto.org/debian stretch/main armhf Packages
1.4.10-3 500
500 http://mirrordirector.raspbian.org/raspbian stretch/main armhf Packages


So would appreciate thoughts on the best approach to get Mosquitto running. Would be great if I don't have to start from scratch (again).

Mike

User avatar
topguy
Posts: 3423
Joined: Tue Oct 09, 2012 11:46 am
Location: Trondheim, Norway

Re: STRECH and MQTT

Thu Sep 07, 2017 10:29 pm

It would be beneficial if you post *your* exact error messages.

The main problem is that the package I find on the repo you refer to, depends on the "libssl1.0.0" package, but both current versions of Debian and Raspbian call the package "libssl1.0.2". It doesnt matter what version number is inside the package if the name is wrong.

If you are the adventurous type you can actually fix this yourself.

Code: Select all

# get the deb-file with wget or copy it from "/var/cache/apt/archives"
wget http://repo.mosquitto.org/debian/pool/main/m/mosquitto/mosquitto_1.4.14-0mosquitto1~nows1_armhf.deb

#extract package
mkdir tmpdeb
dpkg-deb -R mosquitto/mosquitto_1.4.14-0mosquitto1~nows1_armhf.deb tmpdeb

#Fix wrong dependency
nano tmpdeb/DEBIAN/CONTROL
# Now change "libssl1.0.0" to "libssl1.0.2" on the line that starts with "Depends:"
# Save and exit.

# Rebuild
dpkg-deb -b tmpdeb mosquitto_fixed.deb

# Install
sudo dpkg -i mosquitto_fixed.deb
There are probably the same error in the other packages that are available from that repo, but at least the server itself does not seem to depend on them.

EDIT:
I just realized that "nows" stands for "no websockets". And looking here ( http://repo.mosquitto.org/debian/pool/main/m/mosquitto/ ) I find no v1.4.14 version for Stretch with websockets. That might be because the version of libwebsockets in Stretch is "libwebsockets8" and the one in Jessie was "libwebsockets3".. idk..

FlyingDrMike
Posts: 8
Joined: Thu Sep 07, 2017 5:21 pm

Re: STRECH and MQTT

Fri Sep 08, 2017 7:46 am

Thank you for your quick reply. I will give this a go, and also change the libwebsockets dependency from 3 to 8. For reference my error messages were:

pi@home:/etc/apt/sources.list.d $ sudo apt-get install mosquitto
Reading package lists... Done
Building dependency tree
Reading state information... Done
Some packages could not be installed. This may mean that you have
requested an impossible situation or if you are using the unstable
distribution that some required packages have not yet been created
or been moved out of Incoming.
The following information may help to resolve the situation:

The following packages have unmet dependencies:
mosquitto : Depends: libssl1.0.0 (>= 1.0.1) but it is not installable
Depends: libwebsockets3 (>= 1.2) but it is not installable
E: Unable to correct problems, you have held broken packages.

Thank you.

Mike

FlyingDrMike
Posts: 8
Joined: Thu Sep 07, 2017 5:21 pm

Re: STRECH and MQTT

Fri Sep 08, 2017 4:45 pm

Success - but a bit of a bumpy ride! I hope the trail below will useful to others to also get mosquito working on Stretch. However a couple of points:
I wget the version 1.14.12 as this is what was showing as Candidate earlier.
The .deb file was downloaded to root so I did not need the mosquitto/mosquitto/ in the dpkg-deb -R instruction
I ended up editing the control file in leafpad.
The first install failed as I did not have libwebsockets8 installed. So do a:

Code: Select all

apt-cache policy libwebsockets8
first and install if required.

see my install of libwebsockets8 below that also failed but was fixed with

Code: Select all

sudo apt --fix-broken install
Now to my trail. See at the end checks for both mosquito installed and mosquitto stop/start.

Code: Select all

pi@home:~ $ mkdir tmpdeb
pi@home:~ $ wget http://repo.mosquitto.org/debian/pool/main/m/mosquitto/mosquitto_1.4.12-0mosquitto1_armhf.deb
--2017-09-08 14:45:06--  http://repo.mosquitto.org/debian/pool/main/m/mosquitto/mosquitto_1.4.12-0mosquitto1_armhf.deb
Resolving repo.mosquitto.org (repo.mosquitto.org)... 85.119.83.194, 2001:ba8:1f1:f271::2
Connecting to repo.mosquitto.org (repo.mosquitto.org)|85.119.83.194|:80... connected.
HTTP request sent, awaiting response... 200 OK
Length: 121368 (119K) [application/octet-stream]
Saving to: ‘mosquitto_1.4.12-0mosquitto1_armhf.deb’

mosquitto_1.4.12-0mosquitto1_ar 100%[====================================================>] 118.52K  --.-KB/s    in 0.05s

2017-09-08 14:45:06 (2.15 MB/s) - ‘mosquitto_1.4.12-0mosquitto1_armhf.deb’ saved [121368/121368]

pi@home:~ $ dpkg-deb -R mosquitto_1.4.12-0mosquitto1_armhf.deb tmpdeb
# Now change "libssl1.0.0" to "libssl1.0.2" and "libwebsockets3" to "libwebsockets8" on the line that starts with "Depends:"
pi@home:~ $ dpkg-deb -b tmpdeb mosquitto_fixed.deb
dpkg-deb: building package 'mosquitto' in 'mosquitto_fixed.deb'.
pi@home:~ $ sudo dpkg -i mosquitto_fixed.deb
Selecting previously unselected package mosquitto.
(Reading database ... 124155 files and directories currently installed.)
Preparing to unpack mosquitto_fixed.deb ...
Unpacking mosquitto (1.4.12-0mosquitto1) ...
dpkg: dependency problems prevent configuration of mosquitto:
 mosquitto depends on libwebsockets8 (>= 1.2); however:
  Package libwebsockets8 is not installed.

dpkg: error processing package mosquitto (--install):
 dependency problems - leaving unconfigured
Processing triggers for systemd (232-25+deb9u1) ...
Processing triggers for man-db (2.7.6.1-2) ...
Errors were encountered while processing:
 mosquitto
pi@home:~ $ apt-cache policy libwebsockets8
libwebsockets8:
  Installed: (none)
  Candidate: 2.0.3-2
  Version table:
     2.0.3-2 500
        500 http://mirrordirector.raspbian.org/raspbian stretch/main armhf Packages
pi@home:~ $ sudo apt-get install libwebsockets8
Reading package lists... Done
Building dependency tree
Reading state information... Done
You might want to run 'apt --fix-broken install' to correct these.
The following packages have unmet dependencies:
 libwebsockets8 : Depends: libev4 (>= 1:4.04) but it is not going to be installed
E: Unmet dependencies. Try 'apt --fix-broken install' with no packages (or specify a solution).
pi@home:~ $ sudo apt --fix-broken install
Reading package lists... Done
Building dependency tree
Reading state information... Done
Correcting dependencies... Done
The following packages will be REMOVED:
  mosquitto
0 upgraded, 0 newly installed, 1 to remove and 1 not upgraded.
1 not fully installed or removed.
After this operation, 354 kB disk space will be freed.
Do you want to continue? [Y/n] Y
(Reading database ... 124187 files and directories currently installed.)
Removing mosquitto (1.4.12-0mosquitto1) ...
/usr/sbin/deluser: The user `mosquitto' does not exist.
Processing triggers for man-db (2.7.6.1-2) ...
pi@home:~ $ apt-cache policy libwebsockets8
libwebsockets8:
  Installed: (none)
  Candidate: 2.0.3-2
  Version table:
     2.0.3-2 500
        500 http://mirrordirector.raspbian.org/raspbian stretch/main armhf Packages
pi@home:~ $ sudo apt-get install libwebsockets8
Reading package lists... Done
Building dependency tree
Reading state information... Done
The following additional packages will be installed:
  libev4
The following NEW packages will be installed:
  libev4 libwebsockets8
0 upgraded, 2 newly installed, 0 to remove and 1 not upgraded.
Need to get 119 kB of archives.
After this operation, 265 kB of additional disk space will be used.
Do you want to continue? [Y/n] y
Get:1 http://mirrordirector.raspbian.org/raspbian stretch/main armhf libev4 armhf 1:4.22-1 [34.0 kB]
Get:2 http://mirrordirector.raspbian.org/raspbian stretch/main armhf libwebsockets8 armhf 2.0.3-2 [85.1 kB]
Fetched 119 kB in 0s (480 kB/s)
Selecting previously unselected package libev4.
(Reading database ... 124166 files and directories currently installed.)
Preparing to unpack .../libev4_1%3a4.22-1_armhf.deb ...
Unpacking libev4 (1:4.22-1) ...
Selecting previously unselected package libwebsockets8:armhf.
Preparing to unpack .../libwebsockets8_2.0.3-2_armhf.deb ...
Unpacking libwebsockets8:armhf (2.0.3-2) ...
Setting up libev4 (1:4.22-1) ...
Setting up libwebsockets8:armhf (2.0.3-2) ...
Processing triggers for libc-bin (2.24-11+deb9u1) ...
pi@home:~ $  apt-cache policy libwebsockets8
libwebsockets8:
  Installed: 2.0.3-2
  Candidate: 2.0.3-2
  Version table:
 *** 2.0.3-2 500
        500 http://mirrordirector.raspbian.org/raspbian stretch/main armhf Packages
        100 /var/lib/dpkg/status
pi@home:~ $ sudo dpkg -i mosquitto_fixed.deb
Selecting previously unselected package mosquitto.
(Reading database ... 124178 files and directories currently installed.)
Preparing to unpack mosquitto_fixed.deb ...
Unpacking mosquitto (1.4.12-0mosquitto1) ...
Setting up mosquitto (1.4.12-0mosquitto1) ...
Processing triggers for systemd (232-25+deb9u1) ...
Processing triggers for man-db (2.7.6.1-2) ...
pi@home:~ $ apt-cache policy mosquitto
mosquitto:
  Installed: 1.4.12-0mosquitto1
  Candidate: 1.4.12-0mosquitto1
  Version table:
     1.4.12-0mosquitto1 500
        500 http://repo.mosquitto.org/debian stretch/main armhf Packages
 *** 1.4.12-0mosquitto1 100
        100 /var/lib/dpkg/status
     1.4.10-3 500
        500 http://mirrordirector.raspbian.org/raspbian stretch/main armhf Packages
pi@home:~ $ sudo /etc/init.d/mosquitto stop
[ ok ] Stopping mosquitto (via systemctl): mosquitto.service.
pi@home:~ $ sudo /etc/init.d/mosquitto start
[ ok ] Starting mosquitto (via systemctl): mosquitto.service.
pi@home:~ $
Thank you for your help. Very nice to have this sorted and without starting from scratch! I find the Pi a big trial and am most grateful for the advice. Assembly code on PICs is a piece of cake compared to this.

I can now get on with gaining some C experience getting MQTT working with some ESP8266s.

Mike

User avatar
bonzadog
Posts: 153
Joined: Wed Apr 25, 2012 9:40 am
Location: Rietberg/Germany

Re: STRECH and MQTT

Sat Sep 09, 2017 12:35 pm

DougieLawson wrote:
Wed Aug 23, 2017 2:00 pm
Can you folks explain what part of viewtopic.php?p=1201759#p1199879 isn't working for you?
Perhaps that works but according to
root@test1:/home/pi/Install-Programmes# apt-cache policy mosquitto
mosquitto:
Installed: (none)
Candidate: 1.4.12-0mosquitto1
Version table:
1.4.12-0mosquitto1 500
500 http://repo.mosquitto.org/debian stretch/main armhf Packages
1.4.10-3 500
500 http://mirrordirector.raspbian.org/raspbian stretch/main armhf Packages
100 /var/lib/dpkg/status

So, mosquitto is there and available to be installed.

my install is based on https://iotbytes.wordpress.com/mosquitt ... pberry-pi
BUT I did find that if I do not execute:
cd /etc/apt/sources.list.d/
sudo wget http://repo.mosquitto.org/debian/mosquitto-stretch.list #

sudo apt-get install -y mosquitto worked.
......
sudo apt-get paho-mqtt

Perhaps I am missing a more up to date install information

BD

Each pf my RPis can the act as a brocker and/or client/subscriber as required.

FlyingDrMike
Posts: 8
Joined: Thu Sep 07, 2017 5:21 pm

Re: STRECH and MQTT

Sat Sep 09, 2017 1:29 pm

I am not convinced the install after editing the dependency file has worked.

First I have a Sonoff switch with the Tasmoda firmware loaded and logged on to my network. It reports:

14:00:26 MQT: Attempting connection...
14:00:27 DNS: Query done. MQTT services found 0

I then checked mosquito was running and tried mosquitto - v - that gave an error:

Code: Select all

pi@home:~ $ sudo /etc/init.d/mosquitto stop
[ ok ] Stopping mosquitto (via systemctl): mosquitto.service.
pi@home:~ $ sudo /etc/init.d/mosquitto start
[ ok ] Starting mosquitto (via systemctl): mosquitto.service.
pi@home:~ $ mosquitto -v
mosquitto: error while loading shared libraries: libssl.so.1.0.0: cannot open shared object file: No such file or directory
I then tried to subscribe and publish and got command not found:

Code: Select all

pi@home:~ $ mosquitto_sub -d -t hello/world
-bash: mosquitto_sub: command not found
pi@home:~ $ mosquitto_pub -d -t hello/world -m "Hello from Terminal window 2!"
-bash: mosquitto_pub: command not found
pi@home:~ $
Any help would be much appreciated.

Mike

User avatar
topguy
Posts: 3423
Joined: Tue Oct 09, 2012 11:46 am
Location: Trondheim, Norway

Re: STRECH and MQTT

Sat Sep 09, 2017 5:16 pm

You could go to the directory /usr/lib/arm...somethinhsomthing and make a symbolic link from the libssl.so.1.0.2 file to the name its looking for.

FlyingDrMike
Posts: 8
Joined: Thu Sep 07, 2017 5:21 pm

Re: STRECH and MQTT

Sat Sep 09, 2017 10:11 pm

Sorry I have had enough getting nowhere. I have gone back to square one, loaded jessie and am now able to do coms from mosquitto to an ESP loaded with Sonoff-Tasmota so I can concentrate on IoT rather than Linux. It is time for someone else to take up the mantle of getting mosquitto on Stretch. When I see a solution, and others confirming it works then I will have another go. This has been three days of frustration. I think this is enough. Mike

B.Goode
Posts: 4170
Joined: Mon Sep 01, 2014 4:03 pm
Location: UK

Re: STRECH and MQTT

Sat Sep 09, 2017 10:23 pm

This tutorial/walk-through by @ASandford appears to have been endorsed as working by the person being assisted:

viewtopic.php?f=32&t=192137&p=1208936#p1206901

asandford
Posts: 1597
Joined: Mon Dec 31, 2012 12:54 pm
Location: Ealing

Re: STRECH and MQTT

Sat Sep 09, 2017 11:58 pm

B.Goode wrote:
Sat Sep 09, 2017 10:23 pm
This tutorial/walk-through by @ASandford appears to have been endorsed as working by the person being assisted:

viewtopic.php?f=32&t=192137&p=1208936#p1206901
It was more of a quick intro guide, but yes, it worked (as can be seen on the post - nothing edited) on a fresh card install and apt upgraded before MQTT software installation.

wally333
Posts: 27
Joined: Mon Jun 06, 2016 7:09 pm

Re: STRECH and MQTT

Mon Sep 11, 2017 3:42 pm

bullockbob wrote:
Mon Aug 28, 2017 1:59 am
Does anyone actually have the Mosquitto broker installed and running under Stretch? If so, can they detail their exact steps for the installation process? That would be really helpful.
Clean Raspbian Stretch 2017-09-07 install, sudo apt-get install mosquitto worked for me. Also install the mosquitto-clients package for easy testing.

sudo apt-get update ; sudo apt-get dist-upgrade should work if your initial install was Stretch, if you installed third party repos or have upgraded from Jessie, all I can say apt is very good, but a long way from perfect.

User avatar
DougieLawson
Posts: 29312
Joined: Sun Jun 16, 2013 11:19 pm
Location: Basingstoke, UK
Contact: Website

Re: STRECH and MQTT

Mon Sep 11, 2017 10:01 pm

My Jessie machines that I've upgraded to Stretch (edit /etc/apt/ files, run apt-get update, apt-get dist-upgrade) have a working copy of Mosquitto.

It doesn't look like the issue with the install https://github.com/eclipse/mosquitto/issues/529 is resolved (there's lots of "me too"'s but no sane response from the developers).
Microprocessor, Raspberry Pi & Arduino Hacker
Mainframe database troubleshooter
MQTT Evangelist
Twitter: @DougieLawson

Since 2012: 1B*5, 2B*2, B+, A+, Zero*2, 3B*3

Please post ALL technical questions on the forum. Do not send private messages.

asandford
Posts: 1597
Joined: Mon Dec 31, 2012 12:54 pm
Location: Ealing

Re: STRECH and MQTT

Tue Sep 12, 2017 10:46 pm

Of course other MQ brokers are available (that can handle the MQTT protocol) if Mosquitto is broken.

Heater
Posts: 7570
Joined: Tue Jul 17, 2012 3:02 pm

Re: STRECH and MQTT

Sun Sep 17, 2017 10:53 am

Bonzadog,

I just noticed this in an earlier post:
(I got a few PM regarding the name. Bonzadog was an original English Group in the 1960's. Their full name was Bonza Dog Doo Dah Band)
Actually the band was "The Bonzo Dog Doo-Dah Band" also known as "The Bonzo Dog Band". Or for us just "The Bonzos"

http://bonzodog.co.uk

FlyingDrMike
Posts: 8
Joined: Thu Sep 07, 2017 5:21 pm

Re: STRECH and MQTT

Tue Sep 19, 2017 10:19 am

I have now loaded Mosquitto on both Jessie and Stretch.

In the case of Jessie I used the following code before install:

Code: Select all

sudo wget http://repo.mosquitto.org/debian/mosquitto-repo.gpg.key
sudo apt-key add mosquitto-repo.gpg.key
cd /etc/apt/sources.list.d
sudo wget http://repo.mosquitto.org/debian/mosquitto-jessie.list
I was able to install mosquito, mosquitto clients and python mosquitto.

Code: Select all

sudo apt-get update
sudo apt-get install mosquitto mosquitto-clients python-mosquitto
This delivered Mosquitto version 1.4.14

The repo list for Stetch did not enable install.

So I just used apt-get.
python-mosquitto did not install - so only able to do:

Code: Select all

sudo apt-get update
sudo apt-get install mosquitto mosquitto-clients
This delivered Mosquitto version 1.4.10

Stretch also had a later version of Node Red (0.17.4 vs 0.15.3 for jessie)

So in conclusion it appears that one has a choice or either

Jessie+Mosquitto 1.4.14+Node Red 0.15.3+ mosquitto clients and python-mosquitto

or:

Stretch + Mosquitto 1.4.10+Node Red 0.17.4+mosquitto clients but not python-mosquitto.

Mike

mattmiller
Posts: 1422
Joined: Thu Feb 05, 2015 11:25 pm

Re: STRECH and MQTT

Tue Sep 19, 2017 11:55 am

AFAIK python-mosquitto was original method of coding MQTT stuff in Python and was superceded a while ago by paho-mqtt which is installed using pip
https://mosquitto.org/documentation/python/

User avatar
DougieLawson
Posts: 29312
Joined: Sun Jun 16, 2013 11:19 pm
Location: Basingstoke, UK
Contact: Website

Re: STRECH and MQTT

Tue Sep 19, 2017 12:01 pm

mattmiller wrote:
Tue Sep 19, 2017 11:55 am
AFAIK python-mosquitto was original method of coding MQTT stuff in Python and was superceded a while ago by paho-mqtt which is installed using pip
https://mosquitto.org/documentation/python/
You are not wrong. Although looking at the sample code, it's largely a re-packaging exercise.
Microprocessor, Raspberry Pi & Arduino Hacker
Mainframe database troubleshooter
MQTT Evangelist
Twitter: @DougieLawson

Since 2012: 1B*5, 2B*2, B+, A+, Zero*2, 3B*3

Please post ALL technical questions on the forum. Do not send private messages.

Return to “Raspbian”

Who is online

Users browsing this forum: JonesThePi and 28 guests