Error setting up Mosquitto MQTT Broker via openhabian-config

  • Platform information:
    • Hardware: Raspberry Pi 4 4GB
    • OS: Openhabian (and all current stable updates)
    • Java Runtime Environment: whatever comes with openhabian
    • openHAB version: 3.2.0
  • Issue of the topic:
    I run “sudo openhabian-config” and select “20 | Optional Components”. After that I select “23 | Mosquitto”. I get a message, that Mosquitto will be installed and I select “Continue”. I enter a password I like to use (also tried without one) and select “OK”.
    The following error is shown now: “There was an error or itnerruption during the execution of: 20 | Optional Components”.
    When I leave the openhabian-config wizard and go back to console, I see the following error printed to the console:
Configuring MQTT... /opt/openhabian/functions/packages.bash: line 288: /etc/mosquitto/mosquitto.conf: No such file or directory
FAILED

Actually, I don’t know what to do but I guess it is correct, that this config not exists, because I am just about to install Mosquitto…

I tested a bit.
First thing to get one step further was to create the /etc/mosquitto directory manually upfront. In that case the mosquitto.conf and the passwd file will be created in that directory. The passwd file is empty but I stated a password.
The setup fails anyway, but with this error:

2022-04-18_14:26:14_CEST [openHABian] Configuring MQTT... chown: invalid user: ‘mosquitto:openhabian’
FAILED

Actually that user “mosquitto:openhabian” seems not to exist. I’m just a beginner in Linux, but I thing that means the username “mosquitto” in the group “openhabian”.
So I created the user by myself:

sudo useradd mosquitto
sudo passwd mosquitto
<enter my password>
sudo usermod -a -G openhabian mosquitto

That solved also the message above, but results in the next one:

2022-04-18_14:42:05_CEST [openHABian] Beginning the MQTT broker Eclipse Mosquitto installation... OK
2022-04-18_14:42:06_CEST [openHABian] Configuring MQTT... FAILED

Now I am missing information about what went wrong and I have no idea anymore.

I think something went wrong during the installation of the mosquitto package.
I can see that the file /etc/mosquitto/mosquitto.conf belongs to the mosquitto package:

dpkg -L mosquitto |grep mosquitto.conf
/etc/mosquitto/conf.d
/etc/mosquitto/conf.d/README
/etc/mosquitto/mosquitto.conf
/usr/share/doc/mosquitto/examples/mosquitto.conf.gz
/usr/share/man/man5/mosquitto.conf.5.gz

Also the user mosquitto is created as part of the mosquitto package installation.

I would suggest to check if the package is installed at all:

dpkg -l |grep mosuqitto

and try to reinstall it. In case it still fails there should be an error message explaining why it fails ( /etc/mosquitto/mosquitto.conf : No such file ) is not the root cause it is the consequence …

Hi @Wolfgang_S,

I checked (attention, you had a typo :wink: )
dpkg -l |grep mosquitto
The output is this:

ii  libmosquitto1:armhf            1.5.7-1+deb10u1                     armhf        MQTT version 3.1/3.1.1 client library
ii  mosquitto-clients              1.5.7-1+deb10u1                     armhf        Mosquitto command line MQTT clients

What I read from “dpkg -l” top output is, that the first two characters define the status.
First character = Desired status
Second character = Real Status.
Both is “i”, what I interpret as “installed”. But are this the packages required?
When I run “dpkg -L mosquitto |grep mosquitto.conf”, I get:

dpkg-query: package 'mosquitto' is not installed
Use dpkg --contents (= dpkg-deb --contents) to list archive files contents.

How do I trigger the (re-)installation? Is it just apt install mosquitto or is openHABian doing something else? I don’t want to break the OS functions.

This is what I have on the system:

dpkg -l |grep mosquitto
ii  libmosquitto1:armhf                  1.5.7-1+deb10u1                     armhf        MQTT version 3.1/3.1.1 client library
ii  mosquitto                            1.5.7-1+deb10u1                     armhf        MQTT version 3.1/3.1.1 compatible message broker
ii  mosquitto-clients                    1.5.7-1+deb10u1                     armhf        Mosquitto command line MQTT clients

So as suspected the package mosquitto is not installed.
You either caninstall it via the systems / OS command or you can use openhabian-config.
openhabian-config does some ( interactive ) preconfiguration that you need to do manually if you would use the pure native OS way of installing the package.
Thus first try again using openhabian-config and check for the error messages that appear inside of the dialog window and also for those that appear in the console in the background which is visialbe after closing the dialog window.

What I get when I use the openhabian-config dialog is what I wrote above.
To be percise, this message:


The output of the is already posted. Before doing any manual action it was

Configuring MQTT... /opt/openhabian/functions/packages.bash: line 288: /etc/mosquitto/mosquitto.conf: No such file or directory
FAILED

After creating the /etc/mosquitto folder it was

2022-04-18_14:26:14_CEST [openHABian] Configuring MQTT... chown: invalid user: ‘mosquitto:openhabian’
FAILED

and after creating the mosquitto user it was

2022-04-18_14:42:05_CEST [openHABian] Beginning the MQTT broker Eclipse Mosquitto installation... OK
2022-04-18_14:42:06_CEST [openHABian] Configuring MQTT... FAILED

Checking the link mentioned in the errormessage doesn’t help me very much because the descriptions are pointing to new installations of openhabian. But I just want to add a component and don’t know what will help me over here.

OK… I figured out, that there might be an issue on my system.
I tried to run sudo apt-get install --yes mosquitto mosquitto-clients manually and got some messages about locked log files.
I simply restarted my Pi and now I can run the installation via the openhabian-config.
I should have come to that point much earlier…