openhab / openhabian

openHABian - empowering the smart home, for Raspberry Pi and Debian systems
https://community.openhab.org/t/13379
ISC License
820 stars 252 forks source link

openhab doesn't start because Java #874

Closed Davidoff77test closed 4 years ago

Davidoff77test commented 4 years ago

I've tried fresh install of openhabian on Rpi4. And during upgrade I get message java: error while loading shared libraries: libjli.so: cannot open shared object file: No such file or directory The same one I get when I try to find out java version with java -version.

mstormi commented 4 years ago

Did you use the image ? What do you mean by "during upgrade" - is it a fresh install or not ? what did you do in order to "upgrade" ? Can you try to reinstall java via openhabian-config menu 63 and send the output of ldd `which java`

@ecdye: FYI

inis1981 commented 4 years ago

I'm having this same issue, after upgrading to 2.5.3 openhabian, i can not go into openhab-cli console due to this error. Also none of my gui's are loading.

abissoli commented 4 years ago

Hi, same problem here. Launched openhabian-config menu "02 Upgrade System" and this is the output:

2020-05-08_22:20:53_CEST [openHABian] Checking for root privileges... OK Hit:1 http://raspbian.raspberrypi.org/raspbian buster InRelease Get:2 http://archive.raspberrypi.org/debian buster InRelease [25.2 kB] Ign:3 https://dl.bintray.com/openhab/apt-repo2 stable InRelease
Get:4 https://dl.bintray.com/openhab/apt-repo2 stable Release [6,051 B] Get:5 http://archive.raspberrypi.org/debian buster/main armhf Packages [327 kB] Fetched 358 kB in 2s (220 kB/s)
Reading package lists... Done 2020-05-08_22:21:00_CEST [openHABian] Loading configuration file '/etc/openhabian.conf'... OK 2020-05-08_22:21:00_CEST [openHABian] openHABian configuration tool version: [master]v1.5-591(9f09846) 2020-05-08_22:21:02_CEST [openHABian] Checking for changes in origin... OK 2020-05-08_22:21:12_CEST [openHABian] Updating repositories and upgrading installed packages... $ apt-get --yes upgrade Reading package lists... Done Building dependency tree
Reading state information... Done Calculating upgrade... Done The following packages have been kept back: binutils binutils-arm-linux-gnueabihf binutils-common libbinutils 0 upgraded, 0 newly installed, 0 to remove and 4 not upgraded.

$ java_install_or_update
openjdk version "1.8.0_242" OpenJDK Runtime Environment (Zulu8.44.0.213-CA-linux_aarch32hf) (build 1.8.0_242-b213) OpenJDK Client VM (Zulu8.44.0.213-CA-linux_aarch32hf) (build 25.242-b213, mixed mode, Evaluation)

$ systemctl stop openhab2.service 2020-05-08_22:21:32_CEST [openHABian] Installing Java Zulu 32-Bit OpenJDK... $ wget -nv -O /tmp/openhabian.jpcul/zulu8.tar.gz https://cdn.azul.com/zulu-embedded/bin/zulu8.46.0.225-ca-jdk8.0.252-linux_aarch32sf.tar.gz 2020-05-08 22:22:06 URL:https://cdn.azul.com/zulu-embedded/bin/zulu8.46.0.225-ca-jdk8.0.252-linux_aarch32sf.tar.gz [176741810/176741810] -> "/tmp/openhabian.jpcul/zulu8.tar.gz" [1]

$ update-alternatives --remove-all java update-alternatives: warning: alternative /opt/jdk/zulu8.44.0.213-ca-jdk1.8.0_242-linux_aarch32hf/bin/java (part of link group java) doesn't exist; removing from list of alternatives update-alternatives: warning: /etc/alternatives/java is dangling; it will be updated with best choice

$ update-alternatives --remove-all javac update-alternatives: error: no alternatives for javac

$ update-alternatives --install /usr/bin/java java /opt/jdk/zulu8.46.0.225-ca-jdk8.0.252-linux_aarch32sf/bin/java 1083000 update-alternatives: using /opt/jdk/zulu8.46.0.225-ca-jdk8.0.252-linux_aarch32sf/bin/java to provide /usr/bin/java (java) in auto mode

$ java_zulu_install_crypto_extension

$ wget -nv -O /tmp/openhabian.P00tR/crypto.zip https://cdn.azul.com/zcek/bin/ZuluJCEPolicies.zip 2020-05-08 22:22:35 URL:https://cdn.azul.com/zcek/bin/ZuluJCEPolicies.zip [12181/12181] -> "/tmp/openhabian.P00tR/crypto.zip" [1]

$ unzip /tmp/openhabian.P00tR/crypto.zip -d /tmp/openhabian.P00tR Archive: /tmp/openhabian.P00tR/crypto.zip creating: /tmp/openhabian.P00tR/ZuluJCEPolicies/ inflating: /tmp/openhabian.P00tR/ZuluJCEPolicies/LICENSE
inflating: /tmp/openhabian.P00tR/ZuluJCEPolicies/README.txt
inflating: /tmp/openhabian.P00tR/ZuluJCEPolicies/DISCLAIMER
inflating: /tmp/openhabian.P00tR/ZuluJCEPolicies/local_policy.jar
inflating: /tmp/openhabian.P00tR/ZuluJCEPolicies/US_export_policy.jar
OK

$ systemctl start openhab2.service OK 2020-05-08_22:22:56_CEST [openHABian] Checking for default openHABian username:password combination... OK 2020-05-08_22:22:56_CEST [openHABian] We hope you got what you came for! See you again soon ;) [22:22:56] 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 Fri 2020-05-08 22:23:08 CEST; 4s ago Docs: https://www.openhab.org/docs/ https://community.openhab.org Process: 2544 ExecStart=/usr/share/openhab2/runtime/bin/karaf ${OPENHAB_STARTMODE} (code=exited, status=127) Main PID: 2544 (code=exited, status=127)

jteich commented 4 years ago

Running java under strace, I can see it find the libjli.so library file but ignoring the it for some reason. I am pretty sure that the libjli.so file isn’t being built correctly (at least for the Raspbian/ openhabian version). I tried this will more than one version of zulu as available here: https://www.azul.com/downloads/zulu-community/?version=java-8-lts&architecture=arm-32-bit-sf&package=jdk&show-old-builds=true

openat(AT_FDCWD, “/opt/jdk/zulu8.46.0.225-ca-jdk8.0.252->linux_aarch32sf/bin/…/lib/aarch32/jli/libjli.so”, O_RDONLY|O_LARGEFILE|O_CLOEXEC) = 3
read(3, “\177ELF\1\1\1\0\0\0\0\0\0\0\0\0\3\0(\0\1\0\0\0\354\30\0\0004\0\0\0”…, 512) = 512
close(3) = 0
openat(AT_FDCWD, “/opt/jdk/zulu8.46.0.225-ca-jdk8.0.252-linux_aarch32sf/bin/…/lib/aarch32/libjli.so”, O_RDONLY|O_LARGEFILE|O_CLOEXEC) = -1 ENOENT (No such file or directory)
mstormi commented 4 years ago

Looks like Azul screw up the Zulu Java package. For the time being, your best bet is to manually download and install an older version from their website.

holgerfriedrich commented 4 years ago

@mstormi I don't think it is broken. @jteich just said that he tried even the older releases.... Did we somehow mess up which architecture to grab?! Which package would the old installer with the hardcoded download URL have used?

mstormi commented 4 years ago

https://cdn.azul.com/zulu-embedded/bin/zulu8.40.0.178-ca-jdk1.8.0_222-linux_aarch32hf.tar.gz

I don't think it's about architectures. It downloads the proper architecture file.

But we should analyse this before using the static file as a "fix".

mstormi commented 4 years ago

Why the heck is the jdk owned grafana:mosquitto (on my test box) ???

mstormi commented 4 years ago

Yes something's wrong with architectures: it installed ...aarch32sf not ...hf

holgerfriedrich commented 4 years ago

Did you notice aarch32sf vs aarch32hf?

mstormi commented 4 years ago

hmm I don't know the Azul API. It seems to give me an aarch32sf file and I have not found an option to request a hf one. I think it's safest to revert to the static file for now then let's dissect that Zulu API behavior

mstormi commented 4 years ago

curl -H "Accept: application/json" "https://api.azul.com/zulu/download/community/v1.0/bundles/?jdk_version=8&ext=tar.gz&os=linux&arch=arm&hw_bitness=32" gives a couples of bundles, hf first but also sf. Don't know which of them is selected, haven't gotten down to the bottom of this yet @ecdye ?

mstormi commented 4 years ago

I just merged #877

All, please restart openhabian-config, answer yes on update, and try 02 Upgrade again.

Let me know if that helps.

ACJUK commented 4 years ago

Yay! Looks like things are coming back online. Well done, and thank you. Ironically installed OpenHAB a day or 2 ago due to stability problems with SmartThings and have just moved about 40 devices over.

:)

Haven't tested fully but it definitely looks encouraging.

mstormi commented 4 years ago

It's an Azul issue. Not the first time they change their download API without prior notice. Pretty annoying... we're looking into alternative Java providers.

mstormi commented 4 years ago

Ironically installed OpenHAB a day or 2 ago due to stability problems

Well once up it'll run stable :)

ACJUK commented 4 years ago

Just part of the fun when playing with this sort of thing :)

Thanks again!

ecdye commented 4 years ago

Sorry @mstormi I was busy this afternoon, I'm looking into it right now.

ecdye commented 4 years ago

Quick summary of what happened from first glance, Azuls API is very variable and does not allow specifying the hf or sf option in the query. As such it just return whichever one it has available first. Their API is slow to update and must only have sf build in it right now and not the hf build. However the hf build exists just their API is trash.

TLDR; This likely will happen every time that Azul pushes updates to their API because of how slow it is to update (particularly ARM builds) therefore leave @mstormi patch in place for now to ensure it does not pull a sf build.

This is on Azul not us. We'll have to wait for an updated API from Azul for this to be resolved. I'll see if I can reach out to them and get a fix implemented.

ecdye commented 4 years ago

@mstormi I am querying the latest bundle, however you did not that is why there was a list of several bundles. Because of this, it makes it so that we have not real control over the floatness of the binary returned. Hopefully, Azul will patch it.

inis1981 commented 4 years ago

I can confirm I'm up and working again.

inis1981 commented 4 years ago

Yay! Looks like things are coming back online. Well done, and thank you. Ironically installed OpenHAB a day or 2 ago due to stability problems with SmartThings and have just moved about 40 devices over.

:)

Haven't tested fully but it definitely looks encouraging.

This is my first issue in 3 years. You're in good hands.

abissoli commented 4 years ago

Up and running. Thanks.

Davidoff77test commented 4 years ago

Great, it works. Thx