After some fiddling it seams like mosquitto isn’t autostarting anymore?!
Running “sudo service mosquitto start” and then restarting HA resolves the issue, but it comes back after a reboot. Where can I see why it’s not autostarting?
I frequently have this issue because HA is not waiting for Mosquitto to fully start up and accept incoming connections. I am running Ubuntu with systemd, and while you can specify dependencies between services, this only ensures that HA is started after Mosquitto is started. The startup of each service is happening in parallel, and while Mosquitto still needs 5-10 seconds until it accepts connections, HA continues to start up trying (and failing) to connect.
Ideally, HA would just continue trying to connect to the MQTT broker for a certain amount of time. Or, maybe there is a way to let systemd only start HA if Mosquitto is accepting connections.
I had a similar symptom after running “sudo apt-get update && sudo apt-get upgrade” this morning, which upgraded Mosquitto to v1.4.12. In my case it turned out that the Mosquitto service got disabled during the update.
You may want to reboot your Pi before doing this just to make sure the results are not affected by any previous attempts to manually start the service, but then issue the following command:
sudo service mosquitto status
The “Loaded” line in the output of that command should end in either “; enabled” or “;disabled”. In my case it showed as disabled, so I ran the following:
After the reboot I ran the status command again just to double-check that everything was as expected, and Mosquitto was already running and showed as enabled now. All my MQTT devices were working with Home Assistant again.