MQTT Broker

openhabian@openhabian:~ $ sudo cat /var/log/mosquitto/mosquitto.log
cat: /var/log/mosquitto/mosquitto.log: No such file or directory
openhabian@openhabian:~ $ sudo journalctl -xe
-- Subject: A start job for unit UNIT has finished successfully
-- Defined-By: systemd
-- Support: https://www.debian.org/support
--
-- A start job for unit UNIT has finished successfully.
--
-- The job identifier is 11.
Dec 11 23:46:39 openhabian systemd[12463]: Reached target Sockets.
-- Subject: A start job for unit UNIT has finished successfully
-- Defined-By: systemd
-- Support: https://www.debian.org/support
--
-- A start job for unit UNIT has finished successfully.
--
-- The job identifier is 6.
Dec 11 23:46:39 openhabian systemd[12463]: Reached target Basic System.
-- Subject: A start job for unit UNIT has finished successfully
-- Defined-By: systemd
-- Support: https://www.debian.org/support
--
-- A start job for unit UNIT has finished successfully.
--
-- The job identifier is 2.
Dec 11 23:46:39 openhabian systemd[12463]: Reached target Default.
-- Subject: A start job for unit UNIT has finished successfully
-- Defined-By: systemd
-- Support: https://www.debian.org/support
--
-- A start job for unit UNIT has finished successfully.
--
-- The job identifier is 1.
Dec 11 23:46:39 openhabian systemd[12463]: Startup finished in 175ms.
-- Subject: User manager start-up is now complete
-- Defined-By: systemd
-- Support: https://www.debian.org/support
--
-- The user manager instance for user 1000 has been started. All services queued
-- for starting have been started. Note that other services might still be starting
-- up or be started at any later time.
--
-- Startup of the manager took 175114 microseconds.
Dec 11 23:46:39 openhabian systemd[1]: Started User Manager for UID 1000.
-- Subject: A start job for unit user@1000.service has finished successfully
-- Defined-By: systemd
-- Support: https://www.debian.org/support
--
-- A start job for unit user@1000.service has finished successfully.
--
-- The job identifier is 14243.
Dec 11 23:46:39 openhabian systemd[1]: Started Session 538 of user openhabian.
-- Subject: A start job for unit session-538.scope has finished successfully
-- Defined-By: systemd
-- Support: https://www.debian.org/support
--
-- A start job for unit session-538.scope has finished successfully.
--
-- The job identifier is 14309.
Dec 11 23:46:51 openhabian sudo[12872]: openhabian : TTY=pts/0 ; PWD=/home/openhabian ; USER=root ; COMMAND=/usr/bin/cat /var/log/mosquitto/mosquitto.log
Dec 11 23:46:51 openhabian sudo[12872]: pam_unix(sudo:session): session opened for user root by openhabian(uid=0)
Dec 11 23:46:51 openhabian sudo[12872]: pam_unix(sudo:session): session closed for user root
Dec 11 23:46:58 openhabian sudo[12880]: openhabian : TTY=pts/0 ; PWD=/home/openhabian ; USER=root ; COMMAND=/usr/bin/cat /var/log/mosquitto/mosquitto.log
Dec 11 23:46:58 openhabian sudo[12880]: pam_unix(sudo:session): session opened for user root by openhabian(uid=0)
Dec 11 23:46:58 openhabian sudo[12880]: pam_unix(sudo:session): session closed for user root
Dec 11 23:47:07 openhabian sudo[12897]: openhabian : TTY=pts/0 ; PWD=/home/openhabian ; USER=root ; COMMAND=/usr/bin/journalctl -xe
Dec 11 23:47:07 openhabian sudo[12897]: pam_unix(sudo:session): session opened for user root by openhabian(uid=0)

openhabian@openhabian:~ $

these is what i got

That is strange:

  • in case mosquitto is installed there should be a file in directory /var/log/mosquitto
  • in case mosquitto has startup problems that should be mentioned in the journalctl output but it is not

Out of curiosity: did you just restart openhabian before posting the output of journalctl ? I am wondering why there is no output for mosquitto.

I didn’t restart openhabian

ok. Let’s do some other checks:
Which version is installed: dpkg -l | grep mosquitto
Does a log file/directory for mosquitto exist: ls -l /var/log /var/log/mosquitto 2>/dev/null |grep mosquitto

Based on the previous analysis it looks like there would be no log directory for mosquitto.
The above commands do a few further checks. In case the first one does not show that mosquitto is installed you need to install it ( again ). In case the log directory/file for mosquitto is not shown you may need to install it again.

1 Like


these is what i got.

ok.
There is the directory /var/log/mosquitto. But it is owned by root:root instead of mosquitto:mosquitto.
You can use: sudo chown mosquitto:mosquitto /var/log/mosquitto
to repair that. After that try: sudo systemctl restart mosquitto
In case mosquitto still does not start there might be further problems with regard to permissions.
Check if the log file then exists and contains further information.
I assume that you use ZRAM. Check if mosquitto starts again after restarting OH. It could be that the permssions are changed back after you repaired them. In that case you may have to stop/deinstall ZRAM; repair the ownership of /var/log/mosquitto and start/install ZRAM again.

EDITed: sorry the last argument in the chown command was missing

Screenshot 2021-12-12 180251

sorry, the last argument in the chown command was missing. I corrected that in my previous post.

ok thanks, it’s now working

1 Like

Does it still work after a reboot ?

nope, just checked and it’s not working again

Did you try the second/last part of the instruction set I described earlier ?
That means did you stop ZRAM and then apply the fix with regard to permissions ?
It looks like the permission fix was only done in the ZRAM mirror and not the underlying file system.

yeah, i tried that

didn’t work

/var/log/mosquitto/ is again owned by root:root instead of by mosquitto:mosquitto ?

yeah, it is again owned by root:root

As far as I remember I initially also had that problem.
Unfortunately I do not remember the exact steps but either disabling or even deinstaling ZRAM helped.
Then either fixing the permission or reinstalling mosquitto.
I would suggest to do the above steps first without using ZRAM.
If that works after a reboot install/enable ZRAM again.

1 Like

what commands do i need to send? I don’t know much about openhabian or linux

Check menu 38 in openhabian.

i have disabled xram now what do i do?