MacOS Monterey as VM on TrueNAS Scale

Havocpsi

Cadet
Joined
Jun 16, 2023
Messages
4
This is a community forum. Participants are expected to participate. If there is something that you'd like to see that isn't currently here, by all means go ahead and create it.
i understand anout contributing. Im new here and this was intersting thankyou
 

Straafe

Dabbler
Joined
Mar 24, 2023
Messages
33
i understand anout contributing. Im new here and this was intersting thankyou
I have Monterey up and running in Scale following the instructions from the other users, if you run into problems or have a specific question let me know
 

Havocpsi

Cadet
Joined
Jun 16, 2023
Messages
4
I have Monterey up and running in Scale following the instructions from the other users, if you run into problems or have a specific question let me know
I have some workstations here I may just fire one up and try thanks alot man
 

Whattteva

Wizard
Joined
Mar 5, 2013
Messages
1,824
Has anyone made anymore progress on this? Is there gonna be a write up?
Well, it appears that @Straafe has made progress.
I installed Ventura a while ago, but if I ever need to reinstall, maybe I'll do a write-up.
 

sretalla

Powered by Neutrality
Moderator
Joined
Jan 1, 2016
Messages
9,703
A bunch of feature requests have been made which may or may not drop with Cobia which might bring the required settings closer to reality... then it's probably just a matter of adapting the instructions for proxmox, which are already out there and updated/maintained well for each version of MacOS.
 

troonas

Dabbler
Joined
Dec 9, 2021
Messages
26
That would be awesome im researching myself lit me please if you find out or figure it out
Ah sorry, I forgot about making a write-up. I'll try to get to that soon. If you're desperate to get up and running though, this thread should have everything you need. A write-up would just be formalizing everything already documented here.
 

Straafe

Dabbler
Joined
Mar 24, 2023
Messages
33
PSA - Updated to Cobia, and it broke my OSX VM. Other VM's seem to work fine though.
 

troonas

Dabbler
Joined
Dec 9, 2021
Messages
26
PSA - Updated to Cobia, and it broke my OSX VM. Other VM's seem to work fine though.
My VM broke too. This is what I did to get it running again:
Replaced -device usb-kbd,bus=usb.0,port=2 with -device '{"driver":"usb-kbd","id":"input1","bus":"usb.0","port":"2"}'. That fixed issues with complaints about the usb.0 bus not being found. I guess QEMU (kind of...?) dropped the old style driver config style syntax.

Next I had to change the virtual HDD driver from libvirt to AHCI to prevent boot from locking up.

Now the system is booted, but the virtual mouse + keyboard don't work and the network doesn't seem to be connecting. Ugh, starting to think I should just pick up a cheap used M1 Mac Mini for my mac needs. Running virtualized Mac OS is really becoming a chore...
 

Straafe

Dabbler
Joined
Mar 24, 2023
Messages
33
Ugh, starting to think I should just pick up a cheap used M1 Mac Mini for my mac needs
Nooo, stay strong brother! My need for a Mac is only for a few times a year when I need to compile some Xcode, so to me that doesn't justify the purchase of a device, despite how badly Apple says I have to.

I will try what you did with the USB. It's probably similar to yours, but this is the error I got on boot when I first tried to boot it (haven't had any time to troubleshoot since then).

Error: Traceback (most recent call last): File "/usr/lib/python3/dist-packages/middlewared/plugins/vm/supervisor/supervisor.py", line 182, in start if self.domain.create() < 0: ^^^^^^^^^^^^^^^^^^^^ File "/usr/lib/python3/dist-packages/libvirt.py", line 1373, in create raise libvirtError('virDomainCreate() failed') libvirt.libvirtError: internal error: qemu unexpectedly closed the monitor: 2023-11-08T17:57:25.202969Z qemu-system-x86_64: warning: host doesn't support requested feature: CPUID.80000001H:ECX.fma4 [bit 16] 2023-11-08T17:57:25.203655Z qemu-system-x86_64: warning: host doesn't support requested feature: CPUID.80000001H:ECX.fma4 [bit 16] 2023-11-08T17:57:25.204014Z qemu-system-x86_64: warning: host doesn't support requested feature: CPUID.80000001H:ECX.fma4 [bit 16] 2023-11-08T17:57:25.204326Z qemu-system-x86_64: warning: host doesn't support requested feature: CPUID.80000001H:ECX.fma4 [bit 16] 2023-11-08T17:57:25.213273Z qemu-system-x86_64: -device usb-kbd,bus=usb.0,port=2: Bus 'usb.0' not found During handling of the above exception, another exception occurred: Traceback (most recent call last): File "/usr/lib/python3/dist-packages/middlewared/main.py", line 201, in call_method result = await self.middleware._call(message['method'], serviceobj, methodobj, params, app=self) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/lib/python3/dist-packages/middlewared/main.py", line 1341, in _call return await methodobj(*prepared_call.args) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/lib/python3/dist-packages/middlewared/schema/processor.py", line 177, in nf return await func(*args, **kwargs) ^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/lib/python3/dist-packages/middlewared/schema/processor.py", line 44, in nf res = await f(*args, **kwargs) ^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/lib/python3/dist-packages/middlewared/plugins/vm/vm_lifecycle.py", line 54, in start await self.middleware.run_in_thread(self._start, vm['name']) File "/usr/lib/python3/dist-packages/middlewared/main.py", line 1254, in run_in_thread return await self.run_in_executor(self.thread_pool_executor, method, *args, **kwargs) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/lib/python3/dist-packages/middlewared/main.py", line 1251, in run_in_executor return await loop.run_in_executor(pool, functools.partial(method, *args, **kwargs)) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/lib/python3.11/concurrent/futures/thread.py", line 58, in run result = self.fn(*self.args, **self.kwargs) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/lib/python3/dist-packages/middlewared/plugins/vm/vm_supervisor.py", line 68, in _start self.vms[vm_name].start(vm_data=self._vm_from_name(vm_name)) File "/usr/lib/python3/dist-packages/middlewared/plugins/vm/supervisor/supervisor.py", line 191, in start raise CallError('\n'.join(errors)) middlewared.service_exception.CallError: [EFAULT] internal error: qemu unexpectedly closed the monitor: 2023-11-08T17:57:25.202969Z qemu-system-x86_64: warning: host doesn't support requested feature: CPUID.80000001H:ECX.fma4 [bit 16] 2023-11-08T17:57:25.203655Z qemu-system-x86_64: warning: host doesn't support requested feature: CPUID.80000001H:ECX.fma4 [bit 16] 2023-11-08T17:57:25.204014Z qemu-system-x86_64: warning: host doesn't support requested feature: CPUID.80000001H:ECX.fma4 [bit 16] 2023-11-08T17:57:25.204326Z qemu-system-x86_64: warning: host doesn't support requested feature: CPUID.80000001H:ECX.fma4 [bit 16] 2023-11-08T17:57:25.213273Z qemu-system-x86_64: -device usb-kbd,bus=usb.0,port=2: Bus 'usb.0' not found
 

troonas

Dabbler
Joined
Dec 9, 2021
Messages
26
Yeah, that's the exact same error I got. The -device ... CLI thing should fix that.

In my case, I have the macOS VM running 24/7 to run a Matrix-iMessage bridge to let me communicate with basically everyone I know over iMessage without me having to use an Apple device to do so. Totally crap reason to have to run physical Apple hardware, but I'm not sure what I'll do otherwise when Apple completely drops Intel support in a year or two, lol
 

Straafe

Dabbler
Joined
Mar 24, 2023
Messages
33
Where there's a will, there's a way! Also, I think that's a cool use case for a Mac VM, haha. I might start doing that, too.
 

danb35

Hall of Famer
Joined
Aug 16, 2011
Messages
15,504
I have the macOS VM running 24/7 to run a Matrix-iMessage bridge
I have the VM running on Proxmox, but for that same reason.
 

Straafe

Dabbler
Joined
Mar 24, 2023
Messages
33
but the virtual mouse + keyboard don't work
@troonas I was able to get mouse and keyboard working by modifying the config in CLI to this:

-usb -device usb-kbd,port=2 -device usb-mouse,port=3

Removed specifying bus entirely, added -usb, and then also had to add the mouse device. The problem is, for me at least, my mouse is offset in the VM from my real mouse which is really annoying, but I can log in and use mouse and keyboard after boot now which is nice.
 
Last edited:

troonas

Dabbler
Joined
Dec 9, 2021
Messages
26
Funny, I literally just got it working by adding this back into the command line: -global ICH9-LPC.acpi-pci-hotplug-with-bridge-support=off which I originally removed earlier on bluefin in this thread to get things to boot. That allows me to use the virtio disk driver again too and brought networking back. That fixed my mouse and keyboard too.

So to summarize the changes I did to get my VM working perfectly again:
  1. Added this back into the CLI args: -global ICH9-LPC.acpi-pci-hotplug-with-bridge-support=off
  2. Changed the USB keyboard setting from -device usb-kbd,bus=usb.0,port=2 with -device '{"driver":"usb-kbd","id":"input1","bus":"usb.0","port":"2"}'.
@Straafe glad you also found a workaround! Not sure if one is better than the other, but my mouse pointer seems to be aligned properly at least, heh.

Glad to not have to pay Tim Apple for new hardware!
 

troonas

Dabbler
Joined
Dec 9, 2021
Messages
26
I have the VM running on Proxmox, but for that same reason.
I had that originally, but really wanted to get rid of Proxmox for the kind of silly reason that I didn't like the warning logs printed by iSCSI probes, heh
 

Straafe

Dabbler
Joined
Mar 24, 2023
Messages
33
I switched to yours and the guest mouse indeed properly tracks to where my host mouse is again.
 

sfatula

Guru
Joined
Jul 5, 2022
Messages
608
I actually converted my libvirt, from ubuntu Mac, VM to truenas. Pretty much painless. It had been originally created via the link near the start of this thred from the osx-kvm project. It runs pretty quickly as you guys noted. Don't see any issues with it, not on Cobia yet. I did add the extra parms that the osx-kvm project had used such as +ssse3, etc.

Love Scale!
 
Joined
Nov 16, 2023
Messages
5
OK so far everything works in the instructions linked at the top (Kholia) up until the " ./OpenCore-Boot.sh" part.
The only change until then was running dmg2img on another machine (WSL on Win10 in my case) sicne its not available on truenas

I checked my available cpu types by running "qemu-system-x86_64 -machine help" and did not see x86-64 but did see q35 so I left q35 it there.

I think Straafe is talking about calling "CLI" when in the shell ang going from there. I found his "serve update vm" in there but that's AFTER i install a which we have not done yet so I'm missing a step.

When I try to run ./OpenCore-Boot.sh I just get the following. I tinkered with the script to see if I could fix it. Here is the following. Would love advice n how to create the VM from here.

OpenCore-Boot.sh
Code:
env bash

# Special thanks to:
# https://github.com/Leoyzen/KVM-Opencore
# https://github.com/thenickdude/KVM-Opencore/
# https://github.com/qemu/qemu/blob/master/docs/usb2.txt
#
# qemu-img create -f qcow2 mac_hdd_ng.img 128G
#
# echo 1 > /sys/module/kvm/parameters/ignore_msrs (this is required)

# This script works for Big Sur, Catalina, Mojave, and High Sierra. Tested with
# macOS 10.15.6, macOS 10.14.6, and macOS 10.13.6.
ALLOCATED_RAM="8196" # MiB
CPU_SOCKETS="1"
CPU_CORES="1"
CPU_THREADS="2"

REPO_PATH="/mnt/NVME_SSD_1/VenturaVM/OSX-KVM"
OVMF_DIR=""

# shellcheck disable=SC2054
args=(
  -enable-kvm -m "$ALLOCATED_RAM"
  -cpu host,kvm=on,vendor=GenuineIntel,+kvm_pv_unhalt,+kvm_pv_eoi,+hypervisor,+invtsc
  -machine q35
  -usb -device usb-kbd -device usb-tablet
  -smp "$CPU_THREADS",cores="$CPU_CORES",sockets="$CPU_SOCKETS"
  -device usb-ehci,id=ehci
  # -device usb-kbd,bus=ehci.0
  # -device usb-mouse,bus=ehci.0
  -device nec-usb-xhci,id=xhci
  -global nec-usb-xhci.msi=off
  # -global ICH9-LPC.acpi-pci-hotplug-with-bridge-support=off
  # -device usb-host,vendorid=0x8086,productid=0x0808  # 2 USD USB Sound Card
  # -device usb-host,vendorid=0x1b3f,productid=0x2008  # Another 2 USD USB Sound Card
  -device isa-applesmc,osk="ourhardworkbythesewordsguardedpleasedontsteal(c)AppleComputerInc"
  -drive if=pflash,format=raw,readonly=on,file="/mnt/NVME_SSD_1/VenturaVM/OSX-KVM/OVMF_CODE.fd"
  -drive if=pflash,format=raw,file="/mnt/NVME_SSD_1/VenturaVM/OSX-KVM/OVMF_VARS-1920x1080.fd"
  -smbios type=2
  -device ich9-intel-hda -device hda-duplex
  -device ich9-ahci,id=sata
  -drive id=OpenCoreBoot,if=none,snapshot=on,format=qcow2,file="/mnt/NVME_SSD_1/VenturaVM/OSX-KVM/OpenCore/OpenCore.qcow2"
  -device ide-hd,bus=sata.2,drive=OpenCoreBoot
  -device ide-hd,bus=sata.3,drive=InstallMedia
  -drive id=InstallMedia,if=none,file="/mnt/NVME_SSD_1/VenturaVM/OSX-KVM/BaseSystem.img",format=raw
  -drive id=MacHDD,if=none,file="/mnt/NVME_SSD_1/VenturaVM/OSX-KVM/mac_hdd_ng.img",format=qcow2
  -device ide-hd,bus=sata.4,drive=MacHDD
  # -netdev tap,id=net0,ifname=tap0,script=no,downscript=no -device virtio-net-pci,netdev=net0,id=net0,mac=52:54:00:c9:18:27
  -netdev user,id=net0,hostfwd=tcp::2222-:22 -device virtio-net-pci,netdev=net0,id=net0,mac=52:54:00:c9:18:27
  # -netdev user,id=net0 -device vmxnet3,netdev=net0,id=net0,mac=52:54:00:c9:18:27  # Note: Use this line for High Sierra
  -monitor stdio
  -device vmware-svga
  -smbios type=2
  -global nec-usb-xhci.msi=off
)

sudo qemu-system-x86_64 "${args[@]}"


Response:
1700276203522.png
 
Top