Deconz and openhab UI fight a fight deconz wins

Openhabian
Release = Raspbian GNU/Linux 11 (bullseye)
Kernel = Linux 5.10.63-v7l+
Platform = Raspberry Pi 4 Model B Rev 1.2
openHAB version: 3.2.0

Powered hub with Conbee II stick, Aeotec Zwave stick gen 5 (not +) and serial port adapter on usb (PL2032)

I did due to a broken SD-card a full reinstall of openhabian from a backup, and decided to move my deconz stick also to the Pi in stead of on my synology/docker combo.

At start all was ok. After some reboots I noticed my deconz-bridge was offline. the service did not start as was shown through “systemctl status deconz”.

I added it with “sudo systemctl enable deconz.service” but then my openhab-UI did not come online.
So I removed it again and since then after every reboot I manually start the deconz service.

Questions:

  • Any idea why it goes wrong?
  • Can I add a script to start it later? Or better to start over again?

In the meantime I noticed that openhab goes offline after roughly two days throwing the error “openhab java.lang.OutOfMemoryError: unable to create native thread: possibly out of memory or process/resource limits reached”. I suppose those things are unrelated, but for the sake of completeliness I add it anyway.

Any hints would be appreciated.

This sounds like both services use the same port:
The web UI runs on port 8080, right ?
Start the conbee service and check on which port it is running.
It it is 8080 as well you need to make sure that one of the services is configured to run on a different port.

1 Like

Thx for the reply! I thought I was complete, but apparently I was not :smiley:, that was what I checked first. Setup in openhabian defaults deconz tot 8081.

Openhab runs on 8080, deconz UI on 8081

openhabian@openhabian:~ $ sudo systemctl status openhab
● openhab.service - openHAB instance, reachable at http://openhabian:8080
Loaded: loaded (/lib/systemd/system/openhab.service; enabled; vendor preset: enabled)
Drop-In: /etc/systemd/system/openhab.service.d
└─override.conf
Active: active (running) since Wed 2022-01-05 15:54:47 CET; 1h 50min ago
Docs: Introduction | openHAB
https://community.openhab.org
Main PID: 782 (java)
Tasks: 959 (limit: 4915)
CPU: 10min 14.950s
CGroup: /system.slice/openhab.service
└─782 /usr/bin/java -XX:-UsePerfData -Dopenhab.home=/usr/share/openhab -Dopenhab.conf=/etc/openhab -Dopenhab.runtime=/usr/share/openhab/runtime -Dopen>
Jan 05 15:54:47 openhabian systemd[1]: Started openHAB instance, reachable at http://openhabian:8080.

openhabian@openhabian:~ $ sudo systemctl status deconz
● deconz.service - deCONZ: ZigBee gateway – REST API
Loaded: loaded (/lib/systemd/system/deconz.service; disabled; vendor preset: enabled)
Active: active (running) since Wed 2022-01-05 16:27:09 CET; 1h 19min ago
Main PID: 5198 (deCONZ)
Tasks: 4 (limit: 4915)
CPU: 36.986s
CGroup: /system.slice/deconz.service
└─5198 /usr/bin/deCONZ -platform minimal --http-port=8081
Jan 05 16:27:09 openhabian systemd[1]: Started deCONZ: ZigBee gateway – REST API.
Jan 05 16:27:10 openhabian deCONZ[5198]: QStandardPaths: XDG_RUNTIME_DIR not set, defaulting to ‘/tmp/runtime-openhabian’
Jan 05 16:27:10 openhabian deCONZ[5198]: libpng warning: iCCP: known incorrect sRGB profile
Jan 05 16:27:11 openhabian deCONZ[5198]: This plugin does not support propagateSizeHints()

Ok.
Does sudo journalctl resp. the log in /var/log/openhab tell you anything about why openhab-UI does not start ?

1 Like

openhabian@openhabian:/var/log/openhab $ sudo journalctl -u openhab.service -b
[sudo] password for openhabian:
– Journal begins at Wed 2022-01-05 16:17:37 CET, ends at Thu 2022-01-06 09:50:46 CET. –
Jan 06 09:30:51 openhabian systemd[1]: Started openHAB instance, reachable at http://openhabian:8080.

from the log:

2022-01-06 09:31:12.945 [ERROR] [.service.internal.HttpServiceStarted] - Could not start the servlet context for context path []
java.io.IOException: Failed to bind to /0.0.0.0:8080

With lots of other error log, but fact is that deconz starts at port 8080, but it should start given the config at part 8081. When I boot without deconz in systemctl and I start afterwards, no problem.

/lib/systemd/system/deconz.service
[Unit]
Description=deCONZ: ZigBee gateway – REST API
Wants=deconz-init.service deconz-update.service
StartLimitIntervalSec=0

[Service]
User=1000
ExecStart=/usr/bin/deCONZ -platform minimal --http-port=8081
Restart=on-failure
RestartSec=30
AmbientCapabilities=CAP_NET_BIND_SERVICE CAP_KILL CAP_SYS_BOOT CAP_SYS_TIME

[Install]
WantedBy=multi-user.target

/lib/systemd/system/deconz-gui.service
[Unit]
Description=deCONZ: ZigBee gateway – GUI/REST API
Wants=deconz-init.service deconz-update.service
After=lightdm.service vncserver-x11-serviced.service

[Service]
User=1000
Environment=“DISPLAY=:0”
ExecStart=/usr/bin/deCONZ --http-port=80
Restart=on-failure
StartLimitIntervalSec=0
RestartSec=30
AmbientCapabilities=CAP_NET_BIND_SERVICE CAP_KILL CAP_SYS_BOOT CAP_SYS_TIME

[Install]
WantedBy=multi-user.target

Could you use the start sequence that does not work.
And once deconz is running, while openhab rejected to start run

sudo netstat -tulpn |grep 8080

please.
This should show the process that runs on port 8080.
After that please also check if there is any process running on the port that you expect.
It could be that the application tries to use a default port and as long as it is free it takes the free port.

1 Like

This is the response for 8080 and 8081.

It seems as I suspected in my first post that deconz is trying to take as well both port 8080 and 8081. So best thing seems to me to have the deconz service wait to startup so that it sees that port 8080 is already taken. Although as for the config of deconz it shouldn’t care about that because it is set tot port 8081.

openhabian@openhabian:~ $ sudo netstat -tulpn |grep 8080
[sudo] password for openhabian:
tcp 0 0 0.0.0.0:8080 0.0.0.0:* LISTEN 346/deCONZ
openhabian@openhabian:~ $ sudo netstat -tulpn |grep 8081
tcp 0 0 0.0.0.0:8081 0.0.0.0:* LISTEN 346/deCONZ

When I boot without deconz as system service I get

openhabian@openhabian:~ $ sudo netstat -tulpn |grep 8080
tcp6 0 0 :::8080 :::* LISTEN 783/java
and no response on 8081.

after sudo service deconz start I get
openhabian@openhabian:~ $ sudo netstat -tulpn |grep 8081
tcp 0 0 0.0.0.0:8081 0.0.0.0:* LISTEN 6554/deCONZ

as you can see both ports are occupied by the deCONZ service.
In case you did not already do could you please try to connect to both ports using a browser just to check if deCONZ comes back with the same webpage on both of them ?
It could be that on port 8080 a different part of the service is begin shown than on 8081.

Try disabling the gui service and start deconz again. Maybe it defaults to alternative http port (8080) if it cant bind to 80 (below 1024 needs higher priv.) and then conflicts with Openhab.

$ sudo systemctl disable deconz-gui
$ sudo systemctl stop deconz-gui

then restart your system to both Openhab and deconz (api) can get a chang to start normally.

I changed port of deconz-gui to 8082 in stead of 80, no avail.
I disabled deconz-gui, but deconz service still tries to get the 8080, where it is in the config file clearly set to 8080.
I ran setup again through openhabian, with port 8081, reboot, still the same.

Only thing that keeps on working is when I boot without deconz in systemctl and I start it manually when OH is fully started.

The only solution seems to be a wait-script for deconz to start when OH is fully started.

I will try anyway to do a full reinstall too, maybe that solves the problem.

What happends when you disable the service and start the command manually? Does is bind to the specified port ?

What’s the output of
$sudo systemctl cat deconz ?

( i run deconz on a seperate VM from Openhab so don’t encounter any port conflicts. If you have another system laying around that could solve all your issues)

When I start manually, no issues.

This code below is with deconz disabled, manually started with sudo systemctl start deconz

openhabian@openhabian:~ $ sudo systemctl cat deconz

/lib/systemd/system/deconz.service

[Unit]
Description=deCONZ: ZigBee gateway – REST API
Wants=deconz-init.service deconz-update.service
StartLimitIntervalSec=0

[Service]
User=1000
ExecStart=/usr/bin/deCONZ -platform minimal --http-port=8081
Restart=on-failure
RestartSec=30
AmbientCapabilities=CAP_NET_BIND_SERVICE CAP_KILL CAP_SYS_BOOT CAP_SYS_TIME

[Install]
WantedBy=multi-user.target

I ran deconz on synology in a docker container, but since it was part of openhabian i moved it to the openhab box, so there are no dependencies on the availability of my synology.

According to :

Changing the default port the “proper” way is by creating a deconz.overwrite

> Proper way to change the default port is to use a systemd overwrite in /etc/systemd/system based on copy from /usr/systemd/system/deconz-gui.service.

See both Links. Worth a shot?

Thanks! I’ll try the override and keep you posted. Thanks for the help.

I did a full system reinstall, but same issue comes right back. Whenever the configuration has been loaded on the stick port 8080 becomes blocked for openhab and deconz demands it back.

I’ll submit a ticket in openhabian github. @mstormi is that the best way?

Is there a possibilty to script it that when openhab has fully started the deconz service starts?

I didn’t follow this thread so cannot comment on your issue.
openHABian has a menu option to install deCONZ and that’s the only supported install method.
Copying over whatever is not. In openHABian install, deconz does not reclaim the openHAB port.
Please only open a Github issue when you have identified issues that are with the openHABian code. We’re not providing debugging or install support that way.

No problem for no comment.

In openHABian install, deconz does not reclaim the openHAB port.

In my setup that is exactly what happens.The OH port is claimed by deconz. I did a full clean reinstall and it comes back so I can reproduce it.

did you install strictly using openhabian-config only ?

Please investigate yourself how to start deconz so it does not occupy 8080 (play with the --ws-port option, too).

I think I have not seen an answer to my question about

If the content at both ports is different it will give an indication about which service to redirect to an other port.