Openhab doesn't start (karaf error) - java path problem?

  • Platform information:
    • Hardware: beaglebone black, 512MB RAM, SD
    • OS: debian 11.7 iot
    • Java Runtime Environment: zulu17.46.19-ca-hl-jre17.0.9-linux_aarch32hf.tar.gz
    • openHAB version: 4.1 stable

I have extracted zulu to /opt/zulu17_jre
I did:

sudo update-alternatives --install /usr/bin/java java /opt/zulu17_jre/bin/java 1

and I have installed openhab by

sudo apt-get install openhab

Try to start the openhab service ends up:

debian@BeagleBone:/etc/alternatives$ sudo journalctl -xe
░░ the configured Restart= setting for the unit.
Jan 10 13:58:53 BeagleBone systemd[1]: Stopped openHAB - empowering the smart home.
░░ Subject: A stop job for unit openhab.service has finished
░░ Defined-By: systemd
░░ Support: https://www.debian.org/support
░░ 
░░ A stop job for unit openhab.service has finished.
░░ 
░░ The job identifier is 1728 and the job result is done.
Jan 10 13:58:53 BeagleBone systemd[1]: Started openHAB - empowering the smart home.
░░ Subject: A start job for unit openhab.service has finished successfully
░░ Defined-By: systemd
░░ Support: https://www.debian.org/support
░░ 
░░ A start job for unit openhab.service has finished successfully.
░░ 
░░ The job identifier is 1728.
Jan 10 13:58:53 BeagleBone karaf[1523]: /usr/share/openhab/runtime/bin/karaf: 1: basename: not found
Jan 10 13:58:53 BeagleBone karaf[1525]: /usr/share/openhab/runtime/bin/karaf: 1: dirname: not found
Jan 10 13:58:53 BeagleBone karaf[1527]: /usr/share/openhab/runtime/bin/karaf: 1: ls: not found
Jan 10 13:58:53 BeagleBone karaf[1530]: /usr/share/openhab/runtime/bin/karaf: 1: dirname: not found
Jan 10 13:58:53 BeagleBone karaf[1531]: /usr/share/openhab/runtime/bin/karaf: 1: basename: not found
Jan 10 13:58:53 BeagleBone karaf[1519]: /usr/share/openhab/runtime/bin/karaf: 67: .: cannot open /inc: No such file
Jan 10 13:58:53 BeagleBone systemd[1]: openhab.service: Main process exited, code=exited, status=2/INVALIDARGUMENT
░░ Subject: Unit process exited
░░ Defined-By: systemd
░░ Support: https://www.debian.org/support
░░ 
░░ An ExecStart= process belonging to unit openhab.service has exited.
░░ 
░░ The process' exit code is 'exited' and its exit status is 2.
Jan 10 13:58:53 BeagleBone systemd[1]: openhab.service: Failed with result 'exit-code'.
░░ Subject: Unit failed
░░ Defined-By: systemd
░░ Support: https://www.debian.org/support
░░ 
░░ The unit openhab.service has entered the 'failed' state with result 'exit-code'.
Jan 10 13:58:54 BeagleBone sudo[1532]:   debian : TTY=pts/0 ; PWD=/etc/alternatives ; USER=root ; COMMAND=/bin/journalctl -xe
Jan 10 13:58:54 BeagleBone sudo[1532]: pam_unix(sudo:session): session opened for user root(uid=0) by debian(uid=1000)

Nach oben

Bad luck there is not much details about how to “install” java out of a tar.gz.
I am not sure whether (and where exactly) I have to set variables like (JAVA_HOME, PATH) - I have tried different things but with no result. Or am I on a complete wrong track?
Can you help?

I can’t help with the JAVA_HOME as I’m unfamiliar with Debian IOT. However, OH is almost certainly not going to run with anything like acceptable performance on a machine with only 512 MB RAM. Even on RPi 3s with 1 GB RAM many users are running into trouble.

I mean it seems to find Java. No complains while installing openHAB. But what about this strange errors with basename, dirname … No idea about what karaf is doing at all.

Sure, 512MB is less. But it was running well with openHAB 3.x. Sometimes bit slow in display things but overall acceptable. But right, this is not award winning performance :wink:

OH startup uses a bunch of scripts to set itself up before ti starts running. Those scripts assume a POSIX environment. I’m guessing that Debian IOT doesn’t provide this. basename, dirname, ls are all commands that are assumed to be there with a POSIX environment.

So there is something that is making OH no be able to access these commands perhaps (path?).

OH 4, or more correctly stated, Java 17, requires significantly more RAM than OH 3/Java 11. What was merely acceptable in OH 3 is likely to be all but non-functional for OH 4.

Ok, thanks for the hint. Likely go back to openHAB3 than.
But basename, dirname commands are known. Weird. Well, I go for the manual as described here:

Option 2: Install the APT Packages

About the JAVA installation there are not much details. An arm32hf deb is not available so you need to untar a tar.gz. I am not sure WHERE exactly to set PATH, I mean is it required at all with this alternate install? But that is (as far as I see only the java binary, not sure how it finds its libs…)

JRE headless is sufficient, right? No JDK needed? Description is not detailled enough.

What ever is running OH need to have $JAVA_HOME defined that points to the root directory of the Java install. And the java command needs to be in the path. And apparently basename, dirname, and ls (perhaps others) need to be in the path (most everything is usually in /usr/bin).

Should be.

I finally get it working but as mentioned I need to go back to openHAB3. The Java17 that is required for 4 needs more RAM than my little outdated 512MB board provide.