Debian package failure

All,

I have searched quite a few places, even the official Mosquitto GitHub and I do not see the scripts/files for building Debian packages. Someone tried to fix the install error with a hack to mosquitto.service and it doesn’t work.

Setting up mosquitto (2.0.11-1) ... Starting network daemon:: mosquittostart-stop-daemon: unable to open pidfile '/run/mosquitto/mosquitto.pid' for writing (No such file or directory) start-stop-daemon: child returned error exit status 2  failed! invoke-rc.d: initscript mosquitto, action "start" failed. dpkg: error processing package mosquitto (--configure):  installed mosquitto package post-installation script subprocess returned error exit status 1 Processing triggers for man-db (2.9.4-2) ... Processing triggers for libc-bin (2.31-13+deb11u5) ... Errors were encountered while processing:  mosquitto E: Sub-process /usr/bin/dpkg returned an error code (1)

The hack they put in can be seen in the .service file.

root@mxdevvm:/# cat /lib/systemd/system/mosquitto.service
[Unit]
Description=Mosquitto MQTT Broker
Documentation=man:mosquitto.conf(5) man:mosquitto(8)
After=network.target
Wants=network.target

[Service]
Type=notify
NotifyAccess=main
ExecStart=/usr/sbin/mosquitto -c /etc/mosquitto/mosquitto.conf
ExecReload=/bin/kill -HUP $MAINPID
Restart=on-failure
ExecStartPre=/bin/mkdir -m 740 -p /var/log/mosquitto
ExecStartPre=/bin/chown mosquitto /var/log/mosquitto
ExecStartPre=/bin/mkdir -m 740 -p /run/mosquitto
ExecStartPre=/bin/chown mosquitto /run/mosquitto

[Install]
WantedBy=multi-user.target

Systemd obviously cannot create directories under /run, but this hack does successfully create /var/log/mosquitto.

In either the preinst or postinst (before starting service) during the configure step the package needs

mkdir -p /run/mosquitto

In the postrm it needs

rm -rf /run/mosquitto
rm -rf /var/log/mosquitto

The current command line “fix” for this has been to tell users to

sudo mkdir -p /run/mosquitto

before installing the package.

I can’t find the repo containing the Debian packaging scripts for Mosquitto, otherwise I would just fix this and submit a pull request. There are bug reports back past 2023 on this in various Debian based distros. If someone can point me to the repo that actually has the Debian packaging scripts I will fork it and submit a pull once I’ve built and tested locally.

If the maintainer wants to take this as their own and make the fix, I’m fine with that as well. I don’t need credit, just would like it fixed.

Hi,

I presume you’re talking about the official Debian packages here, as provided by Debian themselves. That’s not something that the Mosquitto project actually deals with. You can however find the package details at:

and the repository that the Debian team uses at

The Debian team took over responsibility for the mosquitto package well after the 2.0.11 release, but they are good at dealing with things so I’m sure they’d be responsive to your feedback.

Regards,

Roger