openHABian - Mosquitto MQTT failed to start

openHABian v1.6.2 fresh installation on a Raspberry Pi3 here, pretty standard configuration.
Installed frontail and mosquitto from openhabian-config interface.

Same problem described above for mosquitto at reboot.

Solved following the instructions by Markus Storm at post n. 41

Now mosquitto is working fine.

Tried some reboots, but the Rpi3 is slow to show up in the network again.

Spotted some errors in the openHAB logs about permission problems,
solved by:

chown -R openhab:openhab /var/lib/openhab/tmp
chown -R openhab:openhab /var/lib/openhab/cache

The reboot of the Rpi3 is still a little bit slow but the machine seems fine now.

Best regards,
francis3

Hi,

I had the same problem using a fresh openhabian image (v1.62) and installing mosquitto from openhabian-config. The override.conf was already there. Manual directory creation and chown (as in the posts above, Openhabian - Mosquitto MQTT failed to start - #79 by Max77) helped me as well.

I know that it doesn’t belong strictly to this topic, but it is some way related: I had the same problem with grafana. I installed influxDB+grafana from openhabian-config. InfluxDB was working OK, but the grafana-server service couldn’t start:

grafana-server[27912]: Failed to start grafana. error: failed to create log directory "/var/log/grafana": mkdir /var/log/grafana: permission denied

I solved the problem in a similar way:

sudo mkdir -p /var/log/grafana /opt/zram/log.bind/grafana
sudo chown grafana /var/log/grafana /opt/zram/log.bind/grafana

I’m not sure if the β€œ/opt/zram/log.bind/grafana” was needed as well.

Regards,
Fabio

4 Likes

Thank you!
searched around cause after the first reboot mosquitto did not start

the 2 lines fixed the problem :slight_smile:

Also worked for me, thanks!

Thanks a lot, I was looking for the solution for Mosquitto, but reading your post I realized that grafana was also failed. Your solution solved the problem :slight_smile:

1 Like

Thank you for that solution! I ran into the same problem with current provides image (v.1.6.5). Installing Mosquitto and Grafana via openhab config tool leeded to that same error described above. Is there any explenation, why it wasn’t solved within the last past year?

Edit: I had to do the same fix with β€œopenhab” and β€œhomegear”. That problem lead also into an Error while applying β€œ14 | Fix Permissions Update file permissions of commonly used files and folders” in openhab config tool. For now it seems to be fixed. But I’m really doubting about openhab (3) since the problem(s) appeared after a clean and β€œhassle free” install… :woozy_face:

Yes: Noone - including yourself - provided a bug report so we were not aware.
Everybody is quick at grousing, complaining and asking for help, but very few actually are willing to spend a little time help solving problems even if it’s as quick as to open a reasonable bug report.
β€˜Reasonable’ means to open a github issue with at least comprehensive information about the hardware and code version in use and - most important - a debug log that’s showing the problem,
but most people don’t even read the debug guide.

At least for openhab that’s not true in general as a fresh openHABian sets that up to work.
And option 14 does not give that error on a fresh (and unmodified) install either.
So if it didn’t work on your system you must have modified your installation or ignored any of the prerequisites such as to use latest openHABian and supported hardware.

We just fixed a problem with installing packages that log to zram locations (such as mosquitto, homegear and Grafana do), essentially the fix from post #82 (thanks @solid).

1 Like

I apologize. I was looking for a solution and I thought it might help others to mention what solved my problem.

I’m not an expert and I faced many issues after upgrade from 2.4 to 2.5 (now 3.1). So I started a clean setup with my usual bindings/extensions etc. Since I faced many problems/errors during standard setups, I got quite upset.

I honestly did not. My problems occured after clean install and adding components through openhabian-config (mosquitto, influxdb/grafana, homegear,…). I’m, still struggeling to get everything working as it was for years with pre-2.4 openhab.

Thanks, @mstormi for your effort to answer even unqualified remarks/requests as mine and trying to point people to the right direction solving their problems.

1 Like

In addition to my last post, my defense and for information: I tried to do a clean setup from scratch, because I was unable to get grafana installed. I did the β€œhassle free setup” with latest release (May 2021) on RPi4, 4GB.

After installation I took all β€œApply Improvements” steps in openhabian-config. When I reached the point Optional Components I ran into errors installing both

  • Grafana
  • Homegear

The error looks like this

My steps are listed below. Does anyone know, what is wrong with the current image? Thanks for your help! If information is missing, please let me know.

2021-08-05_18:34:27_CEST [openHABian] Updating Linux package information... OK
2021-08-05_18:34:27_CEST [openHABian] Installing basic can't-be-wrong packages (screen, vim, ...)... OK
2021-08-05_18:34:29_CEST [openHABian] Installing additional needed packages... OK
OK
2021-08-05_18:34:32_CEST [openHABian] Installing pigpio package... OK
2021-08-05_18:34:35_CEST [openHABian] Installing additional bluetooth packages... OK
2021-08-05_18:34:43_CEST [openHABian] Updating Linux package information... OK
2021-08-05_18:34:43_CEST [openHABian] Adding slightly tuned bash configuration files to system... OK
2021-08-05_18:34:43_CEST [openHABian] Adding slightly tuned vim configuration file to system... OK
2021-08-05_18:34:43_CEST [openHABian] Adding openHAB syntax to vim editor... OK
2021-08-05_18:34:45_CEST [openHABian] Adding openHAB syntax to nano editor... OK
2021-08-05_18:34:46_CEST [openHABian] Adding openHAB scheme to multitail... OK
2021-08-05_18:34:52_CEST [openHABian] Updating Linux package information... OK
2021-08-05_18:34:52_CEST [openHABian] Stopping zram service... OK
2021-08-05_18:35:17_CEST [openHABian] Preparing openHAB folder mounts under '/srv/openhab-*'... OK
2021-08-05_18:35:22_CEST [openHABian] Restarting zram service... OK
2021-08-05_18:35:22_CEST [openHABian] Applying miscellaneous system settings... OK
2021-08-05_18:35:28_CEST [openHABian] Updating Linux package information... OK
2021-08-05_18:35:28_CEST [openHABian] Applying file permissions recommendations... OK
2021-08-05_18:35:39_CEST [openHABian] Updating Linux package information... OK
2021-08-05_18:35:39_CEST [openHABian] Downloading FireMotD... OK
2021-08-05_18:35:40_CEST [openHABian] Installing FireMotD... OK
2021-08-05_18:35:40_CEST [openHABian] Generating FireMotD theme... OK
2021-08-05_18:35:52_CEST [openHABian] Setting up FireMotD apt updates count service... OK
2021-08-05_18:36:07_CEST [openHABian] Updating Linux package information... OK
2021-08-05_18:36:07_CEST [openHABian] Setting up Samba network shares... OK
2021-08-05_18:36:08_CEST [openHABian] Setting up Samba service... 2021-08-05_18:36:08_CEST [openHABian] Adding nmbd to zram service dependencies... OK
2021-08-05_18:36:08_CEST [openHABian] Adding smbd to zram service dependencies... OK
OK
2021-08-05_18:36:19_CEST [openHABian] Updating Linux package information... OK
2021-08-05_18:36:26_CEST [openHABian] Installing openHAB Log Viewer (frontail)... 2021-08-05_18:36:30_CEST [openHABian] Downloading frontail... OK
OK
2021-08-05_18:36:47_CEST [openHABian] Setting up openHAB Log Viewer (frontail) service... OK
2021-08-05_18:36:48_CEST [openHABian] Adding an openHAB dashboard tile for 'frontail'... Replacing... OK
2021-08-05_18:36:56_CEST [openHABian] Updating Linux package information... OK
2021-08-05_18:36:56_CEST [openHABian] Beginning the MQTT broker Eclipse Mosquitto installation... OK
2021-08-05_18:36:57_CEST [openHABian] Installing MQTT... OK
Reading package lists... Done
Building dependency tree
Reading state information... Done
0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.
2021-08-05_18:37:14_CEST [openHABian] Configuring MQTT... OK
2021-08-05_18:37:17_CEST [openHABian] Adding mosquitto to zram service dependencies... OK
2021-08-05_18:37:17_CEST [openHABian] Setting up MQTT service... OK
2021-08-05_18:37:27_CEST [openHABian] Updating Linux package information... OK
2021-08-05_18:37:27_CEST [openHABian] Beginning setup of InfluxDB and Grafana... OK
2021-08-05_18:37:28_CEST [openHABian] Configuring InfluxDB... OK
2021-08-05_18:37:52_CEST [openHABian] Configuring Grafana... OK
2021-08-05_18:38:00_CEST [openHABian] Installing InfluxDB... FAILED
2021-08-05_18:41:50_CEST [openHABian] Updating Linux package information... OK
2021-08-05_18:41:50_CEST [openHABian] Beginning Homematic CCU2 emulation software Homegear install... OK
2021-08-05_18:41:52_CEST [openHABian] Adding required keys to apt... OK
2021-08-05_18:41:53_CEST [openHABian] Installing Homegear... OK
2021-08-05_18:44:21_CEST [openHABian] Setting up Homegear user account permissions... OK
2021-08-05_18:44:21_CEST [openHABian] Setting up Homegear service... 2021-08-05_18:44:21_CEST [openHABian] Adding homegear to zram service dependencies... OK
2021-08-05_18:44:21_CEST [openHABian] Adding homegear-management to zram service dependencies... OK
2021-08-05_18:44:21_CEST [openHABian] Adding wiringpi to zram service dependencies... OK
FAILED (enable service)
2021-08-05_18:45:03_CEST [openHABian] Checking for default openHABian username:password combination... OK
2021-08-05_18:45:03_CEST [openHABian] We hope you got what you came for! See you again soon ;)

Read and follow the debug guide to provide a useful log.

Thank you, @mstormi for your kind, friendly and patient hint.

My logs were empty so unfortunately no useful log to provide. It turned out, that there were missing folders again. I created the folders and set permissions as mentioned in post #82. So again a similar behaviour after a totally fresh installation without having modified the installation or ignoring any of the prerequisites such as to use latest openHABian and supported hardware.

I’m not an expert, but neither a novice, so I’m a bit perplexed, that the installation and setup went a bit problematic since v. 2.5 (in my experience). (No offense. I highly appreceate the developers dedication to that project.)

I meant a useful openHABian log. The debug guide tells you how to produce that (set debugmode=maximum). You should also restate at least which openHABian branch you installed.

openHABian always installs latest versions of optional components and if those change that’s beyond our knowledge and control so if there’s a problem with that, installation fails.
There’s at least a known bug with the latest InfluxDB package which is probably the reason for that to fail for you. Note that’s a problem with the Linux package not with openHABian.

1 Like

There’s at least a known bug with the latest InfluxDB package which is probably the reason for that to fail for you. Note that’s a problem with the Linux package not with openHABian.

Thanks, I think, that’s one of the problems. I’m juggeling now with influx/grafana. Making sure users are added correctly helped in my case.

set debugmode=maximum

I’ll keep that in mind! Thanks again for the hint.

Hello All, i’ve been facing the same issue and I solved installing manually mosquitto (sudo apt-get install mosquitto), but I’m not sue why does openhabian-config does not work

Dear all,

I run into similar problems with OH 3.2 stable on RPi 4 32 bit.

Something I really do not understand: After booting, the command systemctl status mosquitto.service brings the follwing output:

openhabian@openhabian:~ $ systemctl status mosquitto.service
● mosquitto.service - Mosquitto MQTT Broker
     Loaded: loaded (/lib/systemd/system/mosquitto.service; enabled; vendor pre>
     Active: failed (Result: exit-code) since Mon 2022-01-24 18:38:23 CET; 4min>
       Docs: man:mosquitto.conf(5)
             man:mosquitto(8)
    Process: 567 ExecStartPre=/bin/mkdir -m 740 -p /var/log/mosquitto (code=exi>
    Process: 569 ExecStartPre=/bin/chown mosquitto /var/log/mosquitto (code=exi>
    Process: 570 ExecStartPre=/bin/mkdir -m 740 -p /run/mosquitto (code=exited,>
    Process: 571 ExecStartPre=/bin/chown mosquitto /run/mosquitto (code=exited,>
    Process: 572 ExecStart=/usr/sbin/mosquitto -c /etc/mosquitto/mosquitto.conf>
   Main PID: 572 (code=exited, status=1/FAILURE)
        CPU: 40ms
lines 1-12/12 (END)...skipping...
● mosquitto.service - Mosquitto MQTT Broker
     Loaded: loaded (/lib/systemd/system/mosquitto.service; enabled; vendor preset: enabled)
     Active: failed (Result: exit-code) since Mon 2022-01-24 18:38:23 CET; 4min 16s ago
       Docs: man:mosquitto.conf(5)
             man:mosquitto(8)
    Process: 567 ExecStartPre=/bin/mkdir -m 740 -p /var/log/mosquitto (code=exited, status=0/SUCCESS)
    Process: 569 ExecStartPre=/bin/chown mosquitto /var/log/mosquitto (code=exited, status=0/SUCCESS)
    Process: 570 ExecStartPre=/bin/mkdir -m 740 -p /run/mosquitto (code=exited, status=0/SUCCESS)
    Process: 571 ExecStartPre=/bin/chown mosquitto /run/mosquitto (code=exited, status=0/SUCCESS)
    Process: 572 ExecStart=/usr/sbin/mosquitto -c /etc/mosquitto/mosquitto.conf (code=exited, status=1/FAILURE)
   Main PID: 572 (code=exited, status=1/FAILURE)
        CPU: 40ms

By just apply a mosquitto service restart via sudo systemctl restart mosquitto, I get a working mosquitto as systemctl status mosquitto.service shows:

openhabian@openhabian:~ $ systemctl status mosquitto.service
● mosquitto.service - Mosquitto MQTT Broker
     Loaded: loaded (/lib/systemd/system/mosquitto.service; enabled; vendor preset: enabled)
     Active: active (running) since Mon 2022-01-24 18:46:21 CET; 2s ago
       Docs: man:mosquitto.conf(5)
             man:mosquitto(8)
    Process: 2259 ExecStartPre=/bin/mkdir -m 740 -p /var/log/mosquitto (code=exited, status=0/SUCCESS)
    Process: 2260 ExecStartPre=/bin/chown mosquitto /var/log/mosquitto (code=exited, status=0/SUCCESS)
    Process: 2261 ExecStartPre=/bin/mkdir -m 740 -p /run/mosquitto (code=exited, status=0/SUCCESS)
    Process: 2262 ExecStartPre=/bin/chown mosquitto /run/mosquitto (code=exited, status=0/SUCCESS)
   Main PID: 2263 (mosquitto)
      Tasks: 1 (limit: 4915)
        CPU: 157ms
     CGroup: /system.slice/mosquitto.service
             └─2263 /usr/sbin/mosquitto -c /etc/mosquitto/mosquitto.conf

Jan 24 18:46:21 openhabian systemd[1]: Starting Mosquitto MQTT Broker...
Jan 24 18:46:21 openhabian systemd[1]: Started Mosquitto MQTT Broker.

I could fix the mosquitto issue with this; openHABian - Mosquitto MQTT failed to start - #41 by mstormi which initiated a new first boot script run of raspberry and a very slow system with no working openhab any more. This does not feel the right approach - any hints?

Thanks and best!

any output from sudo journalctl -xu mosquitto that helpsto track down the root cause ?

Everything green at least:

-- Journal begins at Mon 2022-01-24 19:13:38 CET, ends at Mon 2022-01-24 19:45:59 CET. --
Jan 24 19:13:58 openhabian systemd[1]: Starting Mosquitto MQTT Broker...
β–‘β–‘ Subject: A start job for unit mosquitto.service has begun execution
β–‘β–‘ Defined-By: systemd
β–‘β–‘ Support: https://www.debian.org/support
β–‘β–‘
β–‘β–‘ A start job for unit mosquitto.service has begun execution.
β–‘β–‘
β–‘β–‘ The job identifier is 129.
Jan 24 19:14:12 openhabian systemd[1]: Started Mosquitto MQTT Broker.
β–‘β–‘ Subject: A start job for unit mosquitto.service has finished successfully
β–‘β–‘ Defined-By: systemd
β–‘β–‘ Support: https://www.debian.org/support
β–‘β–‘
β–‘β–‘ A start job for unit mosquitto.service has finished successfully.
β–‘β–‘
β–‘β–‘ The job identifier is 129.
Jan 24 19:15:46 openhabian systemd[1]: Stopping Mosquitto MQTT Broker...
β–‘β–‘ Subject: A stop job for unit mosquitto.service has begun execution
β–‘β–‘ Defined-By: systemd
β–‘β–‘ Support: https://www.debian.org/support
β–‘β–‘
β–‘β–‘ A stop job for unit mosquitto.service has begun execution.
β–‘β–‘
β–‘β–‘ The job identifier is 2234.
Jan 24 19:15:46 openhabian systemd[1]: mosquitto.service: Succeeded.
β–‘β–‘ Subject: Unit succeeded
β–‘β–‘ Defined-By: systemd
β–‘β–‘ Support: https://www.debian.org/support
β–‘β–‘
β–‘β–‘ The unit mosquitto.service has successfully entered the 'dead' state.
Jan 24 19:15:46 openhabian systemd[1]: Stopped Mosquitto MQTT Broker.
β–‘β–‘ Subject: A stop job for unit mosquitto.service has finished
β–‘β–‘ Defined-By: systemd
β–‘β–‘ Support: https://www.debian.org/support
β–‘β–‘
β–‘β–‘ A stop job for unit mosquitto.service has finished.
β–‘β–‘
β–‘β–‘ The job identifier is 2234 and the job result is done.
-- Boot 1bc03ccc70bc4997ba086e614cccd249 --
lines 1-40...skipping...
-- Journal begins at Mon 2022-01-24 19:13:38 CET, ends at Mon 2022-01-24 19:45:59 CET. --
Jan 24 19:13:58 openhabian systemd[1]: Starting Mosquitto MQTT Broker...
β–‘β–‘ Subject: A start job for unit mosquitto.service has begun execution
β–‘β–‘ Defined-By: systemd
β–‘β–‘ Support: https://www.debian.org/support
β–‘β–‘
β–‘β–‘ A start job for unit mosquitto.service has begun execution.
β–‘β–‘
β–‘β–‘ The job identifier is 129.
Jan 24 19:14:12 openhabian systemd[1]: Started Mosquitto MQTT Broker.
β–‘β–‘ Subject: A start job for unit mosquitto.service has finished successfully
β–‘β–‘ Defined-By: systemd
β–‘β–‘ Support: https://www.debian.org/support
β–‘β–‘
β–‘β–‘ A start job for unit mosquitto.service has finished successfully.
β–‘β–‘
β–‘β–‘ The job identifier is 129.
Jan 24 19:15:46 openhabian systemd[1]: Stopping Mosquitto MQTT Broker...
β–‘β–‘ Subject: A stop job for unit mosquitto.service has begun execution
β–‘β–‘ Defined-By: systemd
β–‘β–‘ Support: https://www.debian.org/support
β–‘β–‘
β–‘β–‘ A stop job for unit mosquitto.service has begun execution.
β–‘β–‘
β–‘β–‘ The job identifier is 2234.
Jan 24 19:15:46 openhabian systemd[1]: mosquitto.service: Succeeded.
β–‘β–‘ Subject: Unit succeeded
β–‘β–‘ Defined-By: systemd
β–‘β–‘ Support: https://www.debian.org/support
β–‘β–‘
β–‘β–‘ The unit mosquitto.service has successfully entered the 'dead' state.
Jan 24 19:15:46 openhabian systemd[1]: Stopped Mosquitto MQTT Broker.
β–‘β–‘ Subject: A stop job for unit mosquitto.service has finished
β–‘β–‘ Defined-By: systemd
β–‘β–‘ Support: https://www.debian.org/support
β–‘β–‘
β–‘β–‘ A stop job for unit mosquitto.service has finished.
β–‘β–‘
β–‘β–‘ The job identifier is 2234 and the job result is done.
-- Boot 1bc03ccc70bc4997ba086e614cccd249 --
Jan 24 19:16:29 openhabian systemd[1]: Starting Mosquitto MQTT Broker...
β–‘β–‘ Subject: A start job for unit mosquitto.service has begun execution
β–‘β–‘ Defined-By: systemd
β–‘β–‘ Support: https://www.debian.org/support
β–‘β–‘
β–‘β–‘ A start job for unit mosquitto.service has begun execution.
β–‘β–‘
β–‘β–‘ The job identifier is 101.
lines 1-48...skipping...
-- Journal begins at Mon 2022-01-24 19:13:38 CET, ends at Mon 2022-01-24 19:45:59 CET. --
Jan 24 19:13:58 openhabian systemd[1]: Starting Mosquitto MQTT Broker...
β–‘β–‘ Subject: A start job for unit mosquitto.service has begun execution
β–‘β–‘ Defined-By: systemd
β–‘β–‘ Support: https://www.debian.org/support
β–‘β–‘
β–‘β–‘ A start job for unit mosquitto.service has begun execution.
β–‘β–‘
β–‘β–‘ The job identifier is 129.
Jan 24 19:14:12 openhabian systemd[1]: Started Mosquitto MQTT Broker.
β–‘β–‘ Subject: A start job for unit mosquitto.service has finished successfully
β–‘β–‘ Defined-By: systemd
β–‘β–‘ Support: https://www.debian.org/support
β–‘β–‘
β–‘β–‘ A start job for unit mosquitto.service has finished successfully.
β–‘β–‘
β–‘β–‘ The job identifier is 129.
Jan 24 19:15:46 openhabian systemd[1]: Stopping Mosquitto MQTT Broker...
β–‘β–‘ Subject: A stop job for unit mosquitto.service has begun execution
β–‘β–‘ Defined-By: systemd
β–‘β–‘ Support: https://www.debian.org/support
β–‘β–‘
β–‘β–‘ A stop job for unit mosquitto.service has begun execution.
β–‘β–‘
β–‘β–‘ The job identifier is 2234.
Jan 24 19:15:46 openhabian systemd[1]: mosquitto.service: Succeeded.
β–‘β–‘ Subject: Unit succeeded
β–‘β–‘ Defined-By: systemd
β–‘β–‘ Support: https://www.debian.org/support
β–‘β–‘
β–‘β–‘ The unit mosquitto.service has successfully entered the 'dead' state.
Jan 24 19:15:46 openhabian systemd[1]: Stopped Mosquitto MQTT Broker.
β–‘β–‘ Subject: A stop job for unit mosquitto.service has finished
β–‘β–‘ Defined-By: systemd
β–‘β–‘ Support: https://www.debian.org/support
β–‘β–‘
β–‘β–‘ A stop job for unit mosquitto.service has finished.
β–‘β–‘
β–‘β–‘ The job identifier is 2234 and the job result is done.
-- Boot 1bc03ccc70bc4997ba086e614cccd249 --
Jan 24 19:16:29 openhabian systemd[1]: Starting Mosquitto MQTT Broker...
β–‘β–‘ Subject: A start job for unit mosquitto.service has begun execution
β–‘β–‘ Defined-By: systemd
β–‘β–‘ Support: https://www.debian.org/support
β–‘β–‘
β–‘β–‘ A start job for unit mosquitto.service has begun execution.
β–‘β–‘
β–‘β–‘ The job identifier is 101.
Jan 24 19:16:44 openhabian systemd[1]: Started Mosquitto MQTT Broker.
β–‘β–‘ Subject: A start job for unit mosquitto.service has finished successfully
β–‘β–‘ Defined-By: systemd
β–‘β–‘ Support: https://www.debian.org/support
β–‘β–‘
β–‘β–‘ A start job for unit mosquitto.service has finished successfully.
β–‘β–‘
β–‘β–‘ The job identifier is 101.

Stuff from before 19:13 ( e.g. 18:38 ) is not included.

Correct, I copied everything from the shell. Any wrong command on my side? The system is quite fresh from today, mosquitto has been installed this afternoon.

I realized having mosquitto on the same system as openhab causes other systems that depend on mqtt to fail. I went back to a docker mosquitto on my Synology NAS to seperate the setups => not relevant for me any more but still weired behavior.