Cannot access Openhab home from any device

So, I set up my home and everything worked for over a month now, and I had no problems whatsoever. However, now, I cannot access anything. The app does not load, and I can’t access it via the IP. Checking the logs, I quickly found the following error repeated loads of times since several hours:

2021-04-30 08:58:29.752 [INFO ] [.transport.mqtt.MqttBrokerConnection] - Starting MQTT broker connection to MY IP with clientid XYZ '(don't know if this is important, but I'll keep it censored)'
2021-04-30 08:58:34.777 [INFO ] [.reconnect.PeriodicReconnectStrategy] - Try to restore connection to MY IP. Next attempt in 5000ms

So, I knew something wasn’t working. I then did sudo apt-get update and sudo apt-get upgrade on my pi (which is where I run all the openhab stuff), and got another error message:

Setting up openhab (3.0.2-1) ...
/var/lib/dpkg/info/openhab.postinst: 4: /etc/default/openhab: PORTS: not found
dpkg: error processing package openhab (--configure):
 installed openhab package post-installation script subprocess returned error exit status 127
Errors were encountered while processing:
E: Sub-process /usr/bin/dpkg returned an error code (1)

Does anyone know this problem, or maybe know what the error messages mean?
Thanks a lot!

So, you had an issue (something related to MQTT, either binding or broker) so you upgrade, compounding the issue.
The second entry indicates a possible issue in the /etc/default/openhab file, possibly relates to a line containing the text PORTS, preventing openHAB from running.

This is just my plain reading of the quotes provided since I do not use MQTT with openHAB.

Ok, so you’re saying that the issues aren’t related with each other?

To be honest, I wasn’t aware that I had bindings that used MQTT. I’ll check the thing with the ports.

I do not know. Perhaps that file has a configuration option for MQTT port?

I checked the file, it doesn’t say anything about MQTT. I changed the ports from the original 8080 to a new one, but it worked the whole time so that can hardly be the problem. It’s quite frustrating because I have zero access to anything on openhab…

The dpkg file is a command where it says that I could execute it, but I don’t think that anything happens when I do.
Also: This problem came out of the blue, I didn’t do anything to provoke it. The setup phase was well done and I was just using it normally.

That second error may have nothing to do with your original issue.I assume you do not have much knowledge of Linux do that makes troubleshooting remotely more of a challenge.

As stated in the OH installation instructions

If you are unfamiliar with Linux, SSH and the Linux console or if you want to improve your skills, read up on these important topics. A lot of helpful articles can be found on the internet, for example:

Ok thanks. I’ll see what I can do. If I find the solution then I’ll post it here in case other people encounter the same problem.

Please post content of your /etc/default/openhab file. In case you cannot post it here you may use something like
I assume that your /etc/default/openhab file that normally contains the line


does not have the hashes at the beginning of the line.
Add them if they are missing. Then reinstall the openhab package.


Wow… That was the problem. I assume that openhab didn’t work without the upgrade and it couldn’t upgrade due to this error. Thanks a lot!

1 Like