MQTT: Failed to start, return code: 14/Connection refused (Check IP/Port)

Others (MiLight, Hue, Toon etc...)

Moderator: leecollings

Post Reply
marktn
Posts: 232
Joined: Tuesday 21 April 2015 21:39
Target OS: Windows
Domoticz version:
Contact:

MQTT: Failed to start, return code: 14/Connection refused (Check IP/Port)

Post by marktn »

Hi,

Anybody who can help me with MQTT?

After sudo apt update && sudo apt upgrade
In my log of domoticz: MQTT: Failed to start, return code: 14/Connection refused (Check IP/Port)

Code: Select all

pi@raspberrypi:~ $ systemctl status mosquitto.service
● mosquitto.service - Mosquitto MQTT Broker
   Loaded: loaded (/lib/systemd/system/mosquitto.service; enabled; vendor preset: enabled)
   Active: failed (Result: exit-code) since Fri 2022-12-16 21:25:24 CET; 28s ago
     Docs: man:mosquitto.conf(5)
           man:mosquitto(8)
  Process: 4684 ExecStartPre=/bin/mkdir -m 740 -p /var/log/mosquitto (code=exited, status=0/SUCCESS)
  Process: 4685 ExecStartPre=/bin/chown mosquitto /var/log/mosquitto (code=exited, status=0/SUCCESS)
  Process: 4686 ExecStartPre=/bin/mkdir -m 740 -p /run/mosquitto (code=exited, status=0/SUCCESS)
  Process: 4687 ExecStartPre=/bin/chown mosquitto /run/mosquitto (code=exited, status=0/SUCCESS)
  Process: 4688 ExecStart=/usr/sbin/mosquitto -c /etc/mosquitto/mosquitto.conf (code=exited, status=1/FAILURE)
 Main PID: 4688 (code=exited, status=1/FAILURE)

Dec 16 21:25:24 raspberrypi systemd[1]: mosquitto.service: Service RestartSec=100ms expired, scheduling restart.
Dec 16 21:25:24 raspberrypi systemd[1]: mosquitto.service: Scheduled restart job, restart counter is at 5.
Dec 16 21:25:24 raspberrypi systemd[1]: Stopped Mosquitto MQTT Broker.
Dec 16 21:25:24 raspberrypi systemd[1]: mosquitto.service: Start request repeated too quickly.
Dec 16 21:25:24 raspberrypi systemd[1]: mosquitto.service: Failed with result 'exit-code'.
Dec 16 21:25:24 raspberrypi systemd[1]: Failed to start Mosquitto MQTT Broker.
pi@raspberrypi:~ $ ● mosquitto.service - Mosquitto MQTT Broker
Dec 16 21:25:24 raspberrypi systemd[1]: mosquitto.service: Failed with result 'exit-code'.
Dec 16 21:25:24 raspberrypi systemd[1]: Failed to start Mosquitto MQTT Broker.
Domoticz latest stable, Intel NUC, Proxmox, Zigate, RFLink, Kaku switches, Ikea lights, Xiaomi sensors, Honeywell smoke detectors, Yeelight, Shelly, Slave Domoticz PI 3B+, Node-Red, Espeasy.
JuanUil
Posts: 497
Joined: Friday 22 May 2015 12:21
Target OS: Raspberry Pi / ODroid
Domoticz version: 4.11083
Location: Asten NB Nederland
Contact:

Re: MQTT: Failed to start, return code: 14/Connection refused (Check IP/Port)

Post by JuanUil »

Same here see viewtopic.php?t=39564
Your mind is like a parachute,
It only works when it is opened!

RPI4 several Fibaro, KaKu, Neocoolcam switches, Z-Wave, Zigbee2Mqtt, Ikea bulbs and remote, Zigbee temp nodes
marktn
Posts: 232
Joined: Tuesday 21 April 2015 21:39
Target OS: Windows
Domoticz version:
Contact:

Re: MQTT: Failed to start, return code: 14/Connection refused (Check IP/Port)

Post by marktn »

JuanUil wrote: Friday 16 December 2022 22:03 Same here see viewtopic.php?t=39564
Okay... Hopefully somebody can help.
My Backup is running is fine.
Domoticz latest stable, Intel NUC, Proxmox, Zigate, RFLink, Kaku switches, Ikea lights, Xiaomi sensors, Honeywell smoke detectors, Yeelight, Shelly, Slave Domoticz PI 3B+, Node-Red, Espeasy.
ferrosk
Posts: 44
Joined: Saturday 26 August 2017 20:13
Target OS: Linux
Domoticz version: 2023.2
Contact:

Re: MQTT: Failed to start, return code: 14/Connection refused (Check IP/Port)

Post by ferrosk »

Do you have this log file /var/log/mosquitto/mosquitto.log? Check if there are any errors...
Domoticz 2023.2 on Odroid M1 and Armbian
MySensors (RFM69 Serial GW): bunch of DIY sensors/devices
Zwave (Z-Wave.me RaZberry board): Danfoss devices
Zigbee (Sonoff Dongle Plus): IKEA, Tesla devices
marktn
Posts: 232
Joined: Tuesday 21 April 2015 21:39
Target OS: Windows
Domoticz version:
Contact:

Re: MQTT: Failed to start, return code: 14/Connection refused (Check IP/Port)

Post by marktn »

ferrosk wrote: Friday 16 December 2022 23:39 Do you have this log file /var/log/mosquitto/mosquitto.log? Check if there are any errors...
Thanks for your support! Any idea what to do?

Code: Select all

log
1669305336: mosquitto version 1.6.12 starting
1669305336: Config loaded from /etc/mosquitto/mosquitto.conf.
1669305336: Opening ipv4 listen socket on port 1883.
1669305336: Error: Address already in use
1669305336: mosquitto version 1.6.12 starting
1669305336: Config loaded from /etc/mosquitto/mosquitto.conf.
1669305336: Opening ipv4 listen socket on port 1883.
1669305336: Error: Address already in use
1669305337: mosquitto version 1.6.12 starting
1669305337: Config loaded from /etc/mosquitto/mosquitto.conf.
1669305337: Opening ipv4 listen socket on port 1883.
1669305337: Error: Address already in use
1669305337: mosquitto version 1.6.12 starting
1669305337: Config loaded from /etc/mosquitto/mosquitto.conf.
1669305337: Opening ipv4 listen socket on port 1883.
1669305337: Error: Address already in use
1669305337: mosquitto version 1.6.12 starting
1669305337: Config loaded from /etc/mosquitto/mosquitto.conf.
1669305337: Opening ipv4 listen socket on port 1883.
1669305337: Error: Address already in use
1669393843: mosquitto version 1.6.12 starting
1669393843: Config loaded from /etc/mosquitto/mosquitto.conf.
1669393843: Opening ipv4 listen socket on port 1883.
1669393843: Error: Address already in use
1669393844: mosquitto version 1.6.12 starting
1669393844: Config loaded from /etc/mosquitto/mosquitto.conf.
1669393844: Opening ipv4 listen socket on port 1883.
1669393844: Error: Address already in use
1669393844: mosquitto version 1.6.12 starting
1669393844: Config loaded from /etc/mosquitto/mosquitto.conf.
1669393844: Opening ipv4 listen socket on port 1883.
1669393844: Error: Address already in use
1669393844: mosquitto version 1.6.12 starting
1669393844: Config loaded from /etc/mosquitto/mosquitto.conf.
1669393844: Opening ipv4 listen socket on port 1883.
1669393844: Error: Address already in use
1669393844: mosquitto version 1.6.12 starting
1669393844: Config loaded from /etc/mosquitto/mosquitto.conf.
1669393844: Opening ipv4 listen socket on port 1883.
1669393844: Error: Address already in use
1669394062: mosquitto version 1.6.12 starting
1669394062: Config loaded from /etc/mosquitto/mosquitto.conf.
1669394062: Opening ipv4 listen socket on port 1883.
1669394062: Error: Address already in use

Code: Select all

sudo service mosquitto status
● mosquitto.service - Mosquitto MQTT Broker
   Loaded: loaded (/lib/systemd/system/mosquitto.service; enabled; vendor preset: enabled)
   Active: failed (Result: exit-code) since Sat 2022-12-17 10:16:41 CET; 10min ago
     Docs: man:mosquitto.conf(5)
           man:mosquitto(8)
  Process: 813 ExecStartPre=/bin/mkdir -m 740 -p /var/log/mosquitto (code=exited, status=0/SUCCESS)
  Process: 814 ExecStartPre=/bin/chown mosquitto /var/log/mosquitto (code=exited, status=0/SUCCESS)
  Process: 815 ExecStartPre=/bin/mkdir -m 740 -p /run/mosquitto (code=exited, status=0/SUCCESS)
  Process: 816 ExecStartPre=/bin/chown mosquitto /run/mosquitto (code=exited, status=0/SUCCESS)
  Process: 817 ExecStart=/usr/sbin/mosquitto -c /etc/mosquitto/mosquitto.conf (code=exited, status=1/FAILURE)
 Main PID: 817 (code=exited, status=1/FAILURE)

Dec 17 10:16:41 raspberrypi systemd[1]: mosquitto.service: Service RestartSec=100ms expired, scheduling restart.
Dec 17 10:16:41 raspberrypi systemd[1]: mosquitto.service: Scheduled restart job, restart counter is at 5.
Dec 17 10:16:41 raspberrypi systemd[1]: Stopped Mosquitto MQTT Broker.
Dec 17 10:16:41 raspberrypi systemd[1]: mosquitto.service: Start request repeated too quickly.
Dec 17 10:16:41 raspberrypi systemd[1]: mosquitto.service: Failed with result 'exit-code'.
Dec 17 10:16:41 raspberrypi systemd[1]: Failed to start Mosquitto MQTT Broker.
pi@raspberrypi:/var/log/mosquitto $

Code: Select all

sudo service mosquitto restart

Job for mosquitto.service failed because the control process exited with error code.
See "systemctl status mosquitto.service" and "journalctl -xe" for details.
You have new mail in /var/mail/pi
pi@raspberrypi:/var/log/mosquitto $

Code: Select all

pi@raspberrypi:~ $ sudo netstat -anp | grep 1883
tcp        0      0 127.0.0.1:1883          0.0.0.0:*               LISTEN      547/mosquitto
tcp        0      0 127.0.0.1:49362         127.0.0.1:1883          ESTABLISHED 320/node-red
tcp        0      0 127.0.0.1:49360         127.0.0.1:1883          ESTABLISHED 320/node-red
tcp        0      0 127.0.0.1:1883          127.0.0.1:49362         ESTABLISHED 547/mosquitto
tcp        0      0 192.168.1.5:44068       192.168.1.6:1883        ESTABLISHED 320/node-red
tcp        0      0 127.0.0.1:1883          127.0.0.1:49360         ESTABLISHED 547/mosquitto
tcp        0      0 192.168.1.5:44070       192.168.1.6:1883        ESTABLISHED 320/node-red
tcp6       0      0 ::1:1883                :::*                    LISTEN      547/mosquitto
pi@raspberrypi:~ $
Domoticz latest stable, Intel NUC, Proxmox, Zigate, RFLink, Kaku switches, Ikea lights, Xiaomi sensors, Honeywell smoke detectors, Yeelight, Shelly, Slave Domoticz PI 3B+, Node-Red, Espeasy.
ferrosk
Posts: 44
Joined: Saturday 26 August 2017 20:13
Target OS: Linux
Domoticz version: 2023.2
Contact:

Re: MQTT: Failed to start, return code: 14/Connection refused (Check IP/Port)

Post by ferrosk »

hello,

Apparently you have other mosquitto process already started/running and using port 1883 when you try to start mosquitto.service in parallel and fails because the port is already in use. Try to identify service which started the process using port 1883:

find PID of the process which is using port 1883:

Code: Select all

sudo netstat -anp | grep :1883
example:

$ sudo netstat -anp | grep 1883
tcp 0 0 127.0.0.1:1883 0.0.0.0:* LISTEN 547/mosquitto

this means process PID is 547

Then try to find service which started this process:

Code: Select all

sudo systemctl status <PID>
example:

sudo systemctl status 547

Don't you have another mosquitto i.e. running in Docker container?
Domoticz 2023.2 on Odroid M1 and Armbian
MySensors (RFM69 Serial GW): bunch of DIY sensors/devices
Zwave (Z-Wave.me RaZberry board): Danfoss devices
Zigbee (Sonoff Dongle Plus): IKEA, Tesla devices
marktn
Posts: 232
Joined: Tuesday 21 April 2015 21:39
Target OS: Windows
Domoticz version:
Contact:

Re: MQTT: Failed to start, return code: 14/Connection refused (Check IP/Port)

Post by marktn »

Thanks! I see somebody with experience.
No docker running or another mosquitto. Not that i know. I don't have a lot of experience with this.

Is this what you need?

Code: Select all

pi@raspberrypi:~ $ sudo netstat -anp | grep :1883
tcp        0      0 127.0.0.1:1883          0.0.0.0:*               LISTEN                                                                                                                   546/mosquitto
tcp6       0      0 ::1:1883                :::*                    LISTEN                                                                                                                   546/mosquitto
pi@raspberrypi:~ $ ^C
pi@raspberrypi:~ $ sudo systemctl status 546
Warning: The unit file, source configuration file or drop-ins of rc-local.service changed on disk. Run 'systemctl daemon-reload' to reload units.
● rc-local.service - /etc/rc.local Compatibility
   Loaded: loaded (/lib/systemd/system/rc-local.service; enabled-runtime; vendor preset: enabled)
  Drop-In: /lib/systemd/system/rc-local.service.d
           └─debian.conf
           /etc/systemd/system/rc-local.service.d
           └─ttyoutput.conf
   Active: active (running) since Sat 2022-12-17 15:11:53 CET; 19h ago
     Docs: man:systemd-rc-local-generator(8)
  Process: 526 ExecStart=/etc/rc.local start (code=exited, status=0/SUCCESS)
    Tasks: 1 (limit: 2200)
   Memory: 1.5M
   CGroup: /system.slice/rc-local.service
           └─546 /usr/sbin/mosquitto -d

Dec 17 15:11:53 raspberrypi systemd[1]: Starting /etc/rc.local Compatibility...
Dec 17 15:11:53 raspberrypi systemd[1]: Started /etc/rc.local Compatibility.
You have new mail in /var/mail/pi
pi@raspberrypi:~ $
Domoticz latest stable, Intel NUC, Proxmox, Zigate, RFLink, Kaku switches, Ikea lights, Xiaomi sensors, Honeywell smoke detectors, Yeelight, Shelly, Slave Domoticz PI 3B+, Node-Red, Espeasy.
ferrosk
Posts: 44
Joined: Saturday 26 August 2017 20:13
Target OS: Linux
Domoticz version: 2023.2
Contact:

Re: MQTT: Failed to start, return code: 14/Connection refused (Check IP/Port)

Post by ferrosk »

hello,

Check the content of /etc/rc.local file. Maybe you have a command to start mosquitto in it. In that case system tries to start one mosquitto by rc-local.service and another mosquitto by mosquitto.service. If it mosquitto command is present in /etc/rc.local comment it out or remove the line. Then do:

sudo systemctl daemon-reload
sudo systemctl start mosquitto
sudo systemctl status mosquitto

or reboot the system.
Domoticz 2023.2 on Odroid M1 and Armbian
MySensors (RFM69 Serial GW): bunch of DIY sensors/devices
Zwave (Z-Wave.me RaZberry board): Danfoss devices
Zigbee (Sonoff Dongle Plus): IKEA, Tesla devices
marktn
Posts: 232
Joined: Tuesday 21 April 2015 21:39
Target OS: Windows
Domoticz version:
Contact:

Re: MQTT: Failed to start, return code: 14/Connection refused (Check IP/Port)

Post by marktn »

ferrosk wrote: Sunday 18 December 2022 13:43 hello,

Check the content of /etc/rc.local file. Maybe you have a command to start mosquitto in it. In that case system tries to start one mosquitto by rc-local.service and another mosquitto by mosquitto.service. If it mosquitto command is present in /etc/rc.local comment it out or remove the line. Then do:

sudo systemctl daemon-reload
sudo systemctl start mosquitto
sudo systemctl status mosquitto

or reboot the system.
Hello,


It was this,

Code: Select all

#!/bin/sh -e
#
# rc.local
#
# This script is executed at the end of each multiuser runlevel.
# Make sure that the script will "exit 0" on success or any other
# value on error.
#
# In order to enable or disable this script just change the execution
# bits.
#
# By default this script does nothing.

# Print the IP address
_IP=$(hostname -I) || true
if [ "$_IP" ]; then
  printf "My IP address is %s\n" "$_IP"
fi

/usr/sbin/mosquitto -d

exit 0

And changed it to this:

Code: Select all

#!/bin/sh -e
#
# rc.local
#
# This script is executed at the end of each multiuser runlevel.
# Make sure that the script will "exit 0" on success or any other
# value on error.
#
# In order to enable or disable this script just change the execution
# bits.
#
# By default this script does nothing.

# Print the IP address
_IP=$(hostname -I) || true
if [ "$_IP" ]; then
  printf "My IP address is %s\n" "$_IP"
fi

#/usr/sbin/mosquitto -d

exit 0
status:

Code: Select all

sudo systemctl status mosquitto

● mosquitto.service - Mosquitto MQTT Broker
   Loaded: loaded (/lib/systemd/system/mosquitto.service; enabled; vendor preset: enabled)
   Active: failed (Result: exit-code) since Sun 2022-12-18 14:07:50 CET; 39s ago
     Docs: man:mosquitto.conf(5)
           man:mosquitto(8)
  Process: 820 ExecStartPre=/bin/mkdir -m 740 -p /var/log/mosquitto (code=exited, status=0/SUCCESS)
  Process: 821 ExecStartPre=/bin/chown mosquitto /var/log/mosquitto (code=exited, status=0/SUCCESS)
  Process: 822 ExecStartPre=/bin/mkdir -m 740 -p /run/mosquitto (code=exited, status=0/SUCCESS)
  Process: 823 ExecStartPre=/bin/chown mosquitto /run/mosquitto (code=exited, status=0/SUCCESS)
  Process: 824 ExecStart=/usr/sbin/mosquitto -c /etc/mosquitto/mosquitto.conf (code=exited, status=3)
 Main PID: 824 (code=exited, status=3)

Dec 18 14:07:50 raspberrypi systemd[1]: mosquitto.service: Service RestartSec=100ms expired, scheduling restart.
Dec 18 14:07:50 raspberrypi systemd[1]: mosquitto.service: Scheduled restart job, restart counter is at 5.
Dec 18 14:07:50 raspberrypi systemd[1]: Stopped Mosquitto MQTT Broker.
Dec 18 14:07:50 raspberrypi systemd[1]: mosquitto.service: Start request repeated too quickly.
Dec 18 14:07:51 raspberrypi systemd[1]: mosquitto.service: Failed with result 'exit-code'.
Dec 18 14:07:51 raspberrypi systemd[1]: Failed to start Mosquitto MQTT Broker.
~
The error is the same..
Also did a reboot, to be sure. And checked the settings.

Maybe an idea,to do a remote desktop with teamviewer?
Domoticz latest stable, Intel NUC, Proxmox, Zigate, RFLink, Kaku switches, Ikea lights, Xiaomi sensors, Honeywell smoke detectors, Yeelight, Shelly, Slave Domoticz PI 3B+, Node-Red, Espeasy.
ferrosk
Posts: 44
Joined: Saturday 26 August 2017 20:13
Target OS: Linux
Domoticz version: 2023.2
Contact:

Re: MQTT: Failed to start, return code: 14/Connection refused (Check IP/Port)

Post by ferrosk »

as I can see now it fails with return code 3 which is different as before:

Process: 824 ExecStart=/usr/sbin/mosquitto -c /etc/mosquitto/mosquitto.conf (code=exited, status=3)

so check the log file /var/log/mosquitto/mosquitto.log what is the error now
Domoticz 2023.2 on Odroid M1 and Armbian
MySensors (RFM69 Serial GW): bunch of DIY sensors/devices
Zwave (Z-Wave.me RaZberry board): Danfoss devices
Zigbee (Sonoff Dongle Plus): IKEA, Tesla devices
marktn
Posts: 232
Joined: Tuesday 21 April 2015 21:39
Target OS: Windows
Domoticz version:
Contact:

Re: MQTT: Failed to start, return code: 14/Connection refused (Check IP/Port)

Post by marktn »

ferrosk wrote: Sunday 18 December 2022 14:39 as I can see now it fails with return code 3 which is different as before:

Process: 824 ExecStart=/usr/sbin/mosquitto -c /etc/mosquitto/mosquitto.conf (code=exited, status=3)

so check the log file /var/log/mosquitto/mosquitto.log what is the error now
Hello,

Code: Select all

1671284179: mosquitto version 2.0.12 starting
1671284179: Config loaded from /etc/mosquitto/mosquitto.conf.
1671284179: Starting in local only mode. Connections will only be possible from clients running on this machine.
1671284179: Create a configuration file which defines a listener to allow remote access.
1671284179: For more details see https://mosquitto.org/documentation/authentication-methods/
1671284179: Opening ipv4 listen socket on port 1883.
1671284179: Error: Address already in use
1671284179: Opening ipv6 listen socket on port 1883.
1671284179: Error: Address already in use
1671284180: mosquitto version 2.0.12 starting
1671284180: Config loaded from /etc/mosquitto/mosquitto.conf.
1671284180: Starting in local only mode. Connections will only be possible from clients running on this machine.
1671284180: Create a configuration file which defines a listener to allow remote access.
1671284180: For more details see https://mosquitto.org/documentation/authentication-methods/
1671284180: Opening ipv4 listen socket on port 1883.
1671284180: Error: Address already in use
1671284180: Opening ipv6 listen socket on port 1883.
1671284180: Error: Address already in use
1671284181: mosquitto version 2.0.12 starting
1671284181: Config loaded from /etc/mosquitto/mosquitto.conf.
1671284181: Starting in local only mode. Connections will only be possible from clients running on this machine.
1671284181: Create a configuration file which defines a listener to allow remote access.
1671284181: For more details see https://mosquitto.org/documentation/authentication-methods/
1671284181: Opening ipv4 listen socket on port 1883.
1671284181: Error: Address already in use
1671284181: Opening ipv6 listen socket on port 1883.
1671284181: Error: Address already in use
1671284181: mosquitto version 2.0.12 starting
1671284181: Config loaded from /etc/mosquitto/mosquitto.conf.
1671284181: Starting in local only mode. Connections will only be possible from clients running on this machine.
1671284181: Create a configuration file which defines a listener to allow remote access.
1671284181: For more details see https://mosquitto.org/documentation/authentication-methods/
1671284181: Opening ipv4 listen socket on port 1883.
1671284181: Error: Address already in use
1671284181: Opening ipv6 listen socket on port 1883.
1671284181: Error: Address already in use
1671284181: mosquitto version 2.0.12 starting
1671284181: Config loaded from /etc/mosquitto/mosquitto.conf.
1671284181: Starting in local only mode. Connections will only be possible from clients running on this machine.
1671284181: Create a configuration file which defines a listener to allow remote access.
1671284181: For more details see https://mosquitto.org/documentation/authentication-methods/
1671284181: Opening ipv4 listen socket on port 1883.
1671284181: Error: Address already in use
1671284181: Opening ipv6 listen socket on port 1883.


1671284181: Error: Address already in use
1671284181: Opening ipv6 listen socket on port 1883.
1671284181: Error: Address already in use
1671284181: mosquitto version 2.0.12 starting
1671284181: Config loaded from /etc/mosquitto/mosquitto.conf.
1671284181: Starting in local only mode. Connections will only be possible from clients running on this machine.
1671284181: Create a configuration file which defines a listener to allow remote access.
1671284181: For more details see https://mosquitto.org/documentation/authentication-methods/
1671284181: Opening ipv4 listen socket on port 1883.
1671284181: Error: Address already in use
1671284181: Opening ipv6 listen socket on port 1883.
1671284181: Error: Address already in use
1671284181: mosquitto version 2.0.12 starting
1671284181: Config loaded from /etc/mosquitto/mosquitto.conf.
1671284181: Starting in local only mode. Connections will only be possible from clients running on this machine.
1671284181: Create a configuration file which defines a listener to allow remote access.
1671284181: For more details see https://mosquitto.org/documentation/authentication-methods/
1671284181: Opening ipv4 listen socket on port 1883.
1671284181: Error: Address already in use
1671284181: Opening ipv6 listen socket on port 1883.
1671284181: Error: Address already in use
1671284181: mosquitto version 2.0.12 starting
1671284181: Config loaded from /etc/mosquitto/mosquitto.conf.
1671284181: Starting in local only mode. Connections will only be possible from clients running on this machine.
1671284181: Create a configuration file which defines a listener to allow remote access.
1671284181: For more details see https://mosquitto.org/documentation/authentication-methods/
1671284181: Opening ipv4 listen socket on port 1883.
1671284181: Error: Address already in use
1671284181: Opening ipv6 listen socket on port 1883.
1671284181: Error: Address already in use
1671284340: mosquitto version 2.0.12 starting
1671284340: Config loaded from /etc/mosquitto/mosquitto.conf.
Domoticz latest stable, Intel NUC, Proxmox, Zigate, RFLink, Kaku switches, Ikea lights, Xiaomi sensors, Honeywell smoke detectors, Yeelight, Shelly, Slave Domoticz PI 3B+, Node-Red, Espeasy.
ferrosk
Posts: 44
Joined: Saturday 26 August 2017 20:13
Target OS: Linux
Domoticz version: 2023.2
Contact:

Re: MQTT: Failed to start, return code: 14/Connection refused (Check IP/Port)

Post by ferrosk »

according to timestamp (1671284340), the logs from last run are the following:

1671284340: mosquitto version 2.0.12 starting
1671284340: Config loaded from /etc/mosquitto/mosquitto.conf.

looks like no errors... strange

try stop / remove the log / start again and check status/logs:

sudo systemctl stop mosquitto
sudo rm /var/log/mosquitto/mosquitto.log
sudo systemctl start mosquitto
sudo systemctl status mosquitto
sudo cat /var/log/mosquitto/mosquitto.log
Domoticz 2023.2 on Odroid M1 and Armbian
MySensors (RFM69 Serial GW): bunch of DIY sensors/devices
Zwave (Z-Wave.me RaZberry board): Danfoss devices
Zigbee (Sonoff Dongle Plus): IKEA, Tesla devices
marktn
Posts: 232
Joined: Tuesday 21 April 2015 21:39
Target OS: Windows
Domoticz version:
Contact:

Re: MQTT: Failed to start, return code: 14/Connection refused (Check IP/Port)

Post by marktn »

ferrosk wrote: Sunday 18 December 2022 15:20 according to timestamp (1671284340), the logs from last run are the following:

1671284340: mosquitto version 2.0.12 starting
1671284340: Config loaded from /etc/mosquitto/mosquitto.conf.

looks like no errors... strange

try stop / remove the log / start again and check status/logs:

sudo systemctl stop mosquitto
sudo rm /var/log/mosquitto/mosquitto.log
sudo systemctl start mosquitto
sudo systemctl status mosquitto
sudo cat /var/log/mosquitto/mosquitto.log

Still a failure..

Code: Select all

pi@raspberrypi:~ $ sudo systemctl stop mosquitto
pi@raspberrypi:~ $ sudo rm /var/log/mosquitto/mosquitto.log
pi@raspberrypi:~ $ sudo systemctl start mosquitto
Job for mosquitto.service failed because the control process exited with error c                                                                                                             ode.
See "systemctl status mosquitto.service" and "journalctl -xe" for details.
pi@raspberrypi:~ $ sudo systemctl status mosquitto
● mosquitto.service - Mosquitto MQTT Broker
   Loaded: loaded (/lib/systemd/system/mosquitto.service; enabled; vendor preset
   Active: failed (Result: exit-code) since Sun 2022-12-18 15:28:07 CET; 5s ago
     Docs: man:mosquitto.conf(5)
           man:mosquitto(8)
  Process: 1186 ExecStartPre=/bin/mkdir -m 740 -p /var/log/mosquitto (code=exite
  Process: 1187 ExecStartPre=/bin/chown mosquitto /var/log/mosquitto (code=exite
  Process: 1188 ExecStartPre=/bin/mkdir -m 740 -p /run/mosquitto (code=exited, s
  Process: 1189 ExecStartPre=/bin/chown mosquitto /run/mosquitto (code=exited, s
  Process: 1190 ExecStart=/usr/sbin/mosquitto -c /etc/mosquitto/mosquitto.conf (
 Main PID: 1190 (code=exited, status=3)

Dec 18 15:28:07 raspberrypi systemd[1]: mosquitto.service: Service RestartSec=10
Dec 18 15:28:07 raspberrypi systemd[1]: mosquitto.service: Scheduled restart job
Dec 18 15:28:07 raspberrypi systemd[1]: Stopped Mosquitto MQTT Broker.
Dec 18 15:28:07 raspberrypi systemd[1]: mosquitto.service: Start request repeate
Dec 18 15:28:07 raspberrypi systemd[1]: mosquitto.service: Failed with result 'e
Dec 18 15:28:07 raspberrypi systemd[1]: Failed to start Mosquitto MQTT Broker.

[1]+  Stopped                 sudo systemctl status mosquitto
pi@raspberrypi:~ $ sudo cat /var/log/mosquitto/mosquitto.log
cat: /var/log/mosquitto/mosquitto.log: No such file or directory
Domoticz latest stable, Intel NUC, Proxmox, Zigate, RFLink, Kaku switches, Ikea lights, Xiaomi sensors, Honeywell smoke detectors, Yeelight, Shelly, Slave Domoticz PI 3B+, Node-Red, Espeasy.
ferrosk
Posts: 44
Joined: Saturday 26 August 2017 20:13
Target OS: Linux
Domoticz version: 2023.2
Contact:

Re: MQTT: Failed to start, return code: 14/Connection refused (Check IP/Port)

Post by ferrosk »

do you have config file /etc/mosquitto/mosquitto.conf present?

What if you you start it manually with default config (without using above config file):

sudo -u mosquitto /usr/sbin/mosquitto
Domoticz 2023.2 on Odroid M1 and Armbian
MySensors (RFM69 Serial GW): bunch of DIY sensors/devices
Zwave (Z-Wave.me RaZberry board): Danfoss devices
Zigbee (Sonoff Dongle Plus): IKEA, Tesla devices
marktn
Posts: 232
Joined: Tuesday 21 April 2015 21:39
Target OS: Windows
Domoticz version:
Contact:

Re: MQTT: Failed to start, return code: 14/Connection refused (Check IP/Port)

Post by marktn »

ferrosk wrote: Sunday 18 December 2022 15:40 do you have config file /etc/mosquitto/mosquitto.conf present?

What if you you start it manually with default config (without using above config file):

sudo -u mosquitto /usr/sbin/mosquitto
The log is gone, nohting in there.
I can give you teamviewer access?

Code: Select all

pi@raspberrypi:/var/log/mosquitto $ sudo systemctl status mosquitto
● mosquitto.service - Mosquitto MQTT Broker
   Loaded: loaded (/lib/systemd/system/mosquitto.service; enabled; vendor preset: enabled)
   Active: failed (Result: exit-code) since Sun 2022-12-18 15:33:10 CET; 9min ago
     Docs: man:mosquitto.conf(5)
           man:mosquitto(8)
  Process: 834 ExecStartPre=/bin/mkdir -m 740 -p /var/log/mosquitto (code=exited, status=0/SUCCESS)
  Process: 835 ExecStartPre=/bin/chown mosquitto /var/log/mosquitto (code=exited, status=0/SUCCESS)
  Process: 836 ExecStartPre=/bin/mkdir -m 740 -p /run/mosquitto (code=exited, status=0/SUCCESS)
  Process: 837 ExecStartPre=/bin/chown mosquitto /run/mosquitto (code=exited, status=0/SUCCESS)
  Process: 838 ExecStart=/usr/sbin/mosquitto -c /etc/mosquitto/mosquitto.conf (code=exited, status=3)
 Main PID: 838 (code=exited, status=3)

Dec 18 15:33:10 raspberrypi systemd[1]: mosquitto.service: Service RestartSec=100ms expired, scheduling restart.
Dec 18 15:33:10 raspberrypi systemd[1]: mosquitto.service: Scheduled restart job, restart counter is at 5.
Dec 18 15:33:10 raspberrypi systemd[1]: Stopped Mosquitto MQTT Broker.
Dec 18 15:33:10 raspberrypi systemd[1]: mosquitto.service: Start request repeated too quickly.
Dec 18 15:33:10 raspberrypi systemd[1]: mosquitto.service: Failed with result 'exit-code'.
Dec 18 15:33:10 raspberrypi systemd[1]: Failed to start Mosquitto MQTT Broker.
Domoticz latest stable, Intel NUC, Proxmox, Zigate, RFLink, Kaku switches, Ikea lights, Xiaomi sensors, Honeywell smoke detectors, Yeelight, Shelly, Slave Domoticz PI 3B+, Node-Red, Espeasy.
ferrosk
Posts: 44
Joined: Saturday 26 August 2017 20:13
Target OS: Linux
Domoticz version: 2023.2
Contact:

Re: MQTT: Failed to start, return code: 14/Connection refused (Check IP/Port)

Post by ferrosk »

The log is gone, nohting in there.
I can give you teamviewer access?

ok you can send me ID/pass in Private Message
Domoticz 2023.2 on Odroid M1 and Armbian
MySensors (RFM69 Serial GW): bunch of DIY sensors/devices
Zwave (Z-Wave.me RaZberry board): Danfoss devices
Zigbee (Sonoff Dongle Plus): IKEA, Tesla devices
marktn
Posts: 232
Joined: Tuesday 21 April 2015 21:39
Target OS: Windows
Domoticz version:
Contact:

Re: MQTT: Failed to start, return code: 14/Connection refused (Check IP/Port)

Post by marktn »

ferrosk wrote: Sunday 18 December 2022 15:50 The log is gone, nohting in there.
I can give you teamviewer access?

ok you can send me ID/pass in Private Message
Send a private message, with the ID/Pass
Domoticz latest stable, Intel NUC, Proxmox, Zigate, RFLink, Kaku switches, Ikea lights, Xiaomi sensors, Honeywell smoke detectors, Yeelight, Shelly, Slave Domoticz PI 3B+, Node-Red, Espeasy.
ferrosk
Posts: 44
Joined: Saturday 26 August 2017 20:13
Target OS: Linux
Domoticz version: 2023.2
Contact:

Re: MQTT: Failed to start, return code: 14/Connection refused (Check IP/Port)

Post by ferrosk »

Just for reference. We fixed the problem via teamviewer.

When tried to start without using config file (default config):

Code: Select all

sudo -u mosquitto /usr/sbin/mosquitto
it started OK.

When tried to start with using config file:

Code: Select all

sudo -u mosquitto /usr/sbin/mosquitto -c /etc/mosquitto/mosquitto.conf
it failed with error:

Error: Unknown configuration variable "listner".

The reason was typo in variable in the config file - it was fixed and started OK.
Domoticz 2023.2 on Odroid M1 and Armbian
MySensors (RFM69 Serial GW): bunch of DIY sensors/devices
Zwave (Z-Wave.me RaZberry board): Danfoss devices
Zigbee (Sonoff Dongle Plus): IKEA, Tesla devices
Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest