Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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 #439

Open
AndroidDesigner opened this issue May 6, 2017 · 21 comments
Labels
Status: Blocked Another issue needs to be resolved first

Comments

@AndroidDesigner
Copy link

AndroidDesigner commented May 6, 2017

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...

@ralight
Copy link
Contributor

ralight commented May 19, 2017

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?

@vishuPPatel
Copy link

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

Friend's Give the Solution.....

@ericGTT
Copy link
Contributor

ericGTT commented Oct 4, 2017

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.

@PierreF
Copy link
Contributor

PierreF commented Jan 5, 2018

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

@PierreF PierreF added the Status: Blocked Another issue needs to be resolved first label Jan 5, 2018
@safalya84
Copy link

safalya84 commented Jan 19, 2018

  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

@vishuPPatel
Copy link

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

@nygma2004
Copy link

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.

@EricQ47
Copy link

EricQ47 commented Sep 23, 2018

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.

@themalakarraja
Copy link

  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

@scoutdriver73
Copy link

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~1\mosquitto\passwd"
No quotes in the configuration file. Hope that helps someone out.

@Shivaratn
Copy link

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?

@ericGTT
Copy link
Contributor

ericGTT commented Oct 18, 2019

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

@engixx
Copy link

engixx commented Nov 13, 2019

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.

@bagadonitz
Copy link

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?

@EddieGreen
Copy link

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

@ErixWong
Copy link

ErixWong commented Jun 3, 2020

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

@kiwibirdegg
Copy link

kiwibirdegg commented Oct 12, 2021

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

This solution worked for me. As someone who works with PowerShell, I am used to double quoting Program Files to avoid the issue caused by having space in between Program and Files. In my config file, I changed my path from
C:\ "Program Files"\mosquitto\passwd.txt to C:\Program Files\mosquitto\passwd.txt

Worked for me. Thanks @ErixWong !

@xiaoyuvax
Copy link

Worked for me! thanks!
Next ver of Mosquitto should be improved to adopt MOSQUITTO_DIR env var to solve this problem.

@cholme690
Copy link

My problem was it couldn't open the password file no matter where i put it. Not even when it was in root. I fixed the problem by giving System full control of the file rather than just my user.

@briantho
Copy link

My problem was it couldn't open the password file no matter where i put it. Not even when it was in root. I fixed the problem by giving System full control of the file rather than just my user.

Thanks. I was facing the exact same problem. No matter where i put the passwd file, i couldn't get the service running. It of course worked when I ran via CLI, but the service just would not run. changed permissions to allow "SYSTEM" full control, and bam, now it's running. Thanks

@umitliguler
Copy link

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

it work for password file not only mosquitto folder :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Status: Blocked Another issue needs to be resolved first
Projects
None yet
Development

No branches or pull requests