I freshly installed Java and OpenHab 3 according to the instructions here. I used the “Apt Based Systems” section to install the stable build. When using the systemctl commands to start the openhab service and check the status, I get this feedback:
● openhab.service - openHAB - empowering the smart home
Loaded: loaded (/lib/systemd/system/openhab.service; enabled; vendor preset: enabled)
Active: failed (Result: exit-code) since Tue 2021-11-09 23:35:07 EST; 2s ago
Docs: https://www.openhab.org/docs/
https://community.openhab.org
Process: 735883 ExecStart=/usr/share/openhab/runtime/bin/karaf ${OPENHAB_STARTMODE} (code=exited, status=143)
Process: 735929 ExecStop=/usr/share/openhab/runtime/bin/karaf stop (code=exited, status=1/FAILURE)
Main PID: 735883 (code=exited, status=143)
Nov 09 23:35:06 steve-studio1747 systemd[1]: Started openHAB - empowering the smart home.
Nov 09 23:35:06 steve-studio1747 systemd[1]: Stopping openHAB - empowering the smart home...
Nov 09 23:35:07 steve-studio1747 karaf[736183]: Can't connect to the container. The container is not running.
Nov 09 23:35:07 steve-studio1747 systemd[1]: openhab.service: Control process exited, code=exited, status=1/FAILURE
Nov 09 23:35:07 steve-studio1747 systemd[1]: openhab.service: Failed with result 'exit-code'.
Nov 09 23:35:07 steve-studio1747 systemd[1]: Stopped openHAB - empowering the smart home.
I’m not using docker and indeed it’s not even installed, so I’m not sure where the “can’t connect to container” is coming from. All the searching I’ve done has returned results about issues running OH in docker or using the incorrect version of Java, but I believe 11 is the preferred version of Java for OH3. Any other ideas?
“Container” is a generic and overloaded term. In this case Karaf is an OSGi server and the “bundles” that Karaf runs that make up openHAB are in OSGi containers. It has nothing to do with Docker.
This error implies that something is wrong with the install and/or karaf configuration. More information should be in openhab.log as Wolfgang_S suggests.
Log entries are being created, though they aren’t themselves helpful:
$ cat /var/log/openhab/openhab.log
2021-11-07 23:49:09.743 [INFO ] [org.openhab.ui.internal.UIService ] - Started UI on port 8080
2021-11-07 23:49:14.790 [INFO ] [.core.model.lsp.internal.ModelServer] - Started Language Server Protocol (LSP) service on port 5007
2021-11-07 23:49:19.421 [INFO ] [e.automation.internal.RuleEngineImpl] - Rule engine started.
2021-11-07 23:49:21.891 [INFO ] [ab.ui.habpanel.internal.HABPanelTile] - Started HABPanel at /habpanel
2021-11-07 23:50:08.302 [INFO ] [ab.ui.habpanel.internal.HABPanelTile] - Stopped HABPanel
2021-11-07 23:50:08.334 [INFO ] [basic.internal.servlet.WebAppServlet] - Stopped Basic UI
2021-11-07 23:50:08.361 [INFO ] [org.openhab.ui.internal.UIService ] - Stopped UI
Thanks for suggesting the journalctl, I had not thought to look there. I’m seeing a few errors from Karaf related to permissions, such as
Nov 09 16:49:58 steve-studio1747 karaf[994]: java.io.FileNotFoundException: /var/lib/openhab/tmp/karaf.pid (Permission denied)
That’s a hopeful lead. Since I installed through APT and I have a fairly vanilla OS installation, I’m not really sure what to make of that. I’ll take a look around, but if you have any ideas before I return feel free to share
I don’t know how but obviously some permissions were screwed up. I read that openhab-cli has tools built in for such a situation. I haven’t done anything with my installation yet so I didn’t bother backing up, though any other readers who have a similar problem should back up their configuration. I solved it thusly:
EDIT:
I spoke too soon; I don’t think those commands did anything at all. What I’ve noticed is that if I run sudo openhab-cli start
then the instance starts in my terminal just fine. This is why I thought I had solved the above problem. However, if I run sudo systemctl start openhab.service
then I get the same behavior from my original post. I guess systemd is using the wrong permissions or something weird?
No, I fixed permissions and then ran sudo open-cli start according to the tutorial and the help I found online…let me start over and try using systemctl instead of open-cli.
EDIT:
Yeah that appears to work. Weird but good to know. Running openhab through systemctl first instead of manually with the CLI is working with no permission issues.