# MQTT would not connect to TLS broker

**URL:** <https://discourse.nodered.org/t/mqtt-would-not-connect-to-tls-broker/10803>\
**Category:** General\
**Created:** [4 May 2019 11:57 UTC](https://discourse.nodered.org/t/mqtt-would-not-connect-to-tls-broker/10803 "2019-05-04T11:57:07Z")\
**Posts on this page:** 11\
**Page:** 1

<div class="post-metadata">

**Author:** ![nygma2004](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/nygma2004/32/1308_2.png) [@nygma2004](https://discourse.nodered.org/u/nygma2004)\
**Post date:** [4 May 2019 11:57 UTC](https://discourse.nodered.org/t/mqtt-would-not-connect-to-tls-broker/10803/1 "2019-05-04T11:57:07Z")

</div>

Hi All,

I am sorry to post this here, but I did not find a MQTT specific forum. Yesterday I have updated my NR to the latest version which took about 3.5 hours, mostly because there was some issue with updating the mosquitto. Apt was looking for the wheezy release which is no longer there. I managed to get it working somehow, but my NR is not connecting my a TLS broken. Connecting to the local MQTT is fine, but other mqtt in and out nodes that are linked to a TLS broken just stay "connecting".

This is the point where my lack of NR code and Linux debugging / tracing knowledge is really biting me.  
Would you be able to help me where should I start looking? At the end I managed to update mosquitto yesterday with sudo apt-get install mosquitto, but I guess some libraries are missing after all. How do you start an investigation like this?

Regards,  
Csongor

---

<div class="post-metadata">

**Author:** ![Colin](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/colin/32/17040_2.png) [@Colin](https://discourse.nodered.org/u/Colin)\
**Post date:** [4 May 2019 12:31 UTC](https://discourse.nodered.org/t/mqtt-would-not-connect-to-tls-broker/10803/2 "2019-05-04T12:31:28Z")

</div>

Can you connect using another client, such as mosquitto-sub?  
Updating node-red would not have automatically updated mosquitto, so presumably you did more than just updating node-red.  
What operating system are you running? I know you mentioned Wheezy but it could be Debian or Raspbian, possibly others.  
Post the node red startup log starting with the Welcome to node-red message.

---

<div class="post-metadata">

**Author:** ![nygma2004](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/nygma2004/32/1308_2.png) [@nygma2004](https://discourse.nodered.org/u/nygma2004)\
**Post date:** [4 May 2019 14:02 UTC](https://discourse.nodered.org/t/mqtt-would-not-connect-to-tls-broker/10803/3 "2019-05-04T14:02:58Z")

</div>

Hi Colin,

Ehhh, so I have restarted node-red to capture a fresh log and now mqtt is connected. Therefore it appears that I am good, most probably the remote broker has some temporary connection issue. Sorry for all this.

Btw, when I ran the update bash script yesterday, I noticed that the script was installing Node 6.x.x all the time instead of 10. When I ran the sudo apt-get update I found the the error message when the system was trying to get the mosquitto/.../wheezy/.../Package file. 404 file not found. I guess the same causes the bash script not to update to the latest Node.js.

I have the following OS:  
PRETTY\_NAME="Raspbian GNU/Linux 8 (jessie)"  
NAME="Raspbian GNU/Linux"  
VERSION\_ID="8"  
VERSION="8 (jessie)"  
ID=raspbian  
ID\_LIKE=debian  
HOME\_URL="[http://www.raspbian.org/](http://www.raspbian.org/)"  
SUPPORT\_URL="[http://www.raspbian.org/RaspbianForums](http://www.raspbian.org/RaspbianForums)"  
BUG\_REPORT\_URL="[http://www.raspbian.org/RaspbianBugs](http://www.raspbian.org/RaspbianBugs)"

# And my startup log: Welcome to Node-RED

4 May 15:46:06 - [info] Node-RED version: v0.20.5  
4 May 15:46:06 - [info] Node.js version: v10.15.3  
4 May 15:46:06 - [info] Linux 4.9.35-v7+ arm LE  
4 May 15:46:07 - [info] Loading palette nodes  
4 May 15:46:11 - [info] Worldmap version 1.5.40  
4 May 15:46:13 - [info] Dashboard version 2.14.0 started at /ui  
4 May 15:46:14 - [warn] ------------------------------------------------------  
4 May 15:46:14 - [warn] [node-red-contrib-ecolect/ecolect] Error: Cannot find module 'ecolect/values/index' (line:21)  
4 May 15:46:14 - [warn] ------------------------------------------------------  
4 May 15:46:14 - [info] Settings file : /home/pi/.node-red/settings.js  
4 May 15:46:14 - [info] HTTP Static : /home/pi/node-red-static  
4 May 15:46:14 - [info] Context store : 'default' [module=memory]  
4 May 15:46:14 - [info] User directory : /home/pi/.node-red  
4 May 15:46:14 - [warn] Projects disabled : set editorTheme.projects.enabled=true to enable  
4 May 15:46:14 - [info] Flows file : /home/pi/.node-red/flows\_OpenHAB.json  
4 May 15:46:14 - [info] Server now running at [https://127.0.0.1:1880/](https://127.0.0.1:1880/)  
4 May 15:46:15 - [info] Starting flows  
4 May 15:46:19 - [info] [worldmap:4dac5582.33b0cc] started at /worldmap  
4 May 15:46:19 - [info] Started flows

Does all this look OK for you?

Thanks,  
Csongor

---

<div class="post-metadata">

**Author:** ![Colin](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/colin/32/17040_2.png) [@Colin](https://discourse.nodered.org/u/Colin)\
**Post date:** [4 May 2019 14:27 UTC](https://discourse.nodered.org/t/mqtt-would-not-connect-to-tls-broker/10803/4 "2019-05-04T14:27:39Z")

</div>

Looks OK, it shows node 10.15.3 is installed. Are you sure it was not npm that you were seeing at v6.x?  
You do have a problem with node-red-contrib-ecolect though, but that may just be that you haven't set it up yet.  
Did you sort the mosquitto problem? It sounds as if you have/had a problem with your software sources setup. If you are not sure it is sorted then what does this show?  
`sudo apt-cache policy mosquitto`

---

<div class="post-metadata">

**Author:** ![nygma2004](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/nygma2004/32/1308_2.png) [@nygma2004](https://discourse.nodered.org/u/nygma2004)\
**Post date:** [4 May 2019 14:37 UTC](https://discourse.nodered.org/t/mqtt-would-not-connect-to-tls-broker/10803/5 "2019-05-04T14:37:49Z")

</div>

I am sure Node was only at 6.x and the email component is not read was not running as it required 8 or higher. At first I did not even notice that as all the tick marks in the update script were greeen.  
I am removing ecolect and that error will probably go away. I am not using it any more so, not a burning problem.

apt-cache policy mosquitto says the following:

> mosquitto:  
> Installed: 1.3.4-2+deb8u3  
> Candidate: 1.3.4-2+deb8u3  
> Version table:  
> \*\*\* 1.3.4-2+deb8u3 0  
> 500 [Index of /raspbian](http://mirrordirector.raspbian.org/raspbian/) jessie/main armhf Packages  
> 100 /var/lib/dpkg/status

---

<div class="post-metadata">

**Author:** ![nygma2004](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/nygma2004/32/1308_2.png) [@nygma2004](https://discourse.nodered.org/u/nygma2004)\
**Post date:** [4 May 2019 14:43 UTC](https://discourse.nodered.org/t/mqtt-would-not-connect-to-tls-broker/10803/6 "2019-05-04T14:43:41Z")

</div>

I fixed the mosquitto issue by downloading the jessie source setup for mosquitto, adding it to apt-get and running the update again. At list this is what I understood. I just followed steps on a post somewhere... I was pretty much in panic mode and trying out random stuff without really understanding what it does. I know this is not ideal.

---

<div class="post-metadata">

**Author:** ![Colin](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/colin/32/17040_2.png) [@Colin](https://discourse.nodered.org/u/Colin)\
**Post date:** [4 May 2019 14:50 UTC](https://discourse.nodered.org/t/mqtt-would-not-connect-to-tls-broker/10803/7 "2019-05-04T14:50:12Z")

</div>

Mosquitto looks ok, you did the right thing by the look of it.  
Well you can see from the startup log that node is at 10 now so that's ok.

---

<div class="post-metadata">

**Author:** ![zenofmud](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/zenofmud/32/316_2.png) [@zenofmud](https://discourse.nodered.org/u/zenofmud)\
**Post date:** [4 May 2019 15:19 UTC](https://discourse.nodered.org/t/mqtt-would-not-connect-to-tls-broker/10803/8 "2019-05-04T15:19:02Z")

</div>

Just as a curiosity, why are you using`jessie` instead of `stretch`?

---

<div class="post-metadata">

**Author:** ![nygma2004](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/nygma2004/32/1308_2.png) [@nygma2004](https://discourse.nodered.org/u/nygma2004)\
**Post date:** [4 May 2019 16:51 UTC](https://discourse.nodered.org/t/mqtt-would-not-connect-to-tls-broker/10803/9 "2019-05-04T16:51:22Z")

</div>

I was blindly following various blog post which did not explain why something is happening and neither explain how the solution works. So I was typing some commands in and all of a sudden it was working.  
To be honest, I am completely clueless when in comes to Linux packages, and what jessie or strech is.

---

<div class="post-metadata">

**Author:** ![zenofmud](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/zenofmud/32/316_2.png) [@zenofmud](https://discourse.nodered.org/u/zenofmud)\
**Post date:** [4 May 2019 18:25 UTC](https://discourse.nodered.org/t/mqtt-would-not-connect-to-tls-broker/10803/10 "2019-05-04T18:25:21Z")

</div>

Jessie and Stretch are the names of the debian releases. Stretch is the latest. If you flash a new SD card using the [latest release from th RPI foundation](https://www.raspberrypi.org/downloads/raspbian/), you will be installing the Stretch version.

---

<div class="post-metadata">

**Author:** ![Colin](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/colin/32/17040_2.png) [@Colin](https://discourse.nodered.org/u/Colin)\
**Post date:** [4 May 2019 20:27 UTC](https://discourse.nodered.org/t/mqtt-would-not-connect-to-tls-broker/10803/11 "2019-05-04T20:27:51Z")

</div>

However, if you have a working system that is performing a task then it may be a bit of a pain to reinstall the OS and all the applications, so it may be sensible to stick with what you have.
