Moving from Ubuntu 18.04 to 22.04 and upgrading Openhab to 4.X


I’m currently running openHAB 3.4.4 on a Ubuntu 18.04 VM on Hyper-V Server I think it’s time to upgrade the VM to the latest version of Ubuntu: 22.04 and at the same time, upgrade openHAB to its latest stable version. What’s the best way to do this?

I’d prefer to do the following:

  1. Spin up a new VM with the new OS on it
  2. Install openHAB 4.X
  3. Load in the backup but of my current openHAB 3.4.4 installation (taken via sudo openhabian-cli backup) and restore via sudo openhab-cli restore BACKUP FILE

is it this simple? Anything I should be aware of? Will the backup taken from 3.4.4 load into 4.X? I

As say the docs, openHABian is not supported and untested on Ubuntu.
So those ressources do not necessarily apply, anything can happen.

I just changed the wording of the OP. I plan to migrate to a new OS anyway. if I’m doing that, what OS Should I go with? For context, I’m currently running it on a Ubuntu VM thats on Hyper-V Server

For what it is worth I am running multiple instances of Debian 12 on my hyper-v cluster and have had 0 issues running the OS or patching or installing and running any version of OpenHab all be it I do use a linux build of Openhab not the Openhabian flavor.

I’m not sure all your questions have been answered.

It it this simple? Sometimes. YMMV.

There are extra steps which may be required after the restore but prior to running OH 4. It might be worth taking a snapshot of your old VM, upgrade to 4 in place. Adjust your configs for breaking changes (see the release announcement). Only then take your backup to restore on the new VM. then you can revert your old VM or just get rid of it as desired.

Good idea. Can you please link me to the release announcement to make sure in looking at the right post?

Thanks for the info. A few questions:

  1. Do you recommend that I do the linux build or openHABian? openHABian is very easy lol
  2. Do you use Z-wave devices? If so, how did you pass the USB through Hyper-v?

Please keep in mind that openHABian is not supported to run on Ubuntu installations…

As far as Unbuntu versus Debian I will let others chime in I saw that @hmerk replied that Unbuntu is not supported but as I understood that response it appears in reference to overlaying openhabian on top of Unbuntu. I would think just a plain linux openhab install on Unbuntu would be a supported approach… but I again will allow the SME’s to respond to that.
I run Debian and just a regular OpenHab install I have no opinion one way or another about openhabian being easier or better or worse so I will also leave that topic alone too.
I run Debian 12(bookworm) builds and just do an install of the version of Openhab I want and make sure I have the correct Java version set as default.
Yes I use Zwave and Zigbee as well.
I use usbip and I have a “usb server” (super lightweight linux server with lots of usb ports that does nothing but handle a bunch of usb devices and exposes them for network access) then I connect to that which serves all my Hyper-V vm’s with usb devices as i need them on any VM . This approach works very good for me since I do lots of different testing I move usb devices around quite often but maybe a over kill for you depending on how many VM’s you run in Hyper-V .There are also some other software-based solutions you could use that allow usb devices to be shared from your Hyper-V host as well.

Correct. openHABian most definitely does not work with Ubuntu. There are differences between Debian and Ubuntu which renders openHABian inoperable.

However, openHAB by itself can be installed on any distro that supports apt, yum, dnf, and documented instructions for Arch using pacman.

In addition, openHAB can be installed on any platform that supports Java using the manual “download the zip file and unzip it somewhere” approach.

1 Like

Hey guys, i have made a lot of progress on this and will post more details when I get it fully migrated. In the mean time, I have a question about persistence, specifically influxdb.

I installed Ubuntu 22.04 and OH4 (via apt) and then ‘restored’ my backup from my old OH 3.4.4 instance. When I did the restore, I didn’t realize that InfluxDB was not installed on the VM (though the binding/add-on was installed on OH4. After I restored the backup, I installed influxDB on the VM but its saying that it can’t find my old database.

Do I need to do anything to move my old influxdb openhab database to my new install?

Yes, of course. InfluxDB is a third party database. All OH does is connect to it and use it as a database is intended to be used. You’ll have to backup and restore InfluxDB using what ever process InfluxDB requires. See their docs for details.

This will be true for all third party software you may be using: Mosquitto, Grafana, MariaDB, NodeRed, Frontail, etc.


Thanks. that sounds obvious now that you say it. I’m just used to the openhabian press-one-button experience.

I assume this also goes for MapDB? I did successfully install and configure Frontal!

MapDB and rrd4j are different. They don’t have a separate service running. They are embedded into and therefore are a part of OH itself. Their data gets stored in $OH_USERDATA/persistence/mapdb and rrd4j respectively. These will get backed up and restored with a standard OH backup.

Note: SQLite is also embedded but I’ve no experience using it with OH so don’t know how/where the data is stored.

1 Like

From docs:


If no database is available it will be created; for example the url jdbc:h2:./testH2 creates a new H2 database in openHAB folder.