openhab / openhabian

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

Fresh install not working : java: libjli.so (No such file or directory) #1652

Closed ozirissp closed 2 years ago

ozirissp commented 2 years ago

Issue information:

Corrupted openhabian (java error) just after a fresh install ...

Seems to be a Java Zulu update issue, I had the same issue on my previous install when I upgraded my system from openhabian-config ("02 | Upgrade System" ) ... I just restart a fresh install after the error on my working openhabian (was buster). Then I got the exact same error with the fresh install ...

Steps : 1) Fresh install of openhabian 1.7.1 (32bit) on RPI 4 4Go (64 Gb Micro SD Card) 2) Wait full installation & restart (no visible error during install process) 3) run : sudo openhabian-config -> 02 - Upgrade System

There was an error or interruption during the execution of: "02 | Upgrade System"

4) run : sudo openhab-cli status

A systemd service configuration exists...
Use 'sudo /bin/systemctl status openhab.service' to find the status of an openHAB service
openHAB is not running.

5) run : sudo openhab-cli start

Use 'sudo /bin/systemctl start openhab.service' to start an openHAB service
Launching an instance in this terminal..
Launching the openHAB runtime...
/usr/share/openhab/runtime/bin/karaf: 247: [: Illegal number:
/usr/share/openhab/runtime/bin/karaf: 247: [: Illegal number:
/usr/share/openhab/runtime/bin/karaf: 97: [: Illegal number:
/usr/share/openhab/runtime/bin/karaf: 300: [: Illegal number:
/usr/bin/java: error while loading shared libraries: libjli.so: cannot open shared object file: No such file or directory

System information:

Raspberry Pi 4 4Go - 64 Gb SD card - Openhabian 1.7.1 (32 bit)

ecdye commented 2 years ago

@mstormi We have two options, we can either forward main to openHAB3 and move forward with the Java switch now, or I will have to spend a lot of time figuring out what Azul changed in their latest release and why jli is not included as a binary in the same place where it used to be.

ecdye commented 2 years ago

@ozirissp What output does running java -version give? I'm not sure what is happening but I suspect that something about Azul's builds has changed and they just pushed an update that broke what was working.

stehof2 commented 2 years ago

I'm having the same issue, output:

openhabian@openhabian:~ $ java -version
java: error while loading shared libraries: libjli.so: cannot open shared object file: No such file or directory
davebuk commented 2 years ago

I get java: error while loading shared libraries: libjli.so: cannot open shared object file: No such file or directory

ecdye commented 2 years ago

Alright then what does ls -la /opt/jdk output?

stehof2 commented 2 years ago

For me:

openhabian@openhabian:~ $ ls -la /opt/jdk
total 12
drwxrwxr-x  3 root      root    4096 Jan 24 22:32 .
drwxrwxr-x  8 openhab   openhab 4096 Jan 21 13:44 ..
drwxrwxr-x 10 mosquitto     122 4096 Jan 14 15:31 zulu11.54.23-ca-jdk11.0.14-linux_aarch32sf

BTW, I also have a fresh install since Friday because of this issue on my previous system.

davebuk commented 2 years ago

Me:

openhabian@openhabian:~ $ ls -la /opt/jdk
total 16
drwxrwxr-x  4 root      root    4096 Jan 24 21:58 .
drwxrwxr-x  9 openhab   openhab 4096 Mar 21  2021 ..
drwxrwxr-x 10 mosquitto     122 4096 Oct  9 08:48 zulu11.52.13-ca-jdk11.0.13-linux_aarch32hf
drwxrwxr-x 10 mosquitto     122 4096 Jan 14 14:31 zulu11.54.23-ca-jdk11.0.14-linux_aarch32sf
ecdye commented 2 years ago

Issue found, Azul has broken their API and it is making the Soft Float version be downloaded and as such is causing all new installations to fail. Currently brainstorming an elegant fix.

davebuk commented 2 years ago

I guess its the same as: https://community.openhab.org/t/java-error-libjli-so-cannot-open-shared-object-file/98424/10?

ecdye commented 2 years ago

Temporary patch now live, please test and see if after updating openHABian config it now works.

stehof2 commented 2 years ago

I tried, and rebooted, but it's not working yet:

Jan 24 23:53:54 openhabian systemd[1]: openhab.service: Failed with result 'exit-code'.
Jan 24 23:53:59 openhabian systemd[1]: openhab.service: Scheduled restart job, restart counter is at 3.
Jan 24 23:53:59 openhabian systemd[1]: Stopped openHAB instance, reachable at http://openhabian:8080.
Jan 24 23:53:59 openhabian systemd[1]: Started openHAB instance, reachable at http://openhabian:8080.
Jan 24 23:54:00 openhabian karaf[979]: /usr/share/openhab/runtime/bin/karaf: 247: [: Illegal number:
Jan 24 23:54:00 openhabian karaf[979]: /usr/share/openhab/runtime/bin/karaf: 247: [: Illegal number:
Jan 24 23:54:00 openhabian karaf[979]: /usr/share/openhab/runtime/bin/karaf: 97: [: Illegal number:
Jan 24 23:54:00 openhabian karaf[979]: /usr/share/openhab/runtime/bin/karaf: 300: [: Illegal number:
Jan 24 23:54:00 openhabian karaf[979]: /usr/bin/java: error while loading shared libraries: libjli.so: cannot open shared object file: No such file or directory

This is after the update 02 option runs:

 There was an error or interruption during the execution of:                  │ 
                                         │   "02 | Upgrade System"  
davebuk commented 2 years ago

Same here. Openhabian updated, tried option 02, failed. Tried a reboot but still not working. Same issues as earlier.

ecdye commented 2 years ago

Working on it, sorry I didn't have a Zulu env available right away I've been testing our upcoming switch to Debians included java.

ecdye commented 2 years ago

I just made the executive decision to move forward with the migration to the Debian provided Java install. Try menu option 2 after updating openhabian-config and see if it installs a working Java version now.

@mstormi I went ahead and forwarded main to openHAB3, not ideal but had to get a fix up.

ecdye commented 2 years ago

Just validated, after the last commit, it is fully working on my end. Please let me know if it is not for you @davebuk @ozirissp @stehof2

davebuk commented 2 years ago

I'm still getting issues trying to update. I get the following error:

UPDATING
2022-01-24_23:29:53_GMT [openHABian] Updating myself... mv: cannot stat '/opt/openhabian/docs/NEWS.md': No such file or directory
OK - Commit history (oldest to newest):

I've tried fixing permissions but no change. I'll look again tomorrow.

Thanks for your help so far and hope it works for others.

stehof2 commented 2 years ago

Just validated, after the last commit, it is fully working on my end. Please let me know if it is not for you @davebuk @ozirissp @stehof2

Thanks a lot for your quick response and fix, everything is up and running again! :)

davebuk commented 2 years ago
openhabian@openhabian:/opt/openhabian/docs $ ls
CHANGELOG.md  openhabian-amanda.md  openhabian-exim.md
images        openhabian-DEBUG.md   openhabian.md

If that helps?

davebuk commented 2 years ago

Last night, from the Openhabian fix version I did run option '45' to update to OpenJDK11. It didn't seem to do anything so I left it. This morning everything is working again!

I did choose to 'STOP SHOWING' the news message at the Openhabian start screen which added the NEWS.md file. Maybe that helped?

sudo journalctl -u openhab -b gives no errors and

java -version gives:

openjdk version "11.0.12" 2021-07-20
OpenJDK Runtime Environment (build 11.0.12+7-post-Raspbian-2deb10u1)
OpenJDK Server VM (build 11.0.12+7-post-Raspbian-2deb10u1, mixed mode)

The only error left was: N: Ignoring file 'openhab.liste' in directory '/etc/apt/sources.list.d/' as it has an invalid filename extension

I removed the .LISTE file and it all seems happy.

Well done and thanks for the quick fix.

ozirissp commented 2 years ago

@ecdye I just update openhabian-config and run Upgrade, everything seems to work now ! 👍 quick and functional update, great work. Thx a lot.

We can close the issue

mstormi commented 2 years ago

@ecdye haven't validated yet but there's reports of new installs still trying to install Zulu. Eventually the current image still uses that (because of offline install etc to not have the recent changes included) ?

mstormi commented 2 years ago

Apparently so my test install failed at Java stage. Let's build another image.

mstormi commented 2 years ago

I've released your build #803 as 1.7.2. My preliminary testing showed it's installing OpenJDK fine. Please cross-check.

PS lemme know at times how to forward existing assets for release without a need to down/reupload them first, that didn't work for me here

ecdye commented 2 years ago

All you need to do for an image release is tag it on the main branch in a semver style (ie 1.7.2) then it will create a template release for you to edit and publish.

mstormi commented 2 years ago

I tagged it on openHAB3 branch that's then possibly why it didn't work. Positive feedback on v1.7.2 https://community.openhab.org/t/zulu-java-11-32-installation-fails-during-clean-installation-openhabian-v1-7-1-on-rpi4-solved-with-openhabian-v1-7-2/132461/4