Hi I have been happily running mosquitto as a service for a couple of years on my Windows 11 computer. The version I was running was 2.0.18.
I recently upgraded, using this exe downloaded from mosquitto.org:
mosquitto-2.0.22-install-windows-x64.exe
I didn’t think to back up my folder in Program Files before I upgraded and was aghast that the install overlaid my mosquitto.conf file with a new one. The broker would start, after upgrade, and my subscriber (node-red) could subscribe, but my publisher (a mosquitto publisher running on a different device on the local network) couldn’t. I managed to dig out an old copy of my .conf file, and did a byte by byte compare. Other than carriage return format differences, it turns out the “new” .conf file is identical in every way except the entries I added. (simple things like a password file, and some logging, and denying anonymous connections, and which port to be listening on). Settings I gleaned from some tutorial a couple of years ago. So I first copied my settings into the new mosquitto.conf file. Later I tried overlaying the installed mosquitto.conf file with a copy of my old one.
I did the install as a service.
I can start mosquitto with a cmd entry like this (with or without -v) (and after making sure the service is stopped):
C:\Program Files\mosquitto>mosquitto -c mosquitto.conf -v
Everything starts up fine when I start interactively with command line–nothing that looks like an error is reported (see log below). But it won’t start as a service. It says “Windows is starting … service” and then immediately “… service stopped.” Here is a short log of the terminal window at successful startup.
C:\Program Files\mosquitto>mosquitto -c mosquitto.conf -v
2026-01-18T13:26:52: mosquitto version 2.0.22 starting
2026-01-18T13:26:52: Config loaded from mosquitto.conf.
2026-01-18T13:26:52: Opening ipv6 listen socket on port 1883.
2026-01-18T13:26:52: Opening ipv4 listen socket on port 1883.
2026-01-18T13:26:52: mosquitto version 2.0.22 running
2026-01-18T13:26:55: New connection from 192.168.6.100:49957 on port 1883.
2026-01-18T13:26:55: New client connected from 192.168.6.100:49957 as sbms (p2, c1, k60, u'electrodacus').
2026-01-18T13:26:55: No will message specified.
2026-01-18T13:26:55: Sending CONNACK to sbms (0, 0)
2026-01-18T13:26:55: Received PUBLISH from sbms (d0, q0, r0, m0, '/solar/battery/sbms', ... (464 bytes))
2026-01-18T13:26:56: Received PUBLISH from sbms (d0, q0, r0, m0, '/solar/battery/sbms', ... (465 bytes))
2026-01-18T13:26:56: Received PUBLISH from sbms (d0, q0, r0, m0, '/solar/battery/sbms', ... (462 bytes))
2026-01-18T13:26:57: New connection from 127.0.0.1:62325 on port 1883.
2026-01-18T13:26:57: New client connected from 127.0.0.1:62325 as nodered (p2, c1, k60, u'nodered').
2026-01-18T13:26:57: No will message specified.
2026-01-18T13:26:57: Sending CONNACK to nodered (0, 0)
2026-01-18T13:26:57: Received SUBSCRIBE from nodered
2026-01-18T13:26:57: /solar/battery/sbms (QoS 2)
2026-01-18T13:26:57: nodered 2 /solar/battery/sbms
2026-01-18T13:26:57: Sending SUBACK to nodered
2026-01-18T13:26:57: Received PUBLISH from sbms (d0, q0, r0, m0, '/solar/battery/sbms', ... (463 bytes))
2026-01-18T13:26:57: Sending PUBLISH to nodered (d0, q0, r0, m0, '/solar/battery/sbms', ... (463 bytes))
2026-01-18T13:26:58: Received PUBLISH from sbms (d0, q0, r0, m0, '/solar/battery/sbms', ... (462 bytes))
2026-01-18T13:26:58: Sending PUBLISH to nodered (d0, q0, r0, m0, '/solar/battery/sbms', ... (462 bytes))
2026-01-18T13:27:00: Received PUBLISH from sbms (d0, q0, r0, m0, '/solar/battery/sbms', ... (462 bytes))
2026-01-18T13:27:00: Sending PUBLISH to nodered (d0, q0, r0, m0, '/solar/battery/sbms', ... (462 bytes))
2026-01-18T13:27:03: mosquitto version 2.0.22 terminating
It terminated because I ctrl-C’d it.
I’m obviously getting connected and it’s working fine from the cmd line. But as a service, it keeps stopping immediately. I don’t see any logging going on at all, where it was previously logging. I have done a bunch of googling, but haven’t found any answers yet. Anyone familiar with this issue on Windows? How do I get the service to tell me why it is stopping. Here are my active conf file entries (everything else is commented out).
listener 1883
log_dest stderr
log_type error
log_type warning
log_type notice
log_type information
connection_messages true
log_timestamp true
log_timestamp_format %Y-%m-%dT%H:%M:%S
allow_anonymous false
password_file passwdfile.pwd
The password file is there and properly encrypted. The previous incarnation was logging to C:\Program Files\mosquitto\Log\mosquitto.log (this must be a default location, as I don’t see that location specified anywhere). I renamed the old file and did not create a new one.
Here is the last entry in the old file, from before I upgraded.
2026-01-16T16:42:36: mosquitto version 2.0.18 starting
2026-01-16T16:42:36: Config loaded from C:\Program Files\mosquitto/mosquitto.conf.
2026-01-16T16:42:36: Opening ipv6 listen socket on port 1883.
2026-01-16T16:42:36: Opening ipv4 listen socket on port 1883.
2026-01-16T16:42:36: mosquitto version 2.0.18 running
2026-01-16T16:42:39: New connection from 192.168.6.100:60165 on port 1883.
2026-01-16T16:42:39: New client connected from 192.168.6.100:60165 as sbms (p2, c1, k60, u'electrodacus').
2026-01-16T16:43:26: New connection from 127.0.0.1:49724 on port 1883.
2026-01-16T16:43:26: New client connected from 127.0.0.1:49724 as nodered (p2, c1, k60, u'nodered').
2026-01-17T12:41:11: Client nodered disconnected.
2026-01-17T13:07:56: mosquitto version 2.0.18 terminating
I tried in the conf file to turn logging off, to see if that is the problem, by changing
log_dest none
But that didn’t change the startup issue.
Attached is the Mosquitto Broker Service configuration window.
Anyone familiar with this issue and know the solution? It’s probably simple, but I’m out of ideas.
