Moving OpenHAB from a Raspberry Pi to Proxmox on an Intel NUC


I wanted to move away from running OpenHAB on a Raspberry Pi. The plan was to use a platform with proper backups and snapshots.

I chose a seventh-generation Intel NUC with a Celeron processor. For virtualisation, I considered VMware ESXi and Proxmox. Proxmox won because it also supported LXC containers.

So how did the migration go, and what had to come along?

Historical note: This is how I migrated the setup in June 2020. It used Ubuntu 18.04, OpenHAB 2 and older versions of InfluxDB and Grafana. Commands and paths below are preserved as a record of that environment, not as instructions for current releases.

First I installed Proxmox and created two Ubuntu 18.04 containers: one for OpenHAB and one for InfluxDB and Grafana. At the time Ubuntu 20.04 wasn't supported by all the components I needed.

Moving OpenHAB

I installed OpenHAB using openHABian because it automated much of the process. In the openhab-config menu, the relevant option was “fresh install”.

Then I made a backup on the old system:

sudo $OPENHAB_RUNTIME/bin/backup

I transferred the archive to the new installation and restored it:

sudo systemctl stop openhab2
sudo $OPENHAB_RUNTIME/bin/restore $OPENHAB_BACKUPS/openhab2-backup.zip
sudo systemctl start openhab2

That brought OpenHAB back. I still needed to update the IP address of my InfluxDB server in /etc/openhab2/services/influx.cfg.

Next came Mosquitto and Homegear, both installed via openhab-config.

Mosquitto didn't need much additional work in my setup. For Homegear, I copied the configuration and database from the old machine:

/etc/homegear/*
/var/lib/homegear/sql.db

After that, Zigbee2MQTT needed its data transferred from:

/opt/zigbee2mqtt/data

The remaining extra was the SpeedTest project by taganaka for my existing speed-test script.

Backing up InfluxDB and Grafana

For the version of InfluxDB I was using, the portable backup command was:

influxd backup -portable <path-to-backup>

Grafana offered several options:

I chose the JSON export/import route for my dashboards.

Before the final switch, I downloaded all the backups and changed the old system's IP address so it would still be available if needed. Then I shut it down.

I configured the new machine to use the old IP address. That way, I didn't have to update every MQTT client. I shut it down as well before making the final change.

Zigbee USB passthrough

The Zigbee USB stick also had to be available inside the LXC container. I followed an older Proxmox USB passthrough guide for that part.

The exact device mapping and permissions depend on the Proxmox release. Check today's LXC device handling rather than assuming a 2018 recipe still applies.

Restoring InfluxDB and Grafana

With the new services installed, I restored the InfluxDB backup before creating any new databases:

influxd restore -portable path-to-backup

Then I imported the Grafana dashboard JSON files.

One important warning if you're reading this years later: this backup and restore syntax belongs to the older InfluxDB generation. InfluxDB 2 and newer have different tooling and migration requirements.

That was the move from Raspberry Pi to NUC finished. Hopefully I haven't forgotten anything important — and perhaps the experience will help somebody planning a similar migration.

Previous Next