How to install openHAB on Proxmox?

(with the risk of preaching to the choir)

I’m using VirutalHere to pass thru USB (“locally” or over IP) on my Hyper-V host(s). Two downsides : it’s not free but cheap enought to be the pain killer, and licence is bound to hardware of the VirtualHere Server (that’s why mine still runs on a RPI 2B from 2016).

I use OpenHABian on an LXC in Proxmox. It’s been running great for over a year, including all updates.

I used USB passthrough into the container for my z-wave stick when I first set it up, and it worked great. But I ended up moving my homelab and wanted to leave the z-wave stick in the original, more central location. So I set up the z-wave wave stick on an old raspberry pi, and connect to it via serial over Ethernet.

I also have a standalone zigbee coordinator that connects via serial over Ethernet.

I have Proxmox backup my openHAB container every night. And that has absolutely saved my bacon a few times.

I used to use the node red installation that comes with OpenHABian, so in the same LXC. But recently I moved that to its own LXC, which has greatly improved my peace of mind about updates and backups. (I use node red for all of my 'rules").

One sweet side effect of using serial over Ethernet for z-wave and zigbee is that I can easily migrate my openHAB LXC between my Proxmox nodes without having to move any hardware. That comes in handy when performing maintenance on the nodes, or if one should fail.

I also use OpenHABian on a Debian LXC in Proxmox. Works great with all the features. But to make it easier to integrate different devices, I use a privileged LXC.

In my opinion it has some advantages over Docker containers. At least I had problems (in the Docker installation) with playing sounds on a USB speaker and accessing the command line via exec-binding. This is much easier with LXC.

I have decided to install openhabian on a Debian LXC container. Had a few hiccups ( sudo not being part of the proxmox Debian template and later the openhabian user not being part of the sudoers group ; some package that was missing and the JSrules failing) but I have managed to solve them.
Then a restore that I had from my previous RPI openhabian instalation simplified all the new openHAB configure.
so far so good.

Thanks for the opinions you all provided.

Eurico

Sounds like you have a working setup - good work!

I’ve been running openHAB (and other services) in Proxmox since 2021. This includes mosquitto MQTT broker and zigbee2mqtt.

Each service gets its own LXC container. The base OS in each LXC container is either Debian or Ubuntu.

I’m in the process of manually upgrading from openHAB 3 to openHAB4, and performing quite a bit of cleanup along the way. So I currently have 2x openHAB LXCs happily existing side-by-side: openHAB 3 in an Ubuntu 20.04 LXC, and openHAB 4 in a Debian 12 (Bookworm) LXC. Almost all my devices are either MQTT over wifi or Zigbee, or HTTP, which makes this super easy - I don’t have any dongles or protocols specifically tied to the openHAB 3 container.

I install openHAB using the apt repositories. Backup is just performed using the scheduler - I don’t use the backup-server, so as @JustinG my backups are full size.

USB pass-through to the zigbee2mqtt container was a little difficult back in 2021 with minimal examples, but today I use the same method as the proxmox helper scripts, and I’ve torn-down and re-built that container a handful of times in the past week without issue!

Did I get it right that there are 4 options for running openhab within proxmox:
A: Proxmox [ lxc_debian {docker (openhab) } ]
B: Proxmox [ lxc_debian {openhab} ]
C: Proxmox [ vm_debian {docker (openhab) } ]
D: Proxmox [ vm_debian {openhab} ]

I understood in general between the differences using LXC vs VM - but what are pros and cons about having openhab inside an docker environment in addition?

In my opinion: no pros. I deployed some applications as docker containers within LXC which works but I only did that because docker is the default installation method. For OH you’re better off just using the regular apt package in my opinion.

Cons: you have to update both your LXC and your docker container.

1 Like

It depends. I use Docker in VMs and in LXC containers (I’ve dipped my toe, but not yet moved OH over). Me reasons are:

  1. I run a lot of services. Docker gives me a standard way to deploy and configure all of these and provides a lot of isolation between them. The only services I don’t run in Docker containers are those that require access to Bluetooth or GPIO pins (p[assing these into the container are a pain).
  2. I use Ansible to deploy and configure services and because of 1, Docker lets me reuse what I already know what/how to do to deploy a new service. Often to deploy a new service I just need to copy/paste from one of my existing playbooks and edit with the info for the new service.
  3. Occasionally I want/need to move a service to a new machine/VM/LXC (rebalancing temporary maintenance, etc). Because of 1 and 2 doing so is as simple as editing one file (the Ansible inventory) and running two commands (one to bring down the VM on the old machine and another to run the Ansible playbook to bring it up on the new machine.
  4. Because of the isolation, for most services, backup is as simple as just taring up the mounted volumes and saving them to my NAS which is easy to implement as a cron job again in a standardized way.
  5. The isolation also makes it easy to deal with issues between services such as wanting to use the same ports, incompatable shared libraries, etc.
  6. Upgrades are easy to perform and easier to roll back if something goes wrong.
  7. There are way more Docker containers availble than special purpose LXC containers. If you can run it, someone somewhere has publiushed a Docker Image to dockerhub you can download and use.

But I mainly gain all these advantages because of 1. I have economies of scale to apply here. If you are just running OH and maybe Mosquitto and InfluxDB, you are probably not going to see as much benefit to useing Docker. So just run it the way you know best. Or pick something new if you want to learn something. Maybe try all four approaches and see which you like best.

I will say you have two additional approaches you can use:

E. Proxmox [lxc_debian {openHABian}]
F. Proxmox [vm_debian {openHABian}]

Thank you - really good summary - I already have some docker containers running on my Synology - I think I will move them to proxmox and try to run openhab in docker as well using an lxc container.
Is there a difference in your approaches “E” + “F” to my approaches “B” + “D”? - Guess:
“Openhabian” is a complete linux distribution with the openhab application already inside against installing a debian distribution and installing openhab afterwards?

openHABian customizes the OS and automates installation and configuration of a host of other services commonly used with openHAB like Frontail, InfluxDB, NodeRed, etc. Your B and D would just install openHAB and nothing more.

openHABian can be installed manually on a Debian OS.

THX for clarification!

I’ve been running OpenHAB in proxmox LXC for a long time now (2+yrs) but i randomly run into issues with the USB passthough and it drives me nuts.

Randomly OpenHAB will lose access to the USB via /dev/ttyACM0 and i have to fiddle with permissions, multiple restarts and then openhab finally detects it and my z-wave controller comes online.

I don’t get why this happens and why its so difficult but because of that i’m considering rebuilding a VM instead as USB passthough just seems to work from my testing.

I have done the passthough the old way by editing the lcx conf files and recently moved to using the GUI to specify the device. Both have been problematic, not often but enough that i waste 2+hrs in the evening trying to get openhab to start up and detect the dongle.

Not sure if anyone else has experienced this but this is why im leaning to go VM in the future.

I also use a usb device in OH LXC but I don’t experience any of that. I think I saw once or twice that the serial bridge thing was in an error state but this was resolved by disabling and enabling the thing so it seemed that everything was ok within the container but that this was more of a binding related issue.

The device is assigned via GUI.

@DrRSatzteil do you have any specific settings defined for the device in the GUI?
image

This is my configuration:

image

I just changed the UID/GID to the openhab user in the container

Here an extract of my /etc/passwd:

openhab:x:103:112:openhab runtime user,,,:/var/lib/openhab:/bin/false
1 Like

Awesome, i hope that resolves my issue. Will try giving it a restart this evening to take the new settings :slight_smile:
image

1 Like

No such luck, stopped OH, shut down the server so it took the new device mappings:
image
image
and my zwave dongle is stuck offline:

With logs reporting:

2024-12-03 20:01:14.023 [DEBUG] [ort.serial.internal.RxTxPortProvider] - No SerialPortIdentifier found for: /dev/ttyACM0

Hmm too bad :unamused:

Sorry, I don’t think I can really help here, that’s all I did and it just works for me for some reason.

Just one idea that came to my mind: do you use a cable with the dongle? If yes, could you try without the cable or replace the cable?

I don’t know if this applicable to proxmox, but my docker-compose for the zwave dongle I use

    devices:
      - '/dev/serial/by-id/usb-0658_0200-if00'

rather than /dev/ttyACM0, etc because those addresses can change, but the id stays the same.

Yeah you could check that via the PVE command line. Does the device exist there?