Upgrade from 3.4.2 > 4.0Mx *and transfer configuration*

Windows 10, current OH 3.4.2

There must be a simple way to do this, but I cannot find it here. Not just the upgrade of JAVA and OH, but migrating my config as well.

Copy my user directory over to the OH4 directory and simply deal with the fallout?
Is there an actual procedure?
Is there some command line or other “program” to run that does some amount of migration/udates?

Or should my 4.0 M2 install have recognized that I already had 3.4.2 and did the migration for me?

1 Like

I have upgraded to 4.0.0.M2 (waiting for M3)

Basically what I did was:

  • Stop openHAB service
  • Set Service to Manual
  • Copy the current openHAB directory to a backup location
  • Run the Power Shell Upgrade procedure
    • Run in ADMIN PowerShell window
    • Run from openHAB directory
. .\runtime\bin\update.ps1
Update-openHAB -OHVersion 4.0.0.M2
  • Install Java 17
  • Make sure JAVA_HOME points to the correct Java Version
  • Start the openHAB service (or from batch file)
  • Check all your setup

If you run into an issue you can revert to the 3.4.2 version by:

  • Stop the current version
  • Revert the JAVA_HOME to point to Java 11
  • Copy backed up 3.4.2 Version to openHAB folder (backup existing 4.0.0.M@ is desired)
  • Start openHAB

I have done it this way for a while until I got to a working 4.0.0 setup that I could live with.

Hope that helps.

1 Like

It does indeed help! And using the PS script - this then means to NOT install OH 4 from the msi? (using the normal windows right click - install)?

Apparently doing it this way DOES migrate, where simply installing 4.0 does just that. Installs it and nothing more?

I should ask - will this go out and GET the files? Or do I need to download the install files somewhere local first?

First it’s worth mentioning that a command line upgrade tool is in development. This tool will do stuff to your config to correct breaking changes and the like. But it’s not yet ready, certainly not for OH 4.0 M2.

The best process, if moving to another machine with a new version of OH is the following:

  1. Install the exact same version of OH on the new machine as is running on the old machine (e.g. OH 3.4.2).
  2. Use the backup script to get a copy of all the old configs, transfer that to the new machine and use the restore script to copy the configs to the new machine.
  3. Verify everything works.
  4. Now upgrade the new machine instance to OH 4.0 Mx using the normal upgrade processes.

The restore scripts do not perform any upgrade steps so it’s important to restore to the same version of OH as the backup came from, and then upgrade.

Note: this is mostly just a more generic version of the steps @Mark_VG outlines

Look in the restore script or run it with --help for details. But no, it doesn’t know where to go get your backup files. You need to transfer the zip to the local machine and then you can pass the path to the file as an argument to the restore script, or put it in the well known location (I think it’s $OPENHAB_USERDATA/backups but am not sure, I run in Docker so use my own backup and restore processes).

This is where the question came up. I can’t find “the normal upgrade process” description. I simply downloaded the .msi and installed 4.0 which, of course, didn’t “upgrade” anything. It was it’s own stand-alone “pristine” install. None of my 3.4.2 stuff.

There is clearly a difference between the INSTALL process (well defined) and UPGRADE process (which I searched and found very fragmented info).

Note: I DID find the “udpate” instructions under install.

Windows | openHAB

However - I interpreted this to mean I was going from 3.0 > 3.1 > 3.2, not an “upgrade” from 3.x > 4.x. This is because I installed OH in a VERSION unique directory. OH 3.4.2 and OH 4.0. So my brain was thinking the 3.4.2 > 3.4.3 would not be an upgrade - since it was simply replacing binaries in an existing folder. Not upgrading to a new version.

Each OS will have their own specific process, sometimes automated, sometimes not.

We welcome any contributions to the docs, especially docs like the Windows installation docs. Only a minority of OH users run on Windows (none of the developers/maintainers that I know of) so there are not as many people to volunteer to update those docs.

The process is the same whether going from 3.1 to 3.2 or from 3.2 to 4.3. Even going between second point versions is upgrading to a new version.

And, why do I use Windows? Because it is such an AWSOME cool… Well, it is a reliable… Uhm, stable…

Oh, heck. Probably cuz I’m not right in the head. LOL

1 Like

I don’t judge. I’m sitting here at my desk with Ansible running an update on Raspberry Pi OS (Linux) and Ubuntu (Linux), on a Mac laptop, with an RDP session open to a Windows 11 machine. When I’m not at my desk I use a Chromebook (kinda sorta Linux). And all my services save one run in Docker containers.

It’s all good. But there is a lot to be said for popularity. The more people who use it, the more people to help with the docs and help on the forum.

Though I will say that I experience a special kind of rage every time I have to use Finder on the Mac.

Oh, I almost forgot, my firewall/gateway is OPNsense which runs on FreeBSD. About all I don’t have any more is a Solaris box (I won’t have anything to do with Oracle if I can help it).

Oracle hater.

I’m using a Ubiquiti EdgeRouter for my gateway. Cuz it’s cheap(er) hardware than their Unifi Gateway or a Watchguard (which is way more configurable than the Ubiquiti - only because of the UI). But Ubiquiti via UI allows me to create 2 VLANs. One is locked to ETH1 and the other to ETH3, 4, 5. I thought that a bit odd. Well - it turns out - it is quite arbitrary. The UI is restricted. From the Comamnd Line I can create FOUR VLAN’s if I want (I don’t). Why do I get out of bed some days.

I SHOULD have done a cheap box with a couple NICS and done exactly what you did.

No sure which MSI file you’re installing because OpenHab on Windows is just a ZIP file that you extract into a certain directory and run it from there. I assume the MSI you mean is the Java 17 install??

As previously mentioned by @Mark_VG the Best (and only?) way to safely upgrade OH on windows is to use the PS Script as outlined in the Windows Install Docs.

Backing up is simply a matter of copying your whole OH3 Directory(Which in itself can be run on its own Java withstanding) before upgrading.
Apart from that the only thing to keep in mind is that OH3 is Java 11 while OH4 is Java 17… to switch between the two Java’s requires the environment variable JAVA_HOME to be set to the correct directory.

Ooops. You are right. Unzip to a directory.

SO…

I have OH3.4.2 and OH4.0 directories. I’m assuming for the upgrade script to work, it needs to upgrade in the same directory (ie: I copied my OH User stuff from 3.4.2 > 4.0 and run upgrade in the 4.0 directory).

Note: Win10

But remember that the config is tied to the directory. So if you used c:\openHAB, then you need to stick to that going forward - otherwise all sorts of problems.

1 Like

The reason everyboyd keeps saying to FULLY isolate my 3.4.2 and 4.0 to different PC’s VM’s or whatever and NOT use two directories on the same windows instance!