MQTT Error Address in use

I’m having some issues with the Mosquitto broker addon in HassIO. Everything was working fine until I did the update to 0.78.0 from 0.77.3. Ever since then I cannot get the MQTT addon to start.

I keep getting

1537258041: mosquitto version 1.4.15 (build date 2018-03-04 15:36:00+0000) starting
1537258041: Config loaded from /etc/mosquitto.conf.
1537258041: Opening ipv4 listen socket on port 1883.
1537258041: Opening ipv6 listen socket on port 1883.
1537258041: Opening ipv4 listen socket on port 1883.
1537258041: Error: Address in use

There is obviously something using port 1883 but I can’t see what. Being on HassOS and not great with linux/debian anyway, I’m not sure what command to use to actually see all the bound ports.
I tried lsof -i TCP:1883 and got

1       /dev/init       pipe:[56738]
1       /dev/init       pipe:[56739]
1       /dev/init       pipe:[56740]
8       /usr/sbin/sshd  /dev/null
8       /usr/sbin/sshd  pipe:[56739]
8       /usr/sbin/sshd  pipe:[56740]
8       /usr/sbin/sshd  socket:[56828]
8       /usr/sbin/sshd  socket:[56829]
22      /usr/sbin/sshd  /dev/null
22      /usr/sbin/sshd  /dev/null
22      /usr/sbin/sshd  pipe:[56740]
22      /usr/sbin/sshd  socket:[57637]
22      /usr/sbin/sshd  pipe:[56877]
22      /usr/sbin/sshd  pipe:[56877]
22      /usr/sbin/sshd  /dev/pts/ptmx
22      /usr/sbin/sshd  /dev/pts/ptmx
22      /usr/sbin/sshd  /dev/pts/ptmx
24      /bin/bash       /dev/pts/0
24      /bin/bash       /dev/pts/0
24      /bin/bash       /dev/pts/0
24      /bin/bash       /dev/pts/0

After that I tried to use a snapshot from when everything was working, that didn’t work, next I tried a clean install of 0.78.0, still no dice, then I went back to 0.77.3 clean install and nothing changed. Other than DuckDNS there are no other addons. I have tried restarting Hass several times and even unplugged it for a few hours.

Here is my config, being a clean install there isn’t anything in the include files.

homeassistant:
  # Name of the location where Home Assistant is running
  name: Home
  # Location required to calculate the time the sun rises and sets
  latitude: 0
  longitude: 0
  # Impacts weather/sunrise data (altitude above sea level in meters)
  elevation: 0
  # metric for Metric, imperial for Imperial
  unit_system: metric
  # Pick yours from here: http://en.wikipedia.org/wiki/List_of_tz_database_time_zones
  time_zone: UTC
  # Customization file
  customize: !include customize.yaml

# Show links to resources in log and frontend
#introduction:

# Enables the frontend
frontend:

# Enables configuration UI
config:

# Uncomment this if you are using SSL/TLS, running in Docker container, etc.
# http:
#   base_url: example.duckdns.org:8123

# Checks for available updates
# Note: This component will send some information about your system to
# the developers to assist with development of Home Assistant.
# For more information, please see:
# https://home-assistant.io/blog/2016/10/25/explaining-the-updater/
updater:
  # Optional, allows Home Assistant developers to focus on popular components.
  # include_used_components: true

# Discover some devices automatically
discovery:

mqtt:
  broker: core-mosquitto
  username: XXXXXXXXX
  password: XXXXXXXXX

# Allows you to issue voice commands from the frontend in enabled browsers
conversation:

# Enables support for tracking state changes over time
history:

# View all events in a logbook
logbook:

# Enables a map showing the location of tracked devices
map:

# Track the sun
sun:

# Weather prediction
sensor:
  - platform: yr

# Text to speech
tts:
  - platform: google

# Cloud
cloud:

group: !include groups.yaml
automation: !include automations.yaml
script: !include scripts.yaml

After spending a day on this, and searching all over the forum and google I cannot figure this out. Any help would be greatly appreciated. Is the addon worth it over the built-in MQTT broker?

Thank you.

you really should redact your passwords or better still save them in your secrets/yaml (MQTT details posted)
for your mqtt broker as far as I know you need to provide an IP address, here you’ve provided something else (core-mosquitto)
Can you try and replace core-mosquitto with the IP address of your mosquitto broker? With the error message that you have it’s probably the same IP as the machine that runs HA…

Thank you for the advice. That is only a temp password as I was trying to get it running.

The core-mosquito came from the documentation of the addon.

I did also try the IP address and still no go, it’s the same error everytime.

So in case someone stumbled across this in the future… This seems to be “solved”.

I have no clear reason why it broke after several weeks of working flawlessly, or what exactly fixed it. On my 3rd attempt to reimage the SD card with Hassio 0.78.1, with my 3rd new download of the image from the Home Assistant website it seems to have straightened itself out.

Thank you

TLDR; set “plain” to false if you are using SSL and an “insecure.conf” file

I just ran into this too (HA version 0.79.3)

I have configured mosquitto according to the config page:

I also added a file insecure.conf since I wanted to run SSL and non-SSL at the same time as specified in the above documentation.

Doing that I got the error message “Error: Address in use”. When I turned off the “customize” flag it was working fine.
So the crux of the issue was that port 1883 is specified in the insecure.conf file but I also had the “plain” flag set to true (to run on port 1883).
It seems “plain” and “ssl” are mutually exclusive, only one should be true. And if you want to run both you have to add port 1883 in the insecure.conf file but only have ssl enabled in the mqtt config file.
After I set “plain” to false it worked, listening on ports 1883 and 8883
That was not explicitly pointed out in the documentation, so I hope this helps someone running across this.