Deconz and openhab UI fight a fight deconz wins

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.

The content is indeed different: on port 8081 I get the phoscon web-ui, on port 8080 i get an error, the same error as when openhab-service has been stopped.

Is that the answer to your question?

Strictly openhabian-config. The only thing I change is for mqtt I add

“listener 1883
allow_anonymous true”
to the config.

For the rest it is pure openhabian, latest image.
I’ll try the --ws-port too, i’ll go search where I can change that. I already tried to change the --http-port=80 in deconz-gui.service in /lib/systemd/system/deconz-gui.service to --http-port=8082 but to no avail…

Never head of this option before, but that was the trick. Adding the –ws-port=8081 in deconz.service did the trick. Both webinterfaces come online, and both work without issues for now.

[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 –ws-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

2 Likes