Openhab does not start

  • Platform information:
    • Hardware: Raspberry Pi4
    • OS: Openhabian
    • Java Runtime Environment: as installed
    • openHAB version: 3.3.0
  • Issue of the topic:

Two days ago Openhab stopped working. I restarted the Rpi and found following message in daemon.log

Nov 17 06:20:10 openhabHost systemd[1]: Started openHAB - empowering the smart home.
Nov 17 06:20:10 openhabHost systemd[1]: Started Frontail openHAB instance, reachable at http://openhabHost:9001.
Nov 17 06:20:10 openhabHost karaf[11813]: /usr/share/openhab/runtime/bin/karaf: 247: [: Illegal number:
Nov 17 06:20:10 openhabHost karaf[11813]: /usr/share/openhab/runtime/bin/karaf: 247: [: Illegal number:
Nov 17 06:20:10 openhabHost karaf[11813]: /usr/share/openhab/runtime/bin/karaf: 97: [: Illegal number:
Nov 17 06:20:10 openhabHost karaf[11813]: /usr/share/openhab/runtime/bin/karaf: 300: [: Illegal number:
Nov 17 06:20:10 openhabHost karaf[11813]: -Djava.endorsed.dirs=/usr/lib/jvm/java-11-openjdk-armhf/jre/lib/endorsed:/usr/lib/jvm/java-11-openjdk-armhf/lib/endorsed:/usr/share/openhab/runtime/lib/endorsed is not supported. Endorsed standards and standalone APIs
Nov 17 06:20:10 openhabHost karaf[11813]: in modular form will be supported via the concept of upgradeable modules.
Nov 17 06:20:10 openhabHost karaf[11813]: Error: Could not create the Java Virtual Machine.
Nov 17 06:20:10 openhabHost karaf[11813]: Error: A fatal exception has occurred. Program will exit.
Nov 17 06:20:10 openhabHost systemd[1]: openhab.service: Main process exited, code=exited, status=1/FAILURE
Nov 17 06:20:10 openhabHost systemd[1]: openhab.service: Failed with result 'exit-code'.

A system update through openhab-config did not help, same error.

Any idea on how to solve this? I hope anybody can help - it is winter in Germany, no OH no heating :sweat_smile:

Max

The usual guess is a failing SD card. Do you have a backup that you can put on a new card?

Same error messages were displayed in an other case. In that one java was installed for the wrong archtitecture.
You just mentioned that openhab stoppped working two days ago.
Did you do any changes to the system before this happened like a system update using openhabian-config ?

What is the output of

java --version

Hi @Wolfgang_S

Thanks! I was not even at home :rofl:

Interesting output from the command

openhabian@openhabHost:~ $ java --version
Error occurred during initialization of VM
java/lang/ClassFormatError: Unknown constant tag 97 in class file java/lang/Throwable
openhabian@openhabHost:~ $ 

Any way to fix it?

Max

indeed - at least not as expected …

means no one did an update ? Then it could be a problem of the SD card as @rpwong mentioned.

What is the output of

ldd /usr/bin/java

and

readlink -f /usr/bin/java

and

dpkg -l |grep -i java

Reinstall (stock!) openHABian and import your old config.
And don’t mess with java this time (your java setup is non-standard).

@mstormi

I could do that, but how can you say I messed up my java setup?

I installed (stock!) OH/openhabian a few weeks ago, re-imported the old confs and made updates through openhabian-config.

Max

@Wolfgang_S

Moving in the right direction here

openhabian@openhabHost:~ $ ldd /usr/bin/java
        linux-vdso.so.1 (0xbefb7000)
        /usr/lib/arm-linux-gnueabihf/libarmmem-${PLATFORM}.so => /usr/lib/arm-linux-gnueabihf/libarmmem-v7l.so (0xb6f9c000)
        libjli.so => not found
        libc.so.6 => /lib/arm-linux-gnueabihf/libc.so.6 (0xb6e48000)
        /lib/ld-linux-armhf.so.3 (0xb6fb1000)
openhabian@openhabHost:~ $ readlink -f /usr/bin/java
/usr/lib/jvm/java-11-openjdk-armhf/bin/java
openhabian@openhabHost:~ $ dpkg -l |grep -i java
ii  ca-certificates-java                 20190909                         all          Common CA certificates (JKS keystore)
ii  java-common                          0.72                             all          Base package for Java runtimes
ii  javascript-common                    11+nmu1                          all          Base support for JavaScript library packages
ii  libjs-jquery                         3.5.1+dfsg+~3.5.5-7              all          JavaScript library for dynamic web applications
ii  libjs-sphinxdoc                      3.4.3-2                          all          JavaScript support for Sphinx documentation
ii  libjs-underscore                     1.9.1~dfsg-3                     all          JavaScript's functional programming helper library
ii  nodejs                               16.18.1-deb-1nodesource1         armhf        Node.js event-based server-side javascript engine
ii  openjdk-11-jre-headless:armhf        11.0.16+8-1~deb11u1              armhf        OpenJDK Java runtime, using Hotspot JIT (headless)
openhabian@openhabHost:~ $

I saw a few msg around libjli missing, but I am not sure if they are relevant for me, since all related to older OH versions…

Max

I compared your java options.

Ok, intestesting, I would not even know where to change them. :sweat_smile:

How could I have messed with them? Misuse of openhabian-config? Or when importing OH-2.5 configuration (through the restore option in openhabian-config)? Understanding that would avoid another post in the future :wink:

To be honest, I am quite used to Linux, but I am now a Java expert so I am quite blind on how OH works…

Max

Ok, I am not sure this can be a solution - but installing OpenJDK 17 (using openhabian-config) issues are gone and the system is back, up and running.

Is it OpenJDK 17 well supported? Can I stick with this configuration?

Thanks
Max

Nope.

Can I get somehow the OpenJDK 11 back to a std configuration w/o reinstalling the whole system? Perhaps I can learn something more around java :wink:

Moving back from 17 to 11 through Openhabian-config showed again the issue…

Max

Given noone knows what’s different on your system vs a standard one - no.
Sure you can try whatever you like to, but given a reinstall was recommended as the best (and fastest) solution, don’t expect anyone to help/guide you in that. That’s a time sink.

The library should be included in package openjdk-11-jre-headless
I just manually downloaded the package from the related repository.
It should be located under /usr/lib/jvm/java-11-openjdk-armhf/lib/jli/libjli.so

If not already done try to reinstall the openjdk-11-jre-headless package.

You also can check if and which version of that package are in the cache of your disk:

ls -l /var/cache/apt/archives/openjdk-11*

Ok, it seems I could find a workaround (or a solution?) to the issue.

Openhabian-config suggests to have OpenJDK-11 as default jre

While according to the installation guide (ok, Linux not Raspbian) Zulu is the preferred option.

So, I installed Zulu 11 OpenJDA 32-bit and everything seems to work as before :slightly_smiling_face:

Max

Well, this might be true for an installation w/o some tweaks like socat, etc… with additional scripts and services I need to create again from my documentation :wink:

I need to check btw why the SD copy did not work, this is supposed to work straight as swapped, right?