Upgrade OH 3.4.4 to OH 4.1 Best Direction

I’m finally ready to upgrade OH to 4.1 in order to use the resolved Amazon Echo binding that fixes the lastVoiceCommand issue.

I’ve tried upgrading before but it completely failed so I want to get some input. So many posting about this upgrade.

My plan . .

  1. Following this to install Java 17 on Ras
    How to Install Java-17 on Raspberry Pi

  2. Then do I choose “manual” to download and install OH → Download openHAB | openHAB

OR

Do I go into the OH config and do the upgrade from there (that is if it starts with Java 17 installed)?
openhabian-config

Best, Jay

It’s important to separate openHAB and openHABian in your mind. openHABian is a bunch of scripts and tools to configure and prepare a system for OH. It is not OH itself. It installs OH.

If you are on a recent enough based OS (bullseye or bookworm) and already running openHABian, I believe you can install Java 17 through openhabian-config. If you are on buster or earlier I’m not certain either openHABian nor those instructions will work. There is only one Java 17 implementation that I’ve seen reported that works on buster and below because of a dependency on a version of a shared library. Search the forum and you should find the posts that talk about it.

Given these limitations, I’d recommend installing a fresh new openHABian image. This is one of the rare cases where a restore of your configs from 3.4 over 4.1 should work so you don’t need to worry to much about installing openHAB 3.4, restoring, and then upgrading.

The steps are:

  1. Install a fresh openHABian image with OH 4.0 (latest release).
  2. Stop OH and restore your backup using openhabian-config or openhab-cli.
  3. Run the upgrade tool manually: java -jar /usr/share/openhab/bin/upgradetool.jar (at least I think that’s where it is, I use docker so the paths are different.
  4. When that completes start OH and make any changes to your configs required by the breaking changes between OH 3.4 and OH 4. unit metadata and opening and resaving your Blockly rules will be the two biggest ones but look at the release notes for OH 4 for details.
  5. Once you are up and running error free, upgrade to the OH 4.1 milestones or snapshots. That should go smoothly.

Here’s my journey in the upgrade, it took around 10 hours. Thanks @rlkoshak with the overview above which helped!

I needed/wanted to upgrade Pi OS from Buster to Bullseye

sudo apt-mark hold openhab
sudo apt-mark hold openhab-addons
sudo apt-mark hold speedtest-cli
sudo apt-mark hold python3
sudo apt-mark hold openjdk-11-jre-headless:armhf

Show package status on Linux → validate the HOLD status on the above
dpkg --get-selections | less

https://jamesjdavis.medium.com/how-to-update-raspberry-pi-just-follow-these-easy-steps-ac507cf70238

sudo apt update
sudo apt dist-upgrade
sudo apt clean
sudo reboot

sudo nano /etc/apt/sources.list
Change buster to bullseye on first line

sudo apt update

https://unix.stackexchange.com/questions/592657/full-upgrade-to-debian-testing-fails-due-to-libc6-dev-breaks-libgcc-8-dev

sudo apt install gcc-8-base ← this resolves an error before upgrading

sudo apt dist-upgrade ← this will take a lot of time with default prompts
sudo apt autoclean
sudo reboot

Reinstall SAMBA if you use it
Upgrade Putty on your clients to latest vesion (0.79), older version won’t connect to Bullseye
Removed DHCP from Bullseye since I have a static IP and didn’t want the 169.x.x.x IP showing up

https://www.openhab.org/download/
curl -fsSL "https://openhab.jfrog.io/artifactory/api/gpg/key/public" | gpg --dearmor > openhab.gpg
sudo mkdir /usr/share/keyrings
sudo mv openhab.gpg /usr/share/keyrings
sudo chmod u=rw,g=r,o=r /usr/share/keyrings/openhab.gpg

OH 3.x should continue to run as normal with Bullseye installed now

** Make a SSD copy before proceeding to upgrade OH for a disaster backup scenario

Make sure OH is stopped before proceeding.
apt-get install openhab
sudo /bin/systemctl start openhab.service

Make sure OH is stopped before proceeding.
apt-get install openhab-addons

My upgrade took me from OH 3.4.4 to 4.0.4

Start OH
→ lots of “Could not resolve modules”
Stop OH
Removed these bindings in Addon’s due to resolutions never happening, need to upgrade them to 4.0.x versions once up and running via GUI
org.smarthomej.binding.androiddebugbridge
org.smarthomej.commons
org.openhab.io.hueemulation
org.smarthomej.binding.amazonechocontrol
Removed everything from /cache and /tmp

Start OH
Downloaded from Market Place:
org.smarthomej.binding.amazonechocontrol (beta)
org.smarthomej.binding.androiddebugbridge

Downloaded from jFrog, HUE Emulation, couldn’t find where to install/activate this via the GUI anywhere.

Stop OH
Reboot Pi

In 4.0 go to Settings → Other (under Add-ons) or in 4.1 go to Add-on Store → Other.

In both cases it’s found under System Integrations.

Alternatively you can click the magnifying glass icon to search for it.

In OH 4.0, once installed, any add-on setting can be reached by navigating to the same place you install the add-on (see above) and click the blue gear icon. In 4.1 go to Settings and the add-on will appear under Add-on Settings.