Straightforward openHab3 install but won't start

  • Platform information:
    • Hardware:
      • CPU: Intel Core i7 720QM
      • Architecture: x86_64
      • RAM: 4GB
      • Storage: 256GB
    • OS: Ubuntu 20.04.3
    • Java Runtime Environment: openjdk 11.0.13 2021-10-19 LTS
    • openHAB version: 3.1.0 (Build)

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
    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?

  • that is Zulu openjdk ?
  • are log entries in /var/log/openhab.log being created ?
  • are there any hints about the root cause returned by: sudo journalctl -u openhab -b

“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.

1 Like

Yes that is Zulu jdk.

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]: /var/lib/openhab/tmp/ (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 :slight_smile:

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:

openhab-cli stop
openhab-cli clean-cache
openhab-cli reset-ownership
openhab-cli start

I had to use sudo to run these.

Thanks for the help everyone!

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?

systemd uses user / group openhab:




But what does

sudo openhab-cli start

use …?

Did you fix the permissions and right after that tried to run systemctl command ?

1 Like

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.


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.

To reiterate, those commands are

openhab-cli stop
openhab-cli clean-cache
openhab-cli reset-ownership
systemctl start openhab.service
1 Like

reason is:

  • systemctl switches user privilges to user openhab:openhab and creates files with this user’s permissions
  • openhab-cli uses root privileges and creates files with root user’s permissions