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:

7 Likes

@Andrew_Rowe Thank you for this awsom guide, saved me so much time!

I did upgrade from version OH 3.2.0 all up to 4.1.1.

Started with backup, than upgraded to OH 3.4.5-1, latest OH3 version. Rebooted.
How its done you can see How to best update from 3.3.0 to 4.0.2? - #6 by llegovich

After that did all step by step as in your guide.

Didn’t get a single error. Had to reinstall some bindings.

Thank you once again! Mby this will be helpful for someone else as well!

1 Like