Macos – How to emulate Ubuntu 18.04 on MacOS using qemu

macosqemuUbuntuvirtual machinevirtualization

How can I run Ubuntu 18.04 on my MacBook Air (Mojave) using QEMU? (yes I have to use QEMU for now.) I got QEMU from here. But also got it from Homebrew as well.

I've tried looking at the QEMU's System Emulation User's Guide but I don't really understand it. I also found a rather good tutorial which seemed to suit me well but it doesn't work. I actually managed to get the "Install Ubuntu" up menu on screen a couple times, but then the cursor wouldn't work for some reason.
I first created a qcow2 file like this:

qemu-img create -f qcow2 ~/Desktop/QEMU/ubuntu.qcow2 25G

My qemu.command file is:

qemu-system-x86_64 \
  -m 2048 \
  -vga virtio \
  -show-cursor \
  -usb \
  -device usb-tablet \
  -enable-kvm \
  -cdrom ~/Desktop/QEMU/ubuntu.iso \
  -drive file=~/Desktop/QEMU/ubuntu.qcow2,if=virtio \
  -accel hvf \
  -cpu host

I still don't understand why it worked a couple times, and when it worked, the mouse didn't function.

I reinstalled the iso and created a new .qcow2 file and now every single time I am first greeted with some sort of command prompt followed by a purple screen, sometimes with the "Language" bar at the top (which I can't seem to interact with) and sometimes without, and then afterward some command stuff I don't understand (and can't copy and paste because the mouse doesn't move so I have a screenshot.).

If someone could explain what I am doing incorrectly and give me some sort of a simple guide, that would be very helpful :). Thank you!

Best Answer

If you change -cpu host to something else, like -cpu Penryn,kvm=on,vendor=GenuineIntel you most likely can get it working. Why that's happening I don't know. It could be a similar issue to this one https://github.com/Leoyzen/KVM-Opencore/issues/1 – when using host CPU QEMU doesn't re-create topology properly.

Related Question