How to run the latest Librem5 image on qemu on Macos

I’m following the guide here -> https://developer.puri.sm/Librem5/Development_Environment/Boards/qemu.html

However when I try to run it with ./qemu-system-x86_64 -boot menu=on -drive file=~/Downloads/qemu-x86_64.img -vga virtio -display gtk -m 2G -enable-kvm
it fails with “Display ‘gtk’ is not available”.

if I omit the display parameter it just hangs there. Using display = cocoa also hangs.

Anybody know how to work around this on Macos? Which display parameter should I use to see the booting screen?

First, don’t use -enable-kvm because that’s a Linux only feature.

I think I’ve managed to run it once but I didn’t save the exact command I used. Let me try later today…

First attempt,

$ qemu-system-x86_64 --version
QEMU emulator version 4.0.0
Copyright © 2003-2019 Fabrice Bellard and the QEMU Project developers

$ qemu-system-x86_64 -boot menu=on -drive file=qemu-x86_64.qcow2,format=qcow2 -vga virtio -m 3G

This booted and went all the way to switching the window shape to look like a phone but no graphics were displayed.

$ qemu-system-x86_64 -boot menu=on -drive file=qemu-x86_64.qcow2,format=qcow2 -vga virtio -m 3G -accel hvf -cpu host

So “-accel hvf” is supposed to be the macOS (10.10+) equivalent of “-enable-kvm”. However when I do this I cannot get past the boot menu (not even GRUB just the qemu boot menu).

Will keep trying.

Thanks, yeah, I’ve got the same results.
I’ve tried converting the qcow2 image to .vdi to run it on VirtualBox but it didn’t work stating there was no bootable media.

To run it in VBox you probably have to convert the qcow2 image to a different file format recognized by VBox…

I’ve managed to run the image under qemu under Linux. I did notice that under Linux the example runs sudo, and in my attempts above I didn’t run sudo. Will try again when I reboot…

Yeah, I’ve converted to .vdi which is a format that VirtualBox understands. Unfortunately, after setting up a VM to use that .vdi as the disk, it is unable to boot.
Initially the .vdi file was very small (< 1gb), but then I found a comment by a developer that adding -S 0 to the qemu-img convert command would help. Then the .vdi file ended up being 33gb, but didn’t boot either.
I then tried converting the .img file to a .iso so I could try to boot from it as the cdrom on the VM. That was also met with the same issue, not bootable.
I was able to install PureOS in a VM in Virtualbox. Once inside PureOS I was then able to download the qcow2 file and create a box for it using Gnome boxes. Naturally the performance was not that good.
I’m actually unsure if the performance was bad or I was having issues with the emulator recognizing my macbook trackpad. Cause I kept clicking and dragging to unlock the screen and it didn’t respond.
After much trial and error I managed to unlock the screen and enter the 123456 password and open the browser. I was unable however to find where are all the applications installed, I guess I need to learn more about how this mobile Gnome works.

Anyway, I hope to find a way to run the qcow2 image on macos so that I don’t have a VM within a VM LOL

Ok, I finally managed to get it working thanks to the helpful dude over at : How do I get Librem 5 in ISO image format to test on VirtualBox?

The issue seems to be that I was not using xz to unzip the image and as such I was getting a broken img file.
I’ve installed xz using brew, then xz-ed the latest img.xz file, then used the VBoxManage command to convert it to vdi, which is understood by VirtualBox.
I then created a 64 bit debian VM on virtual box and attached the vdi file to it as a hard drive.
It ran smoothly, very fast.

2 Likes