OpenHABian - KVM/QEMU?

  • Platform information:
    • Hardware: AMD Ryzen 7 5700G with Radeon Graphics, 64 GB RAM
    • OS: Debian 12 Bookworm
    • Java Runtime Environment: nothing installed yet
    • openHAB version: newest? not installed yet
  • Issue of the topic: I’m looking for some installation advice and maybe to clear up some confusion a little. I have a Debian server I made and I wanted to use openHAB on it (in a VM). Have been doing some reading about it.
    I came across this post:
    Best way to build a new Openhab install today? - #4 by rlkoshak
    by user @rlkoshak and thought that openHABian sounded like the perfect thing to “just get started” with, but most install instructions, commentary/threads seem based on installing on a raspberry pi, and i don’t have that.

I saw the instructions for installing openHAB on Linux, but i didn’t want to just install it on my server which is on a different subnet, I was hoping to allocate a VM for the openHAB.
I haven’t learned Docker yet, but I am familiar with KVM/QEMU/libvirt so I was thinking to make a virtual machine with 2 vCPUs, 4 GB of ram and idk how much storage but maybe 100 GB and I have a dedicated 1GB network interface set up as a bridge for the VM

But, so, I guess my confusion is that (somewhat referring to the post above) it’s stated that openHABian is based on Debian maybe. So is openHABian a full (custom modified) install of Debian just for a bare metal install? Or is there a openHABian qcow2 image I can use to create a VM of openHABian? Or is can it be used as the KVM/QEMU installation ISO and then we just tell virsh the OS type is Debian 11 or something for the VM?

Or, if I’m using a VM is openHABian off the table and I’m supposed to create the VM with Debian, then connect to its console, and follow the Linux Installation guide and use the apt install approach? When you go to Linux, there’s apt instructions but also just before it a link to openHABian instructions, so that’s where it gets a little confusing

This post is possibly redundant somewhere, but i’ve spent some days sifting through endless Raspberry PI commentary and haven’t seen really anything related to KVM/QEMU/libvirt

I just wanted to check because I’m going to probably in the next 24-48 hours create a VM with those specs, but if there was a more direct way to use openHABian to create the VM then i’d be happy to use that approach

One last question is related to the networking side.
I was going to put the openHAB into a subnet that has pretty much all of my IOT devices so they can broadcast to one another. Let me know if that sounds like a bad idea for any reason.

At it’s core openHABian is a bunch of bash scripts that takes a stock Raspberry Pi OS and installs, removes, and configures it to run openHAB and a bunch of related services. It comes with openhabian-config which will help you do administration tasks like upgrades and the like.

So create your Debian VM how ever you do and follow the manual installation instructions for openHABian to have it run and configure the OS for you.

There is no ISO, qcow2 image or anything VM image officially supported by OH. And as far as OH is concerned, running in a VM is no different from bare metal.

Yes, create a VM with Debian and then you can follow the apt instructions or these instructions. Do not enable zram for a VM.

You won’t find much because that is largely irrelevant. You’re either going to run OH in a container (Docker) or you aren’t. If you aren’t, then the instructions for a VM are the same for bare metal.

Your devices that you want to access the OH UI will have to be able to access OH too. Beyond that subnets for IOT stuff is pretty standard.

Thanks for the timely response good Sir.

“At it’s core openHABian is a bunch of bash scripts that takes a stock Raspberry Pi OS and installs, removes, and configures it to run openHAB and a bunch of related services. It comes with openhabian-config which will help you do administration tasks like upgrades and the like.” … “…the instructions for a VM are the same for bare metal.”

Ok that makes a lot of sense then about the bash scripting. So like you said later, just install the VM and follow the openHABian page.

“Your devices that you want to access the OH UI will have to be able to access OH too. Beyond that subnets for IOT stuff is pretty standard.” noted. will research this one more. thanks.

thanks again

One detail to add: Docker is not the only container solution :slight_smile:
I’m running openHAB ever since (2012) containerized, first with xen hypervisor as paravirtualized debian vm, but since ~ 2017(?) I’m using Proxmox VE with great success, this is KVM/LXC, and I’m using LXC with debian as basic template.
Keep in mind that paravirtualized or containerized vm do need much less resources.

When I looked into this I couldn’t figure out a way to do hardware passthrough to the container on Proxmox. Did I miss something?

I think overall I can improve my system utilization is I move to containers but the hardware passthrough has held me back. And since I use Zwave and Zigbee I need that passthrough.

That is worth noting. The format and structure for containers and images follow a standard so for the most part they are compatible with each other. This means you could run a container created from the same image on Docker, Kubernetes, LXC, etc. While what I said was technically true, there are enough differences between the Docker and Proxmox LXC environments to make it not super straight forward to create LXC containers from Docker images.

At least USB passthrough should work.
Another option (if it doesn’t work as described in the proxmox forum, here zwave stick) would be to use the usb/serial over ip option.
But to be honest, I don’t need hardware access for the openHAB container, so I don’t really use it.

Thanks. I’ll do a little reading on the Proxmox VE after I get this server install finished.

I’m still new to the container idea so still kind of foggy on the implementation and advantages of using containers and haven’t dove in to trying any yet.

I’ve only set up less than a handful of VMs before, all in Debian + KVM/QEMU/libvirt/ Virt Manager.

This go 'round I’ve been trying to do, as much as possible via CLI from SSH to internalize Debian CLI commands much better, so have been trying to do a lot with virsh commands instead of Virt Manager.

With the the way you’re using suggesting, is it sort of like the ProxMox VE is a GUI replacement for Virt manager and then instead of libvirt for VMs, LXC is containerizing?

At the time I first made a VM, I researched a little and chose KVM/QEMU because I liked the sound of “kernel based” hypervisor at the time and I also wanted to passthrough a network interface and hard disk to a VM, but now i stick with it mainly because it’s just “what I know”.

Not against trying new things though.
In the next few months i’ll have an old tower (intel core i3 coffee lake, 32 GB RAM) set up as my “test box” to do distro tests and other such fun learnings like ProxMox and can check that out then bring it over to my server once I test things.

Proxmox VE is using both KVM and LXC. It provides a Web GUI to manage the host and vm/container. But Proxmox VE is much more than only a KVM/LXC frontend, e.g. it provides ZFS as file system and/or ceph (if using more than two nodes).
There are many things which can’t be done via Proxmox GUI (yet), so the shell is your friend :slight_smile: and it’s a debian based system.

As someone who runs two VMs on Proxmox (both Ubuntu) and uses Docker to deploy all my services, I can say that it’s not an “either or” situation. It is valid and advantageous to use both.

Containers are a great way to provide isolation between services running on a single host without the need to have all the overhead required to run a full machine. All the containers running on a given host work with the same host Linux kernel (with VMs each VM runs it’s own kernel). This means less RAM, less CPU, and less storage is required. And while a container will require more resources than a bare metal install, a good container includes only the minimum necessary to run the one service that container represents, you don’t need everything (e.g. containers almost never include systemd or initd since they usually only run a single process).

Upgrades, running multiple instances of the same service in parallel, securing services so only certain other services can talk to them, etc is very easy with containers.

"When I looked into this I couldn’t figure out a way to do hardware pass-through to the container on Proxmox.

Alot of this is probably just me with low experience thinking out loud but

I think you can pass through USB and PCI devices in KVM/QEMU with the PCI bus numbers in an XML file maybe. So if this Proxmox VE is a layer on top of KVM/QEMU, maybe that can help make configuring that work. When I originally did a pass-through setup around spring 2021 for a PCIe network card, I believe I did it through Virt Manager, the GUI package to setup the VMs, but it sounds like with his method you’d install the KVM/QEMU packages but use this Proxmox VE to configure pass through based on his post.
On a recent Debian install, I was attempting to try HomeAssistant and pass through a USB network interface before deciding to wipe that out and go the openHAB route but it seemed to work. I asked ChatGPT (haha) to walk me through that to pass through a USB network interface, but I was using the virsh commands, but I think that’s part of libvirt so idk if libvirt is removed from the equation when using Proxmox VE and LXC. If so, maybe Proxmox is similar to Virt Manager where you’ll create the pass-through. Currently for this install i just setup the USB interface on a virtual bridge and was planning to use that to the guest, but idk that’s better

I’m still new to alot of things, but if using his config uses KVM/QEMU just needs XML configured to pass it through, but then the sticking point could be if your “guest OS” has drivers for these ZWave and Zigbee devices.

I’m about to use the Debian 12 Bookwork netinst ISO for installing this VM, but the libvirt/virt manager creation process doesn’t show higher than Debian 11 Buster. IDK much about the container approach as admitted, but i’d imagine if you can get those devices to work in Debian 11/12 that you could with a Debian VM/container on a pass through, I’ll wait for his response because it sounds like he may have more experience than me and maybe I can reference this later once I try containers and see if I can get passthrough going as well

While I’d be happy to try and give back to this forum, and might be able to later when I get better with this stuff, i’m still a bit novice in Linux so this might have not been very helpful haha

So, i’m into these openHABian steps currently; it said to edit the /etc/openhabian.conf “if desired”. I decided to poke my head into that file like the Kool-Aid man, but I see “zraminstall=enable”

is this where you’re saying to toggle that? or are you saying to let it roll and then later disable zram? This almost sounds like it’s whether to install the zram package, not necessarily whether to configure it to run

Just to be clear, you can definitely pass through hardware to a VM. It was just passthrough to LXC containers that wasn’t obvious. But looking at the API shows it’s possible.

But further research on my part has shown that LXC containers are intended to be more like VMs than micro services so they didn’t really serve my needs.

With Docker it’s a simple command line argument. Proxmox is the same.

As for drivers, they are serial devices. On Linux they just work.

Either way. There’s just no benefit to using zram if you are not running off of an SD card.

This is what I do. I run openHAB in a proxmox container, installed via openhabian, and I have my zwave stick on a raspberry pi connected to openHAB via serial.

It worked with the USB passthrough to the openHAB container, but I wanted to put the stick in a different location than where I have my little proxmox homelab setup.

I also have a zigbee coordinator, but I have it connected to Zigbee2MQTT running in a different container, again via serial.

1 Like