Aside from the init script updates to create the PID the directory, I’ll posit 
that

the config files also needs to have the pid_file directive removed or commented 
out.

/etc/mosquitto/mosquitto.conf

# pid_file /run/mosquitto/mosquitto.pid

The reason is that the start-stop-daemon used to start the daemon runs as root 
and creates

it’s own PID file based on the init code. When the mosquitto daemon starts, it 
does a setuid to

mosquitto, and if the pid_file directive is enabled with the same pid filename 
as the init script,

the mosquitto daemon will fail over-writing the existing pid file owned by root.

crichmon@testing:~$ ls -la /run/mosquitto/

total 4

drwxr-xr-x 2 root root 60 Apr 5 14:06 .

drwxr-xr-x 18 root root 680 Apr 6 06:40 ..

-rw-r--r-- 1 root root 5 Apr 5 14:06 mosquitto.pid

Thx, Chris

Reply via email to