Use OpenHABian image for Virtualbox VM after conversion to .vdi

Hi to all,

I am rather new to Openhab. Due to network problems with docker I want to use OpenHABian with a Virtualbox virtual machine: therefore I converted the .img (from OpenHAB.org) to a.vdi with VBoxManage convertdd input.img output.vdi. Afterwards I created a virtual machine using the vdi. Unfortunately the machine is not able to boot. Did anybody have a similar experience and maybe found a solution?

Thank you in advance!

That .img file is an SD card image that expects to run on a Raspberry Pi. Raspberry Pis use an ARM processor. The docs for VirtualBox are pretty clear that only x86 type processors are supported.

It’s also not clear whether an SD card image is what is meant by “raw disk image” but I would expect you would need to at least provide some sort of variant flag to tell VBoxManage what sort of disk image it is. .img is not a standard. One .img file may have a completely different layout and structure from another one.

And even assuming that VirtualBox could support ARM VMs and it was able to figure out what to do with that .img file you’d have the problem that the openHABian image is deliberately and expressly written and designed to run on a Raspberry Pi. It’s going to expect certain hardware to be there in certain ways which will not be the case for a VM.

That’s at least three different ways this approach can not and will never work and it’s why nothing like this is anywhere in the OH docs.

I’m also skeptical that moving to a VM is going to magically fix your networking problems. Traditionally, it’s harder top get the networking right for VMs than it is for a container. So maybe it’s better to figure out why using the container wouldn’t work. Did you use the --net=host option like the docs say?

If you want to continue down the path of a VM, you’ll have to:

  1. Create your VM in the normal way
  2. Install the latest Debian on the VM
  3. Install openHAB following either (pay particular attention to the prerequisites):
    a. Do a manual installation of openHABian (see the full openHABian doc but pay particular attention to this section.
    b. Follow the Linux installation instructions: openHAB on Linux | openHAB

Dear Rich,

Thank you very much for the extremely fast and super detailed answer! Unfortunately I have to continue with the VM since Docker, despite I opened al necessary ports, cannot adequately communicate with Raspberrymatic (when I change the status of a device e.g. by pressing the button on the wall, opendocker does not get the statusupdate, while when I change the status in docker-openhab everything ist fine).
I will try again the solution indicated by you and give you a feedback.

I tried both solutions but I got stuck wich both. I gave up and will activate a old Raspberry. Too bad I can’t install it as a VM - would save me a device (and thus power and space). Thanks for taking the time to help me.

Your original problem doesn’t sound like a networking issue but a configuration issue. If you run using --net=host, it’s as if OH were running on that host network wise and it’s completely invisible that it’s running in a container. So if Raspberrymatic can’t communicate with OH, it’s probably because of some configuration issue. Since I know nothing about Raspberrymatic nor have you provided any details, :person_shrugging: .

Given that this is likely a configuration issue, I suspect that you wouldn’t see any difference in outcome when using the VM, only the VM configuration is more challenging because there’s no such thing as host networking mode. You have to do extra configs to make sure the VM is exposed to the network and it’s easy to mess that up. But even if you get that part right, if Raspberrymatic is configured incorrectly for sending it’s messages or the OH binding is configured incorrectly to receive them the result is going to be the same as the container config. But again, no details are provided so :person_shrugging: .

This topic was automatically closed 41 days after the last reply. New replies are no longer allowed.