Upgrading OH3 to OH4 Linux Mint

I run openHAB on a small desktop PC running Linux Mint 19.2
This is an apt-get installed openHAB, this is NOT an openHABian install.
This is not a headless system, I have a monitor, keyboard and mouse.

Here is how I upgraded my install to the brand new M1 version

WARNING: “Here be dragons”*
This worked for me but version 4 at this time is NOT officially released! Follow these instruction at your own peril!!! I am just documenting how I did it.

First I checked which version of Java was running on my machine

andy@Treehouse:~$ java -version
openjdk version "11.0.14.1" 2022-02-08
OpenJDK Runtime Environment (build 11.0.14.1+1-Ubuntu-0ubuntu1.18.04)
OpenJDK 64-Bit Server VM (build 11.0.14.1+1-Ubuntu-0ubuntu1.18.04, mixed mode, sharing)

Next I upgrade Java to version 17

andy@Treehouse:~$ sudo apt install openjdk-17-jdk

Next I ran an openHAB backup

andy@Treehouse:~$ sudo openhab-cli backup

Using '/etc/openhab' as conf folder...
Using '/var/lib/openhab' as userdata folder...
Using '/usr/share/openhab/runtime' as runtime folder...
Using '/var/lib/openhab/backups' as backup folder...
Writing to '/var/lib/openhab/backups/openhab-backup-23_03_11-13_53_19.zip'...
Making Temporary Directory if it is not already there
Using /tmp/openhab/backup as TempDir
                                         
#########################################
          openHAB backup script          
#########################################
                                         
Copying configuration to temporary folder...
Removing unnecessary files...
Zipping folder...
Removing temporary files...
Success! Backup made in /var/lib/openhab/backups/openhab-backup-23_03_11-13_53_19.z

Next I upgraded openHAB

andy@Treehouse:~$ sudo apt-get upgrade openhab

Then I switched versions of Java
step 1
list all the available version of Java which are installed

andy@Treehouse:~$ update-java-alternatives --list
java-1.11.0-openjdk-amd64      1111       /usr/lib/jvm/java-1.11.0-openjdk-amd64
java-1.17.0-openjdk-amd64      1711       /usr/lib/jvm/java-1.17.0-openjdk-amd64
java-1.8.0-openjdk-amd64       1081       /usr/lib/jvm/java-1.8.0-openjdk-amd64
zulu-11-amd64                  2115200    /usr/lib/jvm/zulu-11-amd64

step 2
look at the list of versions for version 17. In my list above it is the second line in the list

java-1.17.0-openjdk-amd64      1711       /usr/lib/jvm/java-1.17.0-openjdk-amd64

use the last bit of the line, just the path part

/usr/lib/jvm/java-1.17.0-openjdk-amd64

run this comand

andy@Treehouse:~$ sudo update-java-alternatives --set /PATH/GOES/HERE

with the part that says /PATH/GOES/HERE replaced with the path from above
so for example on my machine

andy@Treehouse:~$ sudo update-java-alternatives --set /usr/lib/jvm/java-1.17.0-openjdk-amd64

I then restarted the PC. When the desktop came up, I opened a browser, typed in localhost:8080 and my MainUI interface popped up and looked total normal. I was kind of freaked out because it looked exactly the same. Checked Help & About from the menu and see
openHAB 4.0.0.M1 Milestone Build

Check the logs, have fun :slight_smile:

5 Likes