openhab / openhabian

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

Java 8 "forced downgrade" #1341

Closed mstormi closed 3 years ago

mstormi commented 3 years ago

There's some reports of Java being "downgraded" on OH3 installation

I just built a new image (hotspottest branch which is a copy of the current master branch) at it showed java_opt=Zulu8-32 in openhabian.conf

??? (not analyzed yet)

t09 commented 3 years ago

Hi, choosing 02 | Upgrade System reinstalls Java 8

Thanks for your work!

mstormi commented 3 years ago

I think the issue is when java_opt does not get set in openhabian.conf (that is only the case on oldish installation that did not have this in their config by the time the system was installed)

So the default taken from here applies: java_install_or_update "${java_opt:-Zulu8-32}"

I'll fix in 2 ways: First I'll set the default Java to Zulu11 also for OH2 (i.e. only master and stable branches). I think Java 11 has proven to be a safe choice also for OH2. Second I'll update openhabian.conf to contain all params as discussed in #1308

mstormi commented 3 years ago

Just did an apt upgrade (menu 02) on my dev box and it resulted in openHABian trying to install Java 8. It tried Java11-64 first but since I'm on a 32bit kernel it failed and the fallback apparently was Java 8.

@ecdye I think there's two issues here: 1) why did it try to go for the 64 bit version in the first place? 2) the last resort (hardcoded ?) is Java 8 and should be changed to Java11-32.

@ecdye as you've built that code could you please check ? Note system_upgrade() was called when I selected menu 02 so problems could hide in that routine

On #1:

[12:52:14] root@devpi:/home/openhabian# grep java /etc/openhabian.conf
java_opt=Zulu11-64

I never entered that, it's possibly a result of my config-redo patch. After I changed it to 11-32, upgrade (02) finished without trying to downgrade Java.

+ [[ 02 | Upgrade System == '' ]]
+ [[ 02 | Upgrade System == \0\0* ]]
+ [[ 02 | Upgrade System == \0\1* ]]
+ [[ 02 | Upgrade System == \0\2* ]]
+ wait_for_apt_to_finish_update
++ timestamp
++ date +%F_%T_%Z
+ echo -n '2020-12-31_12:42:04_CET [openHABian] Updating Linux package information... '
2020-12-31_12:42:04_CET [openHABian] Updating Linux package information... + [[ -z 19515 ]]
+ tail --pid=19515 -f /dev/null
+ echo OK
OK
+ system_upgrade
++ timestamp
++ date +%F_%T_%Z
+ echo -n '2020-12-31_12:42:04_CET [openHABian] Updating repositories and upgrading installed packages... '
2020-12-31_12:42:04_CET [openHABian] Updating repositories and upgrading installed packages... + cond_redirect apt-get upgrade --yes
+ [[ -n '' ]]
+ echo -e '\n\033[90;01m$ apt-get upgrade --yes \033[39;49;00m'

$ apt-get upgrade --yes
+ apt-get upgrade --yes
Paketlisten werden gelesen... Fertig
Abhängigkeitsbaum wird aufgebaut.
Statusinformationen werden eingelesen.... Fertig
Paketaktualisierung (Upgrade) wird berechnet... Fertig
Die folgenden Pakete werden aktualisiert (Upgrade):
  python-apt-common python3-apt tzdata
3 aktualisiert, 0 neu installiert, 0 zu entfernen und 0 nicht aktualisiert.
Es müssen 530 kB an Archiven heruntergeladen werden.
Nach dieser Operation werden 1.024 B Plattenplatz zusätzlich benutzt.
Holen:1 http://ftp.halifax.rwth-aachen.de/raspbian/raspbian buster/main armhf tzdata all 2020e-0+deb10u1 [266 kB]
Holen:2 http://mirror.netzwerge.de/raspbian/raspbian buster/main armhf python-apt-common all 1.8.4.3 [96,3 kB]
Holen:3 http://ftp.halifax.rwth-aachen.de/raspbian/raspbian buster/main armhf python3-apt armhf 1.8.4.3 [168 kB]
Es wurden 530 kB in 1 s geholt (1.023 kB/s).
apt-listchanges: Changelogs werden gelesen...
Vorkonfiguration der Pakete ...
(Lese Datenbank ... 127377 Dateien und Verzeichnisse sind derzeit installiert.)
Vorbereitung zum Entpacken von .../tzdata_2020e-0+deb10u1_all.deb ...
Entpacken von tzdata (2020e-0+deb10u1) über (2020d-0+deb10u1) ...
Vorbereitung zum Entpacken von .../python-apt-common_1.8.4.3_all.deb ...
Entpacken von python-apt-common (1.8.4.3) über (1.8.4.2) ...
Vorbereitung zum Entpacken von .../python3-apt_1.8.4.3_armhf.deb ...
Entpacken von python3-apt (1.8.4.3) über (1.8.4.2) ...
tzdata (2020e-0+deb10u1) wird eingerichtet ...

Current default time zone: 'Europe/Berlin'
Local time is now:      Thu Dec 31 12:42:20 CET 2020.
Universal Time is now:  Thu Dec 31 11:42:20 UTC 2020.
Run 'dpkg-reconfigure tzdata' if you wish to change it.

python-apt-common (1.8.4.3) wird eingerichtet ...
python3-apt (1.8.4.3) wird eingerichtet ...
Updating FireMotD available updates count ...
+ return 0
+ cond_redirect java_install_or_update Zulu11-64
+ [[ -n '' ]]
+ echo -e '\n\033[90;01m$ java_install_or_update Zulu11-64 \033[39;49;00m'
$ java_install_or_update Zulu11-64
+ java_install_or_update Zulu11-64
+ local branch
++ git -C /opt/openhabian rev-parse --abbrev-ref HEAD
+ branch=openHAB3
++ command -v java
+ [[ -x /usr/bin/java ]]
++ java -version
+ [[ openjdk version "11.0.9" 2020-10-20 LTS
OpenJDK Runtime Environment Zulu11.43+88-CA (build 11.0.9+11-LTS)
OpenJDK Client VM Zulu11.43+88-CA (build 11.0.9+11-LTS, mixed mode) == *\Z\u\l\u* ]]
++ command -v java
+ [[ -x /usr/bin/java ]]
+ [[ Zulu11-64 == \A\d\o\p\t\1\1 ]]
+ [[ Zulu11-64 != \A\d\o\p\t\1\1 ]]
++ java -version
+ [[ openjdk version "11.0.9" 2020-10-20 LTS
OpenJDK Runtime Environment Zulu11.43+88-CA (build 11.0.9+11-LTS)
OpenJDK Client VM Zulu11.43+88-CA (build 11.0.9+11-LTS, mixed mode) == *\A\d\o\p\t\O\p\e\n\J\D\K* ]]
+ [[ Zulu11-64 == \Z\u\l\u\8\-\6\4 ]]
+ [[ Zulu11-64 == \Z\u\l\u\1\1\-\6\4 ]]
+ is_aarch64
+ [[ '' == \a\a\r\c\h\6\4 ]]
+ [[ '' == \a\r\m\6\4 ]]
+ case "$(uname -m)" in
++ uname -m
+ return 1
+ is_x86_64
+ [[ '' == \x\8\6\_\6\4 ]]
+ [[ '' == \a\m\d\6\4 ]]
+ case "$(uname -m)" in
++ uname -m
+ return 1
+ [[ -n 1 ]]
+ whiptail --title 'Incompatible hardware detected' --msgbox 'Zulu OpenJDK 64-bit: this option does not currently work on your platform.\n\nDefaulting to Java Zulu 8 32-bit installation.' 9 80
mstormi commented 3 years ago

never mind it was not the hardcoded default but an explicitly wrong entry in openhabian.conf i.e. I think your java code is alright note I'll change openhabian.conf.dist to have java -32

ecdye commented 3 years ago

There actually might be some changing needed in my code. As of right now I think that if an option that is selected that cannot be installed (i.e. 64 bit java on a 32 bit machine) my code will install the old default of java 8 which should probably be changed to Java 11.

I'll make a note of it and try to change the code to install Java 11 when an invalid option is requested.