-
Notifications
You must be signed in to change notification settings - Fork 2.3k
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
Unable to create PID file #1950
Comments
I am experiencing the same issue. Removing the pid_file line from mosquitto.conf allows it to start but it will not accept connections from anything but localhost. executing
And restarting mosquitto works and allows the broker to create the pid file, however the broker will still not accept connections from outside localhost., This was a working broker set up prior to upgrading to 2.0.2 |
Solving my own problem, the update to 2.0.2 has new config requirements. I added a file custom.conf to /etc/mosquitto/conf.d with only:
This seems to emulate the older 1.x style of operation. I'll figure out the newer security options later. |
https://mosquitto.org/documentation/migrating-to-2-0/ I also comment it the pid file line and create a listener.conf in conf.d. Now is working like before. Only one question. It cause any problem that i not use the pid file? |
I corrected this by
Then run: And then restarted service: Should start fine, confirm with: Ubuntu 18.04.5 LTS, 20 may be slightly different, looks like the conf is different path anyway |
I've managed to get it working too. In mosquitto.conf I set Now it's working. Does that work for everybody else? |
I had the exact same problem, and this fixes it perfectly! |
If you're using the Ubuntu PPA packages then this should now be fixed automatically. It's been a bit tricky getting the websockets library updated for 16.04 and 18.04, but they should all be ok again. |
I do this, seems to be fixed. It possible to fix it here? https://github.com/eclipse/mosquitto/tree/master/service/systemd |
It is still not working for me on Ubuntu 18.04. |
Same here. Took the latest package, rebooted and the package update removed my mosquitto.service changes from #1950 (comment), as a result it wasnt able to write the pid file again (folder didnt exist after the reboot) and didnt start. The package install prompted for conf change ok, but chose to retain my existing conf and not take the package/dist version. Nothing prompted regarding mosquitto.service it was overwritten. I'll raise a PR to update the systemd scripts with my changes mentioned in the comment. |
@peteakalad Using Ubuntu 20.04 (server) followed you instructions, worked like a charm even after reboot. |
apt upgraded to Ubuntu 18.04.5 mosquitto package v2.0.3 this morning. Mosquitto systemd script still has the ExecStartPre lines to create the mosquitto /var/run folder and set permissions. Rebooted and still all good, mosquitto started fine. Looks like this issue is now resolved, thanks for updating package @ralight |
I also had an issue updating on ubuntu, but just a simple apt update on 16.04, no distro version change. /var/run/mosquitto was created and permission set correctly, but my conf file had "pid_file /var/run/mosquitto.pid", which there not permission to write to. I don't recall why my pid file was set this way as it's been there a couple years, but changing this fixed the issue. posting here in case it helps others with another possible cause of the error. |
I fixed this in later versions and as there have been no more reports, I assume that fix worked fine and I can close this issue. Thanks for the comments everyone. |
same here with eclipse-mosquitto:latest tonight. |
you probably have a pid-file set in your mosquitto config, but if you enter your container and look for it, it's probably not set anyway. At least that's what I saw in my 1.6-container. I just |
yeah commenting the the config line did it (not uncommenting :p) |
Other things that may affect you now you are 2.0: https://mosquitto.org/documentation/migrating-to-2-0/ |
But should we comment the pid in the configuration file, is there a clean workaround, or is a bug and this need to be fixed? |
@lordraiden Unless you are making use of the pid file for a specific reason there is need for it, so you are free to comment it out. |
I changed the configuration to:
I'm running two mosquitto's on the same docker host. |
Hi
but when I try to restart the process I got an error this is what reports sytemctl status
this is what reports journalctl -u mosquitto /var/run/mosquitto
If I try to start manually mosqutitto logged as ubuntu default user
Notice that My /lib/systemd/system/mosquitto.service file contains following lines
I try then to remove the package, to delete the PID file and LOG file, to re-install all from scratch but with no result any hepl to exit this situation (also with simple roll back) is appreciated !! br |
I some way I succeed to fix the PID file issue... now mosquitto starts but I'm struggling with web socket and SSL that does not work any more |
#pid_file /var/run/mosquitto.pid Also works |
Now, it doesnt require pid file |
Hey, I'm having the issue too - however when I tried to edit the /lib/systemd/system/mosquitto.service - it says it cannot find that service. When I run Do you have any suggestions? |
Look in /etc/systemd/system/multi-user.target.wants |
I have the general issue as well (unable to write pid-file), I had created the pidfile manually, but after software update and reboot everything is back to failure. The suggested additions to mosquitto.service won't work, as mosquitto has no rights to write to /var/run. Changing ownership underneath /var/run is surely not the proper approach. So the solution is, to either chose a writable directory (i.e. /tmp ) for the pidfile or set up the pidfile manually. (a cron job for root will serve as well) All of these are kludges and the issue should be fixed by the developers. Especially since the documentation isn't very clear on this and error messages are rather cryptic (mosquitto.service: Start request repeated too quickly.) btw. I am on Arch Linux and mosquitto 2.0.10-1 |
Like everyone, I have also had this issue since I updated to 2.0.11 of Mosquitto earlier this week. I have completely uninstalled mosquitto (but not sure is something remains from v1.6) and reinstalled V2.0.11. In summary Moz will not start on powerup (I have latest Raspbian on a Pi3B+) which cause also sorts of issues with Nod_red and clients. So I need to fix it. What I have found is that I then put changed the /etc/mosquitto/mosquitto.conf file as follows Well that still didn't work on restart, but to restart I just needed But If I tried to kill this restarted process, it restarted it self ! It would not before as the attempt to start on powerup left a deformed process running that needed to be killed. Also so maybe we can fix it to delay moz daemon not starting for a few seconds after reboot! |
Just a but more, to add, it appears that the process on restart is being stopped as port 1883 is in use! and a sytemctl Restart fails (Exits with error code. |
SOLVED. How did I find it. Well once I found CRON has a @reboot option I llooked further and found CRON is by user including root. So I winged it and tried After that it was a tidy up of all the other things I had tweaked and re-enable the systemd job on reboot. so now have 2.0.11 working as I like. I suspect that CRON job was a left over from earlier versions of Mosquitto (I was on 1.5 or 1.6) but the update to 2.0.11 didn't delete it when it created the mosquitto.service job. |
As a current workaround we can use solution proposed here: https://serverfault.com/questions/482319/how-can-systemd-run-a-command-as-root-before-launching-a-service-as-a-different I changed startup script (sudo systemctl edit --full mosquitto) to:
Now daemon starts without errors. |
Since upgrading to Mosquitto 2.0.2 I get the following error upon starting Mosquitto:
My conf file is as follows:
Is this a bug or a misconfiguration on my side?
The system is:
Ubuntu 20.04
The text was updated successfully, but these errors were encountered: