QEMU command in Win v.s. macOS host

Anything about Mac emulation that does not belong in the above categories.

Moderators: Cat_7, Ronald P. Regensburg

Post Reply
User avatar
mabam
Master Emulator
Posts: 491
Joined: Wed Apr 10, 2013 9:32 am

QEMU command in Win v.s. macOS host

Post by mabam »

This is not actually about emulation, but about virtualisation. However, it shouldn't make a difference for this matter.

I have the following command line successfully starting QEMU and booting the VM on a macOS x86_64 host:

Code: Select all

#!/bin/bash
cd "$(dirname "$0")"

port=45002

qemu-system-x86_64 \
-L /usr/local/share/qemu \
-nodefaults \
-vga none \
-device e1000,mac=0A:AD:47:06:D2:2C,netdev=net0 \
-netdev user,id=net0 \
-device vmware-svga \
-cpu Penryn,+sse4.1,+sse4.2,+ssse3 \
-smp cpus=1,sockets=1,cores=1,threads=1 \
-machine q35,vmport=off,i8042=off,hpet=off \
-accel hvf \
-global ICH9-LPC.disable_s3=1 \
-drive if=pflash,format=raw,unit=0,file.filename=/usr/local/share/qemu/edk2-x86_64-code.fd,file.locking=off,readonly=on \
-drive "if=pflash,unit=1,file=./Drives/efi_vars.fd" \
-m 4096 \
-usb \
-device usb-tablet,bus=usb-bus.0 \
-device usb-mouse,bus=usb-bus.0 \
-device usb-kbd,bus=usb-bus.0 \
-device nec-usb-xhci,id=usb-controller-0 \
-device ide-hd,bus=ide.0,drive=EFI,bootindex=0 \
-drive "if=none,media=disk,id=EFI,file=./Drives/efi.qcow2,discard=unmap,detect-zeroes=unmap" \
-device ide-hd,bus=ide.1,drive=SLHD,bootindex=1 \
-drive "if=none,media=disk,id=SLHD,file=./Drives/Snow Leopard.qcow2,discard=unmap,detect-zeroes=unmap" \
-name "- Snow Leopard - Port $port" \
-monitor tcp:localhost:$port,server,nowait \
-uuid AE26E2AD-E73B-482E-BD6B-AD01BAA3BFFC \
-device virtio-rng-pci

Now I've installed QEMU on a Windows host and copied the folder with the QEMU command and a subfolder "Drives" with "Snow Leopard.qcow2", "efi.qcow2", and "efi_vars.fd" in it onto the Windows machine. I've amended the QEMU command as follows to hopefully meet the required syntax and different paths on the Windows host:

Code: Select all

"C:\Program Files\qemu\qemu-system-x86_64.exe" ^
-L "C:\Program Files\qemu\share" ^
-nodefaults ^
-vga none ^
-device e1000,mac=0A:AD:47:06:D2:2C,netdev=net0 ^
-netdev user,id=net0 ^
-device vmware-svga ^
-cpu Penryn,+sse4.1,+sse4.2,+ssse3 ^
-smp cpus=1,sockets=1,cores=1,threads=1 ^
-machine q35,vmport=off,i8042=off,hpet=off ^
-accel whpx ^
-global ICH9-LPC.disable_s3=1 ^
-drive if=pflash,format=raw,unit=0,file.filename="C:\Program Files\qemu\share\edk2-x86_64-code.fd",file.locking=off,readonly=on ^
-drive "if=pflash,unit=1,file=C:\Users\boe\Documents\mabam\Drives\efi_vars.fd" ^
-m 4096 ^
-usb ^
-device usb-tablet,bus=usb-bus.0 ^
-device usb-mouse,bus=usb-bus.0 ^
-device usb-kbd,bus=usb-bus.0 ^
-device nec-usb-xhci,id=usb-controller-0 ^
-device ide-hd,bus=ide.0,drive=EFI,bootindex=0 ^
-drive "if=none,media=disk,id=EFI,file=C:\Users\boe\Documents\mabam\Drives\efi.qcow2,discard=unmap,detect-zeroes=unmap" ^
-device ide-hd,bus=ide.1,drive=SLHD,bootindex=1 ^
-drive "if=none,media=disk,id=SLHD,file=C:\Users\boe\Documents\mabam\Drives\Snow Leopard.qcow2,discard=unmap,detect-zeroes=unmap" ^
-name "- Snow Leopard - Port 45002" ^
-monitor tcp:localhost:45002,server,nowait ^
-uuid AE26E2AD-E73B-482E-BD6B-AD01BAA3BFFC ^
-device virtio-rng-pci
However, when starting the .bat file, a shell window opens for a split second and nothing more seems to happen.

I'm sure something is wrong with the command in my .bat file. But I'm not very familar with Windows systems so I'd appreciate any help on this.
User avatar
Cat_7
Expert User
Posts: 6014
Joined: Fri Feb 13, 2004 8:59 am
Location: Sittard, The Netherlands

Re: QEMU command in Win v.s. macOS host

Post by Cat_7 »

I wouldn't know what might be wrong in that command line.
However, if you first start a command window and then execute the bat file from the command prompt, qemu will tell you what's wrong.

Best,
Cat_7
User avatar
mabam
Master Emulator
Posts: 491
Joined: Wed Apr 10, 2013 9:32 am

Re: QEMU command in Win v.s. macOS host

Post by mabam »

Thanks to your tip to execute the bat file from a command window, I got an error message saying:

Code: Select all

qemu-system-x86_64: WHPX: No accelerator found, hr=00000000
qemu-system-x86_64: failed to initialize whpx: No space left on device
I could fix that by activating the windows features "VM platform" and "Windows Hypervisor Platform".

However, there are new errors popping up now:

Code: Select all

(qemu:5008): Gtk-WARNING **: 10:09:49.583: Could not load a pixbuf from icon theme.
This may indicate that pixbuf loaders or the mime database could not be found.
qemu: WHPX: Failed to emulate MMIO access with EmulatorReturnStatus: 2
qemu: WHPX: Failed to exec a virtual processor
I can probably ignore the GTK warning. But googling didn't bring up a solution for the WHPX errors. Are there any suggestions?

:oops: Seems I was wrong with this:
mabam wrote: Mon Nov 13, 2023 9:48 pm This is not actually about emulation, but about virtualisation. However, it shouldn't make a difference for this matter.
User avatar
Cat_7
Expert User
Posts: 6014
Joined: Fri Feb 13, 2004 8:59 am
Location: Sittard, The Netherlands

Re: QEMU command in Win v.s. macOS host

Post by Cat_7 »

The gtk warning seems to be about missing window decorations.
Does qemu run when you remove the -accel whpx ^

Best,
Cat_7
User avatar
mabam
Master Emulator
Posts: 491
Joined: Wed Apr 10, 2013 9:32 am

Re: QEMU command in Win v.s. macOS host

Post by mabam »

Yeah, it's just slow.
User avatar
adespoton
Forum All-Star
Posts: 4076
Joined: Fri Nov 27, 2009 5:11 am
Location: Emaculation.com
Contact:

Re: QEMU command in Win v.s. macOS host

Post by adespoton »

mabam wrote: Tue Nov 14, 2023 3:07 pm Yeah, it's just slow.
Are you able to run a similar image using the built-in Hyper-V? https://techcommunity.microsoft.com/t5/ ... -p/3745905

It seems like something may still be disabled that the hypervisor requires.
User avatar
mabam
Master Emulator
Posts: 491
Joined: Wed Apr 10, 2013 9:32 am

Re: QEMU command in Win v.s. macOS host

Post by mabam »

That link looks promising, thank you!

I’ll follow-up in the end of next week, which is when I’ll be back at the windows machine.
Post Reply