evaluate balena with qemu

Hi,
we are currently managing a fleet of about 250 embedded units.
I’m asked to evaluate balena as an alternative to our home build OS setup (based on Alpine Linux) to manage the fleet.
I want to evaluate fleet management with virtual devices to see how it scales up to our needs.
Therefore I need to deploy balenaOS to virtual devices. I wants to use qemu for this. But I cannot run images found on balenaOS web site with good results enough.
Is there some pointer to documentation how to run balenaOS on virtual qemu devices for testing?
Have a nice day,
Jean-Charles

Hello Jean-Charles, we have a guide on how to setup virtual devices provisioned through VirtualBox, it is a bit old but the information should still be relevant, https://www.balena.io/blog/no-hardware-use-virtualbox/ Setting up virtual devices with qemu should not be that different.
Could you expand a bit on how you tried to test this and what went wrong precisely?

Hi nazrhom,
thanks for your quick response.
I downloaded all images for R-Pi and Nuc from website and tried to launch them somehow with qemu.
I compiled latest qemu to be sure to include latest raspi boards emulation.
I could not make any r-Pi image run with qemu-system-arm. I even compiled the custom kernel7.img myself. It works for raspian but not for balenaOS :frowning:
and with qemy-system-x86_64, only the dev version of the nuc did start; the prod one being stuck in the boot process.
My goal is to test openBalena (and maybe balenaCloud) with a fleet of 100 emulated R-Pi zero to see if it fits our needs for fleet management and custom app stack deployment.
I’m trying for last three days to run balenaOS image with qemu without any success.
Any help or pointer to setup a virtual fleet of raspberry Pi zero running balenaOS is welcome :wink: and I will blog about it if I succeed…

Hi. We do have a QEMU image so not sure why it isn’t on that balena.io/os downloads page. Using the CLI you can get an unconfigured image via balena os download qemux86-64 --version latest -o my-image.img

Then according to the balenaCloud getting started you’d run it like this:

Run the following to start the image:
On systems with KVM support:
qemu-system-x86_64 -drive file=resin-image-qemux86-64.img,media=disk,cache=none,format=raw -net nic,model=virtio -net user -m 512 -nographic -machine type=pc,accel=kvm -smp 4 -cpu host
On systems without KVM support:
qemu-system-x86_64 -drive file=resin-image-qemux86-64.img,media=disk,cache=none,format=raw -net nic,model=virtio -net user -m 512 -nographic -machine type=pc -smp 4
Tweak -smp and -cpu parameters based on the CPU of the machine qemu is running on. -cpu parameter needs to be dropped on OSX and Windows.
Tweak -nographic and -m 512 to set the display of qemu and memory respectively.

Can you give that a try and let us know if you have issues?

Running that image with that command line on a Debian Stretch box with plenty of procs and RAM fails.
After about 3.2 seconds, the kernel reports “Error” and the system freezes.
I tried several times with variant around smp, memory, cpu, output mode with exact same results :frowning:

Thanks for the update. I can’t replicate that right now (I have QEMU running on a Mac here). I know it was linked above but have you tried running the NUC image with VirtualBox? The blog is dated but the instructions still work. I’m assuming you are testing this on an x86_64 machine.