Migrate into a different folder

Hello,

For safety reasons I prefer to update my instance by installing the new version in its own folder. So for instance, I went from /etc/openhab3 to /etc/openhab4 by copying a few configuration files by hand.

But for the OH5 migration, I’m wondering if this would work:

  1. Create a backup with openhab4/runtime/bin/backup and the appropriate environment variables
  2. Stop OH4
  3. Restore the backup openhab5/runtime/bin/backup and the appropriate environment variables
  4. Start OH5
  5. Wait for a while for it to come up

Would that be enough? Or are there things that I should change?

During an upgrade the upgradeTool runs which automatically fixes a number of your configs to deal with breaking changes. Obviously if you only use file based configs instead of managed configs there isn’t much that the upgradeTool will do for you. So if you do not have many manged configs what you describe cuold work but you are missing some steps.

  1. Restart OH
  2. Manually change your configs to deal with breaking changes

If you do have managed configs I recommend the following approach.

  1. Always start with a backup
  2. Copy your config from /etc/openhab4 to /etc/openhab5
  3. Configure your OH 4 to use the new openhab5 folders
  4. Once shown that everything works, do an in place apt upgrade
  5. Wait for OH 5 to come up
  6. Restart OH
  7. Manually deal with breaking changes that the upgradeTool could not do for you.

In either case you will need to reinstall mareketplace add-ons. And in either case you must make sure to remove any jar or kar files from the addons folder. Add-ons for old OH version can prevent newer OH instances from starting.

If backups are not sufficient to give you comfort, I might recommend abandoning the installed version of OH and go with a manual install or a Docker install instead. Then you can just copy the whole installation to a new folder and upgrade in place, leaving your whole older installation completely untouched. Upgrade instructions for a manual install includes manually runnign the upgradeTool at some point and Docker runs it automatically.

You will have to review all the announcements for all the versions of OH between the version you are running and the new version to answer that question for your specific deployment.

Thanks for the confirmation, it confirms my initial idea, but it does need some extra steps.
Here’s what I’m up to right now:

  1. Create a normal (no --full argument) backup with openhab4/runtime/bin/backup and the appropriate environment variables. A normal backup does not bring the cache and tmp folders which is what we want to avoid starting with elements that are not OH5
  2. Unzip the backup somewhere
  3. Do a search/replace in *.config files to replace /openhab4/ by /openhab5/. If not, it will use some elements from OH4 which is not desirable
  4. Rezip the content, making sure there are no extra folder at the root of the archive
  5. Stop OH4
  6. Restore the backup with openhab5/runtime/bin/restore and the appropriate environment variables
  7. Start OH5
  8. Wait for a while for it to come up

Now, with that, I have a running instance, but like you said, I had to review the announcements. In particular, I had to manually add the “Home assistant binding” as it was included in MQTT with OH4 but it no longer is with OH5.
And then, I had to recreate lots of channel/item links because of the MQTT thing id that got renamed.

One issue though, is that I had some of the links that were using hysteresis, or even scripts to do some conversions. And right now, I can’t have a look at the parameters of broken links because MainUI only asks me to delete the link when I click on it.
How can I see what’s in there so that I can replicate it on a new working link?

That’s one of the things that would have been done for you by the upgradeTool unless you only install add-ons through the addons.cfg file and used .items files.

You can see the full definition of those from the REST API.

MainUI → Developer Tools → API Explorer → Links → GET /links/{Item name}/{Channel name}.

Or if you are using .items files, you can see it all there.

Well, I restored the backup and just started OH5 as I was under the impression the upgrade tool would automatically run, reading various other messages here. That conclusion was wrong then.

Thanks for the hint, that’ll do it just fine, it’s even in the GET /links/orphans operation as well

It is automatically run. But it’s part of the installation/upgrade process, not the restore process nor the startup process. Your config must be in place before you install openHAB 5.

That’s why I recommended the alternative approaches above to what you are doing. Those are more likely to insure upgradeTool runs on the upgrade.

But you can run the upgradeTool manually. Though you probably don’t want to do it on your current configs where you’ve manually changed stuff. I think it’s java -jar /path/to/upgradeTool.jar. the path is where ever the openHAB bin folder is. But I don’t know what it will do with custom folder names like these.