Migrate openHabian from Raspberry Pi 3 to a Raspberry Pi 5

I want to migrate my openHabian from a Raspberry Pi 3 to a Raspberry Pi 5.
(This is the first necessary step to get to openHAB 5.)

My questions:

1. What steps are necessary for a complete migration?
1. Is there already a guide for this?

Some comments on 1):
I know that openHabian has “50 - backup/restore.” However, I’m also aware that this won’t migrate everything on my “openHabian” server. There is no additional/manually installed software there. However, there is software installed there that I installed in openHabian as “Optional Components.”

This raises further questions about 1):
Is there a way to include the “optional components” in “backup/restore”?

I definitely have mosquitto installed and would like to migrate that as well.

I might have installed “Grafana and InfluxDB” (I still need to check). I can view my temperature data as a graph. This might be based on “Grafana and InfluxDB.”

It also occurs to me that other system configurations, such as the IP address and hostname, should be adopted. Are there any other things I should consider?

Thank you for your help.
Daniel

If I understand correctly, you can’t (but I’m not an openHAbian expert). openHABian is installed on “bare metal” similar to an operating system.

You need to reimage a SD card with the appropriate openHABian image for the Rpi5 and OH5, then use the openhabian-config to readd your optional components (samba, MQtt, etc.) and the OH backup etc.

The steps I would take are:

  1. Install the latest openHABian on the RPi 5. Make sure you choose the 64-bit OS image.
  2. Reinstall and configure the third party tools you installed through openhabian-config and transfer the data and configs for each one over to the RPi 5 individually as necessary.
  3. Reinstall openHAB so it matches the version of OH you are running on the RPi 3.
  4. Take a backup of OH from the RPi 3 and restore it on the RPi 5.
  5. Validate the restore worked as expected.
  6. Upgrade OH to the latest OH 5 release. You may need to upgrade to Java 21 separately.

There are several posts but I know of no hardware migration tutorial like this.

No.

Unless you changed things, simply installing Mosquitto on the RPi 5 using openhabian-config will be sufficient. openhabian-config also deploys a default configuration.

To migrate these you’ll have to look on the Grafana and InfluxDB docs to see how to migrate those. Note that just because you have charts doesn’t mean you are using these. MainUI has good support for charts built in which work is rrd4j or any other persistence database. Sitemaps also have support for a more primitive charting capability. Just because you see charts doesn’t necessarily mean you are using these. You should be able to tell by looking at your persistence configs and your sitemap or MainUI widgets.

You should not have two machines on the network with the same IP address at the same time. It’s a good idea to avoid having duplicate host names too. You will probably want to keep the RPi 3 up and running until you’ve completed the migration and confirmed everything works, so I would not try to change these until after you decomission the RPi 3, if at all.

You can’t use SD card mirroring or other approaches that just copy everything off the SD card because you are almost certainly running a 32-bit OS on that RPi 3 and OH 5 requires a 64-bit OH meaning you’ll have to start over and reinstall everything anyway.

In this case yes that is true but it’s because OP is almost certainly running a 32-bit OS and OH 5 requires a 64-bit OS.

However, openHABian is just a bunch of scripts that run during that first boot and which can be run individually from openhabian-config. If the RPi 3 were running a 64-bit OS, it is likely possible to just take the SD card from the RPi 3 and plug it into the RPi 5 and everything will work. Raspberry Pi OS, which openHABian runs on, is fully backwards and forward compatible to every model of RPi that was available when the OS was released.

3 Likes

Thank you for this detailed @rlkoshak answer!
I’ll address this accordingly and report back :slight_smile:

In addition to the steps described by @rlkoshak I also did the following.

To install openHAB version 4, the following must be entered in openhabian.conf on the SD card before the first boot:

clonebranch=openHAB4

Since I’m using Mosquitto and Zigbee2MQTT from openHabian as described, this must first be installed using openhabian-config.

This also requires connecting the Zigbee adapter (via USB) to the new hardware.

The configuration file /etc/mosquitto/mosquitto.conf was identical for me after installation; I didn’t need to adopt it.

The Zigbee2MQTT configuration can be copied by simply copying the entire /opt/zigbee2mqtt/data/ directory.

When copying, the corresponding services can be started and stopped as follows:

sudo systemctl start/stop zigbee2mqtt.service
sudo systemctl start/stop mosquitto.service
sudo systemctl start/stop openhab.service

Finally, I configured the hostname (using openhabian-config) and adopted the IP address (in my DNS server).

The upgrade to openHAB5 can then be performed as usual using openhabian-config. Beforehand, I installed Java 21 (using openhabian-config).

Everything works perfectly.

However, I get the following message. This is not a technical problem. In my opinion, the message is incorrect.

Which one?

Well. If you get this message (when?) then either the detection routine is wrong, or something you did messed up the /etc/os-release file.

Set debugmode=maximum in openhabian.conf and redo, record the terminal output.
Do ls -l /etc/*release* and cat /etc/*release*.

The openJDK from openhabian:

I also used the official image of openHabian here.

It says right there in the menu “DO NOT USE WILL BREAK SYSTEM”.

“Temurin 21” is what would should have chosen. OpenJDK is currently not supported.

I don’t know that this would cause that warning message or not. If that message appears when choosing OpenJDK, the contents of the error message needs to be updated. If not, you’ve two problems.

1 Like

Of course you’re right. I obviously wasn’t paying attention. I’ve now switched to Temurin. It still works :wink:

$ java -version
openjdk version "21.0.8" 2025-07-15 LTS
OpenJDK Runtime Environment Temurin-21.0.8+9 (build 21.0.8+9-LTS)
OpenJDK 64-Bit Server VM Temurin-21.0.8+9 (build 21.0.8+9-LTS, mixed mode, sharing)
openhabian@home-server:~ $

OS:

$ uname -a
Linux home-server 6.12.25+rpt-rpi-2712 #1 SMP PREEMPT Debian 1:6.12.25-1+rpt1 (2025-04-30) aarch64 GNU/Linux

But the message is still there.

What’s in your /etc/os-release file?

I’ve only an older version of openHABian to check against but I expected to see “Raspian” instead of “Debian” in the uname results. But that may have changed since I last upgraded this machine (it’s 100 miles away so upgrades are few and far between).

openhabian@home-server:~ $ cat /etc/os-release
PRETTY_NAME="Debian GNU/Linux forky/sid"
NAME="Debian GNU/Linux"
VERSION_CODENAME=forky
ID=debian
HOME_URL="https://www.debian.org/"
SUPPORT_URL="https://www.debian.org/support"
BUG_REPORT_URL="https://bugs.debian.org/"

And this:

###############################################################################
###############  openhabian  ##################################################
###############################################################################
##        Ip = 192.168.178.20
##   Release = Debian GNU/Linux forky/sid
##    Kernel = Linux 6.12.25+rpt-rpi-2712
##  Platform = BCM43455 37.4MHz Raspberry Pi 3+-0190
##    Uptime = 0 day(s). 18:16:18
## CPU Usage = 0.53% avg over 4 cpu(s) ( core(s) x - socket(s))
##  CPU Load = 1m: 0.00, 5m: 0.00, 15m: 0.02
##    Memory = Free: 0.54GB (14%), Used: 3.49GB (86%), Total: 3.95GB
##      Swap = Free: 2.99GB (100%), Used: 0.00GB (0%), Total: 2.99GB
##      Root = Free: 47.68GB (86%), Used: 7.35GB (14%), Total: 58.00GB
##   Updates = 0 apt updates available.
##  Sessions = 0 session(s)
## Processes = 159 running processes of 4194304 maximum processes
###############################################################################

                          _   _     _     ____   _
  ___   ___   ___   ___  | | | |   / \   | __ ) (_)  ____   ___
 / _ \ / _ \ / _ \ / _ \ | |_| |  / _ \  |  _ \ | | / _  \ / _ \
| (_) | (_) |  __/| | | ||  _  | / ___ \ | |_) )| || (_) || | | |
 \___/|  __/ \___/|_| |_||_| |_|/_/   \_\|____/ |_| \__|_||_| | |
      |_|                  openHAB 5.0.1 - Release Build

Looking for a place to get started? Check out 'sudo openhabian-config' and the
documentation at https://www.openhab.org/docs/installation/openhabian.html
The openHAB dashboard can be reached at http://home-server:8080
To interact with openHAB on the command line, execute: 'openhab-cli --help'

here you are… some action of yours messed this file up, maybe the openjdk21 move as it’s probably from the unstable repo.
Shouldn’t happen when you use openHABian properly.

It sounds like you are somehow on the testing version of Debian which is not supported so the warning is correct. If everything is working you can probably live with the warning but realize we are limited in how well we can support you.

Or you’ll need to start over and this time choose Temeruin.

I’m now using Temurin (again). Everything’s “official.” How can I fix this?

For a safe solution, you need to reinstall from scratch.
You don’t know what caused this mess-up, and you don’t know what else (undiscovered) is messed up in your OS, too.

I’m not sure what the connection is between installing openJDK and the OS release; I’ll have to look into that.

I took another look. The stable branch of Debian 12 / Bookworm / Raspberry Pi OS apparently (unfortunately) doesn’t include version 21 of openJDK. (It would certainly be technically feasible to replicate this.) Therefore, the openHABian script (logically) imports the unstable branch when installing openJDK. This then leads to the “forky/sid” situation.

I hadn’t anticipated the consequences. I naively assumed that you could simply uninstall unsupported Java. Not a big deal, I’ll repeat the installation.

Installing the unstable openjdk pk should not change the whole system’s distro status, that’s what’s broken. Thing is, we as openHABian maintainers cannot validate that, and it can change at any time.
That’s why there is that warning in the openHABian menu not to use it.

I can confirm that it is not necessary to install OH 4.3 on a new Raspberry Pi 5 before upgrading. I just did the following steps and all worked like a charm:

  • Put all things as “disabled” on the RPI 3
  • Make a backup of the configuration: openhab-cli backup
  • Install OH 5.0 on a new Raspberry PI 5 with openhabian OS on a new SD card
  • Boot up Openhab 5 and let Openhabian finish all the first boot steps (takes several minutes, monitor the screen) - at the end, the Rpi reboots.
  • Copy the backup file in the backup folder /var/lib/openhab/backups/
  • Restore the backup from the openhabian-config tool
  • (Connects you USB sticks such as Zwave, Zigbee, etc.)
  • Re-enable the things and check that all is fine with each binding

In case of failure with the new RPi 5 with a new sd card, keeping the RPi 3 with the old sd card is a safe option, as it can be relaunched in few minutes.

FWIW you can also have openHABian auto-import your saved old config, see initialconfig option.

And have a look at the SD mirroring feature.