Yes, I’m just wondering what starts it. I cannot see a second service at least. Or some internal issue makes it spawn multiple instances?
Currently difficult to have a closer look here, as my phone cannot open .deb files.
If you stop the service, is there still a Mosquitto instance running? systemctl stop mosquitto
In case you could mask it: systemctl mask mosquitto
If no other instance is up then, we know that it internally somehow spawns multiple instances.
we can try as well an older version of mosquitto. It’s not that difficult to remove 2.0.9 and install 2.0.8 or 2.0.7
Do you know the version used before?
I did a test installation on RPi 32bit as well as 64bit. Both are working fine. Strange. Could it be some config files invoke which will create a 2nd instance?
32bit
root@DietPi3:~# journalctl -u mosquitto
-- Logs begin at Sat 2021-03-20 22:41:40 CET, end at Sat 2021-03-20 22:42:45 CET. --
Mar 20 22:41:58 DietPi3 systemd[1]: Starting Mosquitto MQTT Broker...
Mar 20 22:41:58 DietPi3 systemd[1]: Started Mosquitto MQTT Broker.
root@DietPi3:~# cat /var/log/mosquitto/mosquitto.log
1616276518: mosquitto version 2.0.9 starting
1616276518: Config loaded from /etc/mosquitto/mosquitto.conf.
1616276518: Starting in local only mode. Connections will only be possible from clients running on this machine.
1616276518: Create a configuration file which defines a listener to allow remote access.
1616276518: Opening ipv4 listen socket on port 1883.
1616276518: Opening ipv6 listen socket on port 1883.
1616276518: Error: Cannot assign requested address
1616276518: mosquitto version 2.0.9 running
root@DietPi3:~#
64bit
root@DietPi4:~# journalctl -u mosquitto
-- Logs begin at Thu 2019-02-14 11:11:58 CET, end at Sat 2021-03-20 22:36:27 CET. --
Mar 20 22:35:40 DietPi4 systemd[1]: Starting Mosquitto MQTT v3.1/v3.1.1 Broker...
Mar 20 22:35:40 DietPi4 systemd[1]: Started Mosquitto MQTT v3.1/v3.1.1 Broker.
root@DietPi4:~# cat /var/log/mosquitto/mosquitto.log
1616276140: mosquitto version 1.5.7 starting
root@DietPi4:~#
Fun fact, 32bit will install 2.0.9 while 64bit is still 1.5.7
After systemctl stop mosquitto and checking mosquitto
I’m now not getting an error but still only in local mode.
root@DietPi:~# mosquitto
1616324408: mosquitto version 2.0.9 starting
1616324408: Using default config.
1616324408: Starting in local only mode. Connections will only be possible from clients running on this machine.
1616324408: Create a configuration file which defines a listener to allow remote access.
1616324408: Opening ipv4 listen socket on port 1883.
1616324408: Opening ipv6 listen socket on port 1883.
1616324408: mosquitto version 2.0.9 running
1616324409: New connection from 127.0.0.1:53278 on port 1883.
1616324409: New client connected from 127.0.0.1:53278 as mqtt_154a2846.3b1378 (p1, c1, k60).
1616324415: New connection from 127.0.0.1:53280 on port 1883.
1616324415: New client connected from 127.0.0.1:53280 as mqtt_7623cef0.cf7 (p1, c1, k60).
Yes I saw that, but for now it does seem to be another instance running somewhere as I did a reboot checked mosquitto and I’m back to square one with the error.
Again systemctl stop mosquitto and there’s no error.
question. How do you check mosquitto. do you simply type the command into the console? Because this will not check mosquitto. This command will start a 2nd instance of mosquitto, which of course is conflicting with the systemd service
Better to check mosquitto as follow after system was rebooted.
systemctl status mosquitto.service
cat /var/log/mosquitto/mosquitto.log
ss -tulpn | grep mosquitto
Well DietPi doesn’t do anything on that update. It is an apt package directly installed from mosquitto repository using apt package manager. Probably this is behavior of mosquitto v2 as security requirements changed. But better to check with mosquitto directly
That’s a tmpfs (RAMdisk), any files there are to live only for the lifetime the service runs. When the default configuration uses /run/mosquitto.pid that’s fine as no directory needs to be created. But the daemon does not have permissions to create a file there, which is probably the reason for the issue. Is the PID file really created by default there or did you add/set that setting manually? It would be basically a bug with their systemd unit as unprivileged users are never intended to create files there, so the systemd unit must handle this with root privileges. The PID file is actually not required with systemd, so the cleanest solution wound be to unset that setting.