Openhab2.service - openHAB 2 - empowering the smart home

Hello,
I have been running openHAB 2.5.0-1 (Release Build) on a Raspberry for some time.

Release: Raspbian GNU / Linux 10 (buster)
Kernel: Linux 4.19.75-v7 +
Platform: Raspberry Pi 3 Model B Rev 1.2

However, OPENHAB has been down for a few days.
No more access to the RasPI. Tried everything. The RasPI can no longer be started from the micro SD. The SD card was also not readable by a normal PC. Micro SD was broken. I then used an older backup and was able to start the Raspberry with a new micro SD. The startup process shows no problems. But there is a problem with the openhab2.service. OpenHAB cannot be activated, see the following error:

[21:20:24] openhabian@openhab:~$ sudo systemctl status openhab2.service
openhab2.service - openHAB 2 - empowering the smart home
Loaded: loaded (/usr/lib/systemd/system/openhab2.service; enabled; vendor preset: enabled)
Active: activating (auto-restart) (Result: exit-code) since Wed 2020-10-21 21:26:57 CEST; 267ms ago
Docs: https://www.openhab.org/docs/
https://community.openhab.org
Process: 6536 ExecStart=/usr/share/openhab2/runtime/bin/karaf ${OPENHAB_STARTMODE} (code=exited, status=2)
Main PID: 6536 (code=exited, status=2)

Openhab Service remains constantly in the status: activating (auto-restart)
I did some browsing in the forum and started a query that contained the following errors:

sudo journalctl -u openhab2.service -b
[sudo] password for openhabian:
Oct 20 20:25:32 openhab karaf[1362]: Error: could not find libjava.so
Oct 20 20:25:32 openhab karaf[1362]: Error: Could not find Java SE Runtime Environment.
Oct 20 20:25:32 openhab systemd[1]: openhab2.service: Main process exited, code=exited, status=2/INVALIDARGUMENT
Oct 20 20:25:32 openhab systemd[1]: openhab2.service: Failed with result ‘exit-code’.
Oct 20 20:25:37 openhab systemd[1]: openhab2.service: Service RestartSec=5s expired, scheduling restart.
Oct 20 20:25:37 openhab systemd[1]: openhab2.service: Scheduled restart job, restart counter is at 5.
Oct 20 20:25:37 openhab systemd[1]: Stopped openHAB 2 - empowering the smart home.
Oct 20 20:25:37 openhab systemd[1]: Started openHAB 2 - empowering the smart home.
Oct 20 20:25:38 openhab karaf[1434]: /usr/share/openhab2/runtime/bin/karaf: 247: [: Illegal number:
Oct 20 20:25:38 openhab karaf[1434]: /usr/share/openhab2/runtime/bin/karaf: 247: [: Illegal number:
Oct 20 20:25:38 openhab karaf[1434]: /usr/share/openhab2/runtime/bin/karaf: 95: [: Illegal number:
Oct 20 20:25:38 openhab karaf[1434]: /usr/share/openhab2/runtime/bin/karaf: 296: [: Illegal number:
Oct 20 20:25:38 openhab karaf[1434]: Error: could not find libjava.so
Oct 20 20:25:38 openhab karaf[1434]: Error: Could not find Java SE Runtime Environment.
Oct 20 20:25:38 openhab systemd[1]: openhab2.service: Main process exited, code=exited, status=2/INVALIDARGUMENT
Oct 20 20:25:38 openhab systemd[1]: openhab2.service: Failed with result ‘exit-code’.
Oct 20 20:25:43 openhab systemd[1]: openhab2.service: Service RestartSec=5s expired, scheduling restart.
Oct 20 20:25:43 openhab systemd[1]: openhab2.service: Scheduled restart job, restart counter is at 6.
Oct 20 20:25:43 openhab systemd[1]: Stopped openHAB 2 - empowering the smart home.
Oct 20 20:25:43 openhab systemd[1]: Started openHAB 2 - empowering the smart home.
Oct 20 20:25:43 openhab karaf[1507]: /usr/share/openhab2/runtime/bin/karaf: 247: [: Illegal number:

Then I tried to determine the Java version, but there is another error.
Apparently Java is missing here or parts of it. Can’t explain to me why this error exists despite the backup.

[21:44:23] openhabian@openhab:~$ sudo java -version
[sudo] password for openhabian:
Error: could not find libjava.so
Error: Could not find Java SE Runtime Environment.

Does anyone have any advice, need help with the problem.

Thanks in advance!

Try to clear the cache.
But I’d reinstall from scratch. Use openhab-cli to backup your config, install the openHABian image to a new SD card and import your config.

Thanks for your quick reply
Resetting the cache didn’t help. Same problem.

[23:23:27] openhabian@openhab:~$ sudo openhab-cli start

A systemd service configuration exists…
Use ‘sudo /bin/systemctl start openhab2.service’ to start an openHAB service
Launching an instance in this terminal…
Launching the openHAB runtime…
/usr/share/openhab2/runtime/bin/karaf: 247: [: Illegal number:
/usr/share/openhab2/runtime/bin/karaf: 247: [: Illegal number:
/usr/share/openhab2/runtime/bin/karaf: 95: [: Illegal number:
/usr/share/openhab2/runtime/bin/karaf: 296: [: Illegal number:
Error: could not find libjava.so
Error: Could not find Java SE Runtime Environment.
[23:23:42] openhabian@openhab:~$

I made a backup of the configuration files. Three questions about this:

  1. Can I install on a higher OPENHAB version and use the old configuration files?
  2. Can I simply implement the created zip file with:
    sudo openhab-cli restore openhab2-backup-20_10_21-23_14_47.zip
  3. Is the storage location of the backup files mandatory for the restore?
    Backup made in / var / lib / openhab2 / backups / openhab2-backup-
    20_10_21-23_14_47.zip

yes

of course, why do you ask?

no unless you want to use the openhabian menu to restore

From these error messages it looks like Java is not installed, cannot be found or is partially broken.
Do you remember how ( distribution package, openhabian-menu, zip-file, … ) you installed Java ?

Because I have never used this function and I wasn’t sure whether the backup file had to be extracted first.

No unfortunately not, that was autom. installed during the installation of openhabian.
Is it possible to install this afterwards?

Menu entry 45 in openhabian-config offers the possibility to install java.

Unfortunately, the installation of the Java versions failed. Means further analysis of the problem with the help of the information from https://github.com/openhab/openhabian/blob/master/docs/openhabian-DEBUG.md
I will get in touch as soon as there is something new.

1 Like

I did a complete new Installation to openHAB 3 Milistone version. Now i have to do some Adjustments to the configuration. Thx for your help