[Zigbee2mqtt] Unable to configure the service

Hello everyone.

I have an issue with the Zigbee module configuration.

My installation (freshly reinstalled a few minutes ago):

An Intel NUC running Ubuntu 22.04.2 LTS

A Sonoff Zigbee Dongle (ZBDongle-P)

Gladys on Docker following Pierre Gilles’ tutorial

In the Zigbee2mqtt integration module, when I enable the service, the mosquitto folders and configuration files are not created in the gladys assistant directory

When I run docker ps, the status of the gladys-z2m-mqtt container is Restarting (13).

anthony@NUC-Anthony:/var/lib/gladysassistant$ docker ps
CONTAINER ID   IMAGE                       COMMAND                  CREATED          STATUS                         PORTS     NAMES
9445326db9de   eclipse-mosquitto:2         \"/docker-entrypoint.…\"   12 seconds ago   Restarting (13) 1 second ago             gladys-z2m-mqtt
d7e3301030ba   gladysassistant/gladys:v4   \"docker-entrypoint.s…\"   7 minutes ago    Up 7 minutes                             gladys

I tried to force the permissions of the /var/lib/gladysassistant directory to 775, but it doesn’t help: the folders and files are not created:

anthony@NUC-Anthony:/var/lib/gladysassistant$ ls -lh
total 2,8M
-rwxrwxr-x 1 root root 4,0K avril 25 22:08 gladys-production.db
-rwxrwxr-x 1 root root  32K avril 25 22:14 gladys-production.db-shm
-rwxrwxr-x 1 root root 2,7M avril 25 22:14 gladys-production.db-wal
drwxrwxr-x 2 root root 4,0K avril 25 22:08 homekit
drwxr-xr-x 3 root root 4,0K avril 25 22:14 zigbee2mqtt

I’m out of ideas.

Thanks in advance for your help.

First of all, do you have the logs from the gladys-z2m-mqtt container?

docker logs gladys-z2m-mqtt

Yes, here they are:

1682454363: mosquitto version 2.0.15 starting
1682454363: Config loaded from /mosquitto/config/mosquitto.conf.
1682454363: Error: Unable to open pwfile "/mosquitto/config/mosquitto.passwd".
1682454363: Error opening password file "/mosquitto/config/mosquitto.passwd".

They make sense since the /mosquitto folder was not created.

Here are the logs of the Gladys container:

2023-04-25T22:14:54+0200 \u003cinfo\u003e init.js:38 (Zigbee2mqttManager.init) Zigbee2mqtt USB dongle attached to /dev/ttyUSB0
2023-04-25T22:14:54+0200 \u003cinfo\u003e checkForContainerUpdates.js:14 (Zigbee2mqttManager.checkForContainerUpdates) Checking for current installed versions and required updates...
2023-04-25T22:14:54+0200 \u003cinfo\u003e checkForContainerUpdates.js:18 (Zigbee2mqttManager.checkForContainerUpdates) MQTT container: update #3 of the container required...
2023-04-25T22:14:54+0200 \u003cinfo\u003e checkForContainerUpdates.js:35 (Zigbee2mqttManager.checkForContainerUpdates) MQTT container: update #3 of the container done
2023-04-25T22:14:54+0200 \u003cinfo\u003e checkForContainerUpdates.js:40 (Zigbee2mqttManager.checkForContainerUpdates) Z2M container: update #3 of the container required...
2023-04-25T22:14:54+0200 \u003cinfo\u003e checkForContainerUpdates.js:57 (Zigbee2mqttManager.checkForContainerUpdates) Z2M container: update #3 of the container done
2023-04-25T22:14:54+0200 \u003cinfo\u003e installMqttContainer.js:29 (Zigbee2mqttManager.installMqttContainer) MQTT broker is being installed as Docker container...
2023-04-25T22:14:54+0200 \u003cinfo\u003e installMqttContainer.js:30 (Zigbee2mqttManager.installMqttContainer) Pulling eclipse-mosquitto:2 image...
2023-04-25T22:14:56+0200 \u003cinfo\u003e installMqttContainer.js:34 (Zigbee2mqttManager.installMqttContainer) Preparing broker environment...
2023-04-25T22:14:56+0200 \u003cinfo\u003e installMqttContainer.js:41 (Zigbee2mqttManager.installMqttContainer) Writing Mosquitto config file in /var/lib/gladysassistant/zigbee2mqtt/mqtt/mosquitto.conf
2023-04-25T22:14:56+0200 \u003cinfo\u003e installMqttContainer.js:50 (Zigbee2mqttManager.installMqttContainer) Creating container with data in "/var/lib/gladysassistant" on host...
2023-04-25T22:14:57+0200 \u003cinfo\u003e installMqttContainer.js:64 (Zigbee2mqttManager.installMqttContainer) MQTT broker is restarting...
2023-04-25T22:15:00+0200 \u003cinfo\u003e scene.checkCalendarTriggers.js:24 (SceneManager.checkCalendarTriggers) Checking calendar triggers at Tue, 25 Apr 2023 20:15:00 GMT
2023-04-25T22:15:03+0200 \u003cinfo\u003e installMqttContainer.js:72 (Zigbee2mqttManager.installMqttContainer) Creating user/pass...
2023-04-25T22:15:05+0200 \u003cerror\u003e installMqttContainer.js:94 (Zigbee2mqttManager.installMqttContainer) MQTT broker container failed to start: Error: (HTTP code 409) container stopped/paused - Container 9445326db9de3007d75ba1408e7004302a0d15e8994d0647f4abb7fa68b7c7d9 is restarting, wait until the container is running

1 Like

Well, I’m at the limit of my knowledge (not very extensive), so I won’t be able to help you beyond that..
Have you tried restarting Gladys?
Or even restarting your NUC?

I’m in exactly the same situation. After a power cut my Raspberry Pi would power on but reboot immediately — I tried to start from a clean configuration when in the end it was the power supply that had taken a hit.

I’m in the same boat as you and honestly I’m tearing my hair out. Whether it’s a fresh setup or a restore via Gladys Plus.

And Node-RED with the serial port problem — don’t get me started.

If there are any solutions I’m open to them as well.

Out of curiosity, have you tried doing a clean install of a new OS, then reinstalling Docker / Gladys afterwards?
Because what’s surprising is that it’s a completely fresh install… Everything should be running smoothly :thinking:

I tested with an older one and the very latest img 4.21.

Same result.

Yes, sorry I meant to talk about testing Gladys on another OS. On PC it can be Debian / Ubuntu / other

On Raspberry it can be Raspbian / dietPi / other

Not tested on my side

Tested only on this version of Ubuntu. I’m on my 4th fresh install (I’m starting to know the Ubuntu installation steps by heart :slight_smile: )

Hi @TriBeCa !

Which docker run command did you run? Exactly the same as on the site or did you make modifications to that command?

The folder you show looks fine, there is indeed a « zigbee2mqtt » folder that was created. Can you go into that folder and show its contents? If it contains a « mqtt » folder, can you go into the « mqtt » folder and show its contents to us?

This « path » is the internal path inside the container; in Gladys these folders will be placed on the volume /var/lib/gladysassistant/zigbee2mqtt/mqtt.

However, the logs you show do contain an error:

MQTT broker container failed to start: 
Error: (HTTP code 409) container stopped/paused - Container 9445326db9de3007d75ba1408e7004302a0d15e8994d0647f4abb7fa68b7c7d9 is restarting, wait until the container is running

Nonetheless this error is not necessarily the first error you had; you find yourself in a bit of a messy situation where you have a container that keeps restarting and therefore Gladys may not necessarily see it.

Can you stop then remove this container:

docker stop 9445326db9de3007d75ba1408e7004302a0d15e8994d0647f4abb7fa68b7c7d9
docker rm 9445326db9de3007d75ba1408e7004302a0d15e8994d0647f4abb7fa68b7c7d9

Then restart Gladys:

docker restart gladys

@TriBeCa @jerome Actually I think there’s been an issue for 3 weeks following this PR: Activate persistence in Zigbee2mqtt mosquitto to avoid losing devices on MQTT restart by Pierre-Gilles · Pull Request #1731 · GladysAssistant/Gladys · GitHub

The problem isn’t coming from your side, I need to make a fix.

In the meantime, if you run:

touch /var/lib/gladysassistant/zigbee2mqtt/mqtt/mosquitto.passwd

Then restart Gladys (docker restart gladys), I think that should do the job until I fix this bug.

2 Likes

Thanks to everyone for your replies.

It works by creating the mosquitto.conf file:

CONTAINER ID   IMAGE                       COMMAND                  CREATED          STATUS              PORTS     NAMES
61f274b22beb   koenkk/zigbee2mqtt:latest   \"docker-entrypoint.s…\"   15 seconds ago   Up 10 seconds                 gladys-z2m-zigbee2mqtt
89c67dfdb09f   eclipse-mosquitto:2         \"/docker-entrypoint.…\"   50 seconds ago   Up 38 seconds                 gladys-z2m-mqtt
d7e3301030ba   gladysassistant/gladys:v4   \"docker-entrypoint.s…\"   12 hours ago     Up About a minute             gladys

1 Like

Great!

As this is a fairly critical bug, I created an urgent pull request here:

I started a Docker build, I’ll run some tests, and if it’s good I’ll deploy this to production.

Thanks for the feedback :folded_hands:

2 Likes

Great, thanks

Working for me now too and with the Gladys Plus restore it’s just great, no need to reconfigure everything.

1 Like

The fix is available in Gladys Assistant v4.21.1: