#MQTT didnt't start; "Couldn't open database"

1 messages · Page 1 of 1 (latest)

stuck mason
#

Hi All.
i have been running into an MQTT problem since last night.
I have HA running under Proxmox. Yesterday my system ran OutOfMemory. I noticed this today by accident, because devices that are connected via MQTT no longer delivered any values.
I then shut down HA and allocated an additional 100GB. On restart, however, my Mosquitto broker (6.5.0) no longer wants to start cleanly or it keeps restarting. Brings "Error: Couldn't open database"

The cycle then looks like this in the log:

s6-rc: info: service legacy-services successfully stopped
...s6-rc: info: service legacy-cont-init: starting
cont-init: info: running /etc/cont-init.d/mosquitto.sh
[00:32:25] INFO: SSL is not enabled
cont-init: info: /etc/cont-init.d/mosquitto.sh exited 0
cont-init: info: running /etc/cont-init.d/nginx.sh
cont-init: info: /etc/cont-init.d/nginx.sh exited 0
s6-rc: info: service legacy-cont-init successfully started
s6-rc: info: service legacy-services: starting
services-up: info: copying legacy longrun mosquitto (no readiness notification)
services-up: info: copying legacy longrun nginx (no readiness notification)
[00:32:25] INFO: Starting NGINX for authentication handling...
s6-rc: info: service legacy-services successfully started
[00:32:26] INFO: Starting mosquitto MQTT broker...
1745015546: Loading config file /share/mosquitto/mosquitto.conf
2025-04-19 00:32:26: Warning: Mosquitto should not be run as root/administrator.
2025-04-19 00:32:26: Error: Couldn't open database.
[22:33:18] WARNING: Halt add-on
s6-rc: info: service legacy-services: stopping
[22:33:18] INFO: Service restart after closing```

Read someting that the db is maybe corrupt. It could be deleted and the AddOn will recreate a new one on next Start.
But i can't find the mosquitto.db. Can somebody help?
#

MQTT didnt't start; "Couldn't open database"

vivid rover
#

100G is quite excessive. Did you run out of storage of memory?

stuck mason
#

Yes, due to a high number of local backups in the “Home Assistant Google Drive Backup” add-on, I ran out of memory.
I suspect that the Mosquitto database has broken during OutOfMemory.

vivid rover
#

So not memory but storage. Install the Advanced SSH addon with disabled protection mode and I'll get a command ready.

#

Alternatively uninstall the addon and install it again or just restore a snapshot/backup.

#

Stop the mosquitto addon, then run this via the Advanced SSH addon

docker run -v /mnt/data/supervisor/addons/data/core_mosquitto:/data alpine sh -c "rm /data/mosquitto.db"
stuck mason
#

Ok. Let met try to install tha advanced SSH Asson

#

I get this message:

latest: Pulling from library/alpine
f18232174bc9: Already exists 
Digest: sha256:a8560b36e8b8210634f77d9f7f9efd7ffa463e380b75e2e74aff4511df3ef88c
Status: Downloaded newer image for alpine:latest```
vivid rover
#

That's fine. Try starting the addon now and check the log.

stuck mason
#

Mega. That worked. Now the broker is running again and I can also read along again via MQTT Explorer and my devices are gradually reporting back.
Thank you very much and best regards from Germany

vivid rover
#

Glad I could be of help.