Mosquitto: The Mosquitto Broker Service on local computer started and then stopped ,Some services stop automatically if there are not in use by other services or programs

Created on 6 May 2017  路  16Comments  路  Source: eclipse/mosquitto

hi all.
I have installed mosquitto in my PC (windows 10) and it was working well.
then i changed mosquitto.conf file to activate username/password authentication. then I wanted to restart the mosquitto service on the PC. but it gives me the following error:

"The Mosquitto Broker Service on local computer started and then stopped ,Some services stop automatically if there are not in use by other services or programs"

Now, my mosquitto can not be started again and I have to re-install it whenever I receive this error message.
please help me...

need-more-information

Most helpful comment

Folks encountering this issue:

The problem is with the path to the file(s) set in the config file when running as a service. Apparently mosquitto is pretty picky about parsing the path. I tried a number of quoting and escaping formats to get around the spaces in "Program Files" but in the end I had to move my password file (assume the same would be true with a log file) to the root.

Hope this helps and if anyone does find an acceptable way to reference files in the default install directory, please reply back.

Thanks for the tip of what to look for. I managed to reference the password file as follows:
"password_file C:Progra~1mosquittopasswd"
No quotes in the configuration file. Hope that helps someone out.

All 16 comments

The only thing I can think is that there is a problem in your config file that is causing the broker to stop. What if you try to start the broker manually from the command line using the same config file?

that's same problem for me...!!!

Friend's Give the Solution.....

I had this problem. It was because it couldn't open the log file.
Delete your log file and restart or just remove the log file from your config file so it's not logging.

Do you still had this issue ? Had you tried removing the log file as @ericGTT suggested ?

  1. I'm facing a similar issue ... removing the log file and then restarting, didn't work for me.
  2. My guess is; it's related to the services.
    3a. I can't start the service.
    3b. Thought of increasing the log size from event viewer ... but how? if there isn't a file.

    1. What is surprising is.... a month back the exact same settings(No Changes) were working perfectly.

  3. Have attached a few screen shots for reference.

mosquitto_broker_service_not_starting

mosquitto_sub_sctively_refused

why mosquitto server is Automatically stop??
Active: active (exited) since Tue 2018-04-03 04:59:29 UTC; 7h ago
Thanks!!...

I have the same issue. When I just run mosquitto.exe from the command prompt it works OK. When I start the service same issue as described above. I checked my settings file, and nothing is enabled for logging. I could not see any log files created, so there was nothing to delete. For me creating the Windows service (mosquitto.exe install) only worked when I ran Command Prompt as administrator.

Folks encountering this issue:

The problem is with the path to the file(s) set in the config file when running as a service. Apparently mosquitto is pretty picky about parsing the path. I tried a number of quoting and escaping formats to get around the spaces in "Program Files" but in the end I had to move my password file (assume the same would be true with a log file) to the root.

Hope this helps and if anyone does find an acceptable way to reference files in the default install directory, please reply back.

  1. I'm facing a similar issue ... removing the log file and then restarting, didn't work for me.
  2. My guess is; it's related to the services.
    3a. I can't start the service.
    3b. Thought of increasing the log size from event viewer ... but how? if there isn't a file.
  3. What is surprising is.... a month back the exact same settings(No Changes) were working perfectly.
  4. Have attached a few screen shots for reference.

mosquitto_broker_service_not_starting

mosquitto_sub_sctively_refused

Same problem with me. I restarted PC, then it solved

Folks encountering this issue:

The problem is with the path to the file(s) set in the config file when running as a service. Apparently mosquitto is pretty picky about parsing the path. I tried a number of quoting and escaping formats to get around the spaces in "Program Files" but in the end I had to move my password file (assume the same would be true with a log file) to the root.

Hope this helps and if anyone does find an acceptable way to reference files in the default install directory, please reply back.

Thanks for the tip of what to look for. I managed to reference the password file as follows:
"password_file C:Progra~1mosquittopasswd"
No quotes in the configuration file. Hope that helps someone out.

I had this problem. It was because it couldn't open the log file.
Delete your log file and restart or just remove the log file from your config file so it's not logging.

where is this log file located?

Look in the config file and see where it's saved to.

Using full paths, limiting folder name character count worked for me:

log_dest file C:\Progra~1\mosquitto\mosquitto.log
password_file C:\Progra~1\mosquitto\user_security

Log file was also an issue, even when trying to open it afterwards. Reason being that the service account in which the broker is running is the owner of the log file, thus preventing even an Admin account from opening it.

Glad I found this thread. For anyone else, having the full path on any files referenced in the mosquitto.conf worked for me, even if the files were in the same directory.

Now does anyone have a fix for the log issue? I can not find a way to open this log file. What good is a log file if you can't view it?

You have to provide the appropriate permissions to the logon for the service.

If the service is running under the local system account, then add LOCAL SERVICE to the permissions for the installation folder.

Alternatively, change the service logon to another account and make sure permissions are set accordingly for the folder.

image

For me, the reason is, had extra double quotes in password file define.
Wrong: password_file "C:Program Filesmosquittopasswd.txt"
Right: password_file C:Program Filesmosquittopasswd.txt

Was this page helpful?
0 / 5 - 0 ratings

Related issues

smarty70 picture smarty70  路  3Comments

korish picture korish  路  7Comments

bootrino picture bootrino  路  7Comments

Foxhunt picture Foxhunt  路  6Comments

OkenKhuman picture OkenKhuman  路  3Comments