Skip to content

Troubleshooting

Common problems with the Mosquitto broker, what causes them and how to fix them.

Not authorized. when publishing

Cause: the topic ACL does not let this user write to the topic. For example, denied may use only sushi/denied/#, and subscriber may only read.

Fix: use a topic the user is allowed, or change the ACL, see Users and topic ACL.

A subscriber receives nothing

Cause: the ACL does not let this user read the topic, or the message was published before the subscriber connected and was not retained.

Fix: check the user's topic read or topic readwrite lines in /var/lib/mosquitto/acl.

The connection is refused

Cause: wrong user name or password, or a client without credentials. Anonymous access is off.

Fix: use the right password. After changing passwords with mosquitto_passwd, reload Mosquitto.

TLS errors from a client

Cause: the client is not using TLS, does not trust the instance's CA, or connects by an address the certificate does not cover. The certificate created on first boot covers only localhost and 127.0.0.1.

Fix: use mqtts:// on port 8883 with /usr/local/share/sushi/mosquitto/ca.pem. For a private address, issue a certificate that includes it, see Issue a server certificate for a private address.

The helper refuses an argument

Cause: /opt/sushi/bin/mosquitto-as.sh accepts only a short list of options, topics under sushi/, and the three example users. It refuses options that could put a password on the command line.

Fix: use mosquitto_pub and mosquitto_sub directly for anything else.

Mosquitto does not start after an edit

Cause: an error in mosquitto.conf, or a file whose ownership changed so the broker can no longer read it.

Fix: read the log, then check the ownership described in Where things live:

sudo journalctl -u mosquitto -n 50 --no-pager

First boot fails after a restore

Cause: the first-boot check refuses some layouts rather than guess: a database directly in /var/lib/mosquitto/ instead of data/, a persistence location outside /var/lib/mosquitto/data/, duplicate persistence settings, include_dir, or symbolic links in the managed paths.

Fix: restore into the expected layout. Set persistence_location /var/lib/mosquitto/data/ in the configuration, use full-line # comments only, and remove the duplicates. Then retry:

sudo journalctl -u sushi-mosquitto-firstboot --no-pager
sudo systemctl restart sushi-mosquitto-firstboot
sudo systemctl start mosquitto

If it still fails, contact info@softwaresushi.com.