Can't change port using /etc/default/openhab in Ubuntu apt installation

  • Platform information:
    • Hardware: Intel, 2GB
    • OS: Ubuntu 20 LTS
    • Java Runtime Environment: Java 11
    • openHAB version: 3.0 (migrated from apt install of openhab2)


I’ve tried changing the OPENHAB_HTTP_PORT and OPENHAB_HTTPS_PORT in the file /etc/default/openhab by uncommenting them and changing the port number away from the default as described in the docs. I also restart the openhab service, and even reboot. With non-default ports set, the web server does not come up on any ports. Also, I see that the environmental variables are still set to the default as determined by printenv OPENHAB_HTTP_PORT.

I think that there must be an obvious explanation for why the config file is not being expressed in the environmental variables. If I fix that, I suspect the web server will bind to my desired ports. Any ideas what would cause the config file to not be expressed in the environmental variables?

Thanks for any help!

Do you use / have this file: ${OPENHAB_CONF}/linux.parameters ?
Environment variables defined in linux.parameters can override the content of variables defined in /etc/default/openhab.
On the other hand even in case linux.parameters would differ from /detc/default/openhab you should see the result in the users environment as well as in the service.

Thanks for your help!

I just checked and on my system that path becomes /etc/openhab/linux.parameters and the file doesn’t exist.

I did not check may be it is possible to set a debug variable and run the startup in console mode to get output from every script but I would assume that this might be too much output.
You could add debug code that e.g. writes the content of the variables to a file.
The read permission of the file /etc/default/openhab is ok, too ?

I did a check here in my environment on a debian 10 system and that works.
The only thing that I am wondering why it happens is that when I have a look at the status message of

 systemctl status openhab.service

it reports that the service would listen on port 8080 although the service runs on port 8000 which I can see by having a look to netstat as well as to

ps -ef | grep java

systemctl status openhab.service has this line, but there’s no open port there: