[Support] SpaceinvaderOne - Macinabox


Recommended Posts

1 hour ago, blinside995 said:

Hello everyone, 

 

I was wondering if anyone was successful with getting content caching to work on their VM. 
If found this GitHub that seems to provide a workaround, but not really sure how to apply this change.. 

https://github.com/ofawx/VmAssetCacheEnable

 

Thanks in advance for your time and patience

 

UPDATE: sorry, this was in some way misleading.

It seems the patch is no longer working from big sur 11.3 beta, and it seems there's no ready workaround possible; see also here:

https://github.com/ofawx/VmAssetCacheEnable/issues/1

 

 

It was discussed here in the forum in the past.

Content caching is enabled (not greyed) in system preferences if the kernel doesn't see the VMM flag in cpu futures.

Easiest way is to apply a kernel patch in the bootloader (opencore): following patch will change the name of the VMM flag (to XXX) and content caching will be enabled.

Add this in the EFI/OC/config.plist

 

	<key>Kernel</key>
	<dict>
		<key>Add</key>
		<array>
.....
.....
		<key>Patch</key>
		<array>
.....
.....
			<dict>
				<key>Arch</key>
				<string>Any</string>
				<key>Base</key>
				<string></string>
				<key>Comment</key>
				<string>Block sysctl machdep.cpu.features VMM flag</string>
				<key>Count</key>
				<integer>1</integer>
				<key>Enabled</key>
				<true/>
				<key>Find</key>
				<data>AFZNTQA=</data>
				<key>Identifier</key>
				<string>kernel</string>
				<key>Limit</key>
				<integer>0</integer>
				<key>Mask</key>
				<data></data>
				<key>MaxKernel</key>
				<string></string>
				<key>MinKernel</key>
				<string></string>
				<key>Replace</key>
				<data>AFhYWAA=</data>
				<key>ReplaceMask</key>
				<data></data>
				<key>Skip</key>
				<integer>0</integer>
			</dict>
......
......
		</array>

 

Edited by ghost82
Link to comment

For me, the notification script does not seem to work. Running it as a background task right after finishing up the Docker installation, it tells me that MacOS is ready to install and I shall run the helper script (resulting in an error trying to start the VM).

Link to comment

I have tried endlessly to get my GPU passed through. I have a GT 640 and want to use it with my Big Sur VM created with macinabox. I followed all of the instructions perfectly in the @SpaceInvaderOne video and I also got imessage working by following the dortania guide.

 

With all of that said, I tried passing through my gpu and then i get this error in the logs:

 

2021-08-24T02:53:13.110949Z qemu-system-x86_64: -device vfio-pci,host=0000:0c:00.0,id=hostdev0,bus=pci.3,addr=0x0: Failed to mmap 0000:0c:00.0 BAR 1. Performance may be slow

 

I am running this VM headless but have a HDMI dummy plug.

 

I highly HIGHLY recommend to save your XML before trying to do GPU passthrough. I know for me when i removed the GPU passthrough and went back to VNC, I could not get the Big Sur VM to start.... I re-pasted the original XML for the VM and boom it works fine. With that said, no matter what I try for GPU passthrough with my GT 640, it doesn't work. I know its not working because i have teamviewer installed and have my VM auto-login. If anybody has ANY suggestions, I am willing to try anything. I think OSX requires a GPU because my VM is super slow...All of the animations are so choppy and i feel like a GPU will fix this slow performance issue.

 

Suggestions?

Link to comment
On 8/23/2021 at 8:07 PM, ritty said:

I have tried endlessly to get my GPU passed through. I have a GT 640 and want to use it with my Big Sur VM created with macinabox. I followed all of the instructions perfectly in the @SpaceInvaderOne video and I also got imessage working by following the dortania guide.

 

With all of that said, I tried passing through my gpu and then i get this error in the logs:

 

2021-08-24T02:53:13.110949Z qemu-system-x86_64: -device vfio-pci,host=0000:0c:00.0,id=hostdev0,bus=pci.3,addr=0x0: Failed to mmap 0000:0c:00.0 BAR 1. Performance may be slow

 

I am running this VM headless but have a HDMI dummy plug.

 

I highly HIGHLY recommend to save your XML before trying to do GPU passthrough. I know for me when i removed the GPU passthrough and went back to VNC, I could not get the Big Sur VM to start.... I re-pasted the original XML for the VM and boom it works fine. With that said, no matter what I try for GPU passthrough with my GT 640, it doesn't work. I know its not working because i have teamviewer installed and have my VM auto-login. If anybody has ANY suggestions, I am willing to try anything. I think OSX requires a GPU because my VM is super slow...All of the animations are so choppy and i feel like a GPU will fix this slow performance issue.

 

Suggestions?

I've tried everything that i can think of at this point. I changed the SMBIOS to iMac13,1 to ensure my GT 640 would match the SMBIOS...still didn't work. I really wish i could get this to work as my VM is sooo laggy....If anybody has any suggestions at all to reduce the lag then I am all ears.

Link to comment
10 hours ago, ritty said:

I've tried everything that i can think of at this point. I changed the SMBIOS to iMac13,1 to ensure my GT 640 would match the SMBIOS...still didn't work. I really wish i could get this to work as my VM is sooo laggy....If anybody has any suggestions at all to reduce the lag then I am all ears.

Hi @ritty,
Not sure exactly what is going on here because you haven't given us enough to work with...
I can't say for sure if this is a show stopping error or just a warning. So I don't know if the error is with the VM or the OS.

What is your system AMD/Intel and what video cards do you have installed?

What type of GT640 do you have?
- Fermi GF108/GF116 with support up to High Sierra or Kepler GK107/GK208 support up to Big Sur.
Have you tried dumping the GPU ROM and loading it in your VM XML?

https://forums.unraid.net/topic/84601-support-spaceinvaderone-macinabox/page/83/?tab=comments#comment-1007917

Have you tried getting the card working on Win10 VM?

Are you passing both the video and audio component of the card using multifunction? Point #3 on this post; https://forums.unraid.net/topic/84601-support-spaceinvaderone-macinabox/page/82/?tab=comments#comment-1000526
Have you tried stubbing the card under system devices?

Passing through Nvidia cards that are your primary GPU can be a bit tricky. Not sure if you have seen this post, along with the SpaceInvaderOne video.
https://forums.unraid.net/topic/71371-resolved-primary-gpu-passthrough/


Just some ideas to get you started... :)

 

Link to comment

So I'm watching the video, trying to install Big Sur, but when I get to the part where I start the VM and launch the VNC remote, it opens the normal window, but after several seconds of "Connecting...", I get the error "Failed to connect to server". I'm sorta stuck, what do I do next?

I'm on 6.10RC1, if that matters.

EDIT: Update, I was able to get it to connect using TightVNC. However, I now see that the VM is only booting to some sort of console mode, and seems to be showing errors, although I can't make out what it's complaining about exactly. Anyone know what I should try next?

cap001.jpg

Edited by Elmojo
added update
Link to comment
On 8/28/2021 at 10:59 PM, cat2devnull said:

Hi @ritty,
Not sure exactly what is going on here because you haven't given us enough to work with...
I can't say for sure if this is a show stopping error or just a warning. So I don't know if the error is with the VM or the OS.

What is your system AMD/Intel and what video cards do you have installed?

What type of GT640 do you have?
- Fermi GF108/GF116 with support up to High Sierra or Kepler GK107/GK208 support up to Big Sur.
Have you tried dumping the GPU ROM and loading it in your VM XML?

https://forums.unraid.net/topic/84601-support-spaceinvaderone-macinabox/page/83/?tab=comments#comment-1007917

Have you tried getting the card working on Win10 VM?

Are you passing both the video and audio component of the card using multifunction? Point #3 on this post; https://forums.unraid.net/topic/84601-support-spaceinvaderone-macinabox/page/82/?tab=comments#comment-1000526
Have you tried stubbing the card under system devices?

Passing through Nvidia cards that are your primary GPU can be a bit tricky. Not sure if you have seen this post, along with the SpaceInvaderOne video.
https://forums.unraid.net/topic/71371-resolved-primary-gpu-passthrough/


Just some ideas to get you started... :)

 

Thanks @cat2devnull. The information is much appreciated and I am sure that will help others get it figured out! I tried each of those and still ran into issues. With that said, I am also not as technically skilled as many on here so I guess I just accepted defeat and decided to buy an old 2015 mac to have as a imessage server. It's quick and snappy and runs Big Sur with zero issues so I am happy I don't have to deal with that major lag I was getting with the MacOS VM.

 

Appreciated the good info and I truly hope it helps many others on this board!

 

Cheers,

Link to comment

First, let me say that the guide from Spaceinvader One is thorough and well explained.

Second, I am either experiencing difficulties with hardware or configuration. I have gone through the process 4 times and have difficulties every time. I change only the items that need to be changed at the appropriate step. I can get through the install process of Big Sur but, once complete, I cannot get the vm to consistently boot correctly and, once it does boot into BigSur, I am unable to login with my apple id.

 

At one point, after complete installation, I got an error that the machine had been used too many times to complete the appleid login. You might ask if I verified that I had an invalid serial number when checking coverage in Opencore Configurator. The answer is yes, I made sure I had an invalid serial number. So, not sure what any of this means but not sure I will try again.

 

I have a 2017 macbook air but my hope was that I could have the vm run in the background from my Windows machine to have iMessage and other apps available. I have not added any real specifics about my issue because I am no longer trying to get this working. Maybe I will try again in a few weeks.

 

Good luck to you guys who are getting it figured out.

I run a dual xeon 5630 system with 20GB of ram.

Link to comment
On 8/31/2021 at 9:01 PM, Okrah Wimpey said:

I got an error that the machine had been used too many times to complete the appleid login

It seems you "played" too much with your vm :D

This usually happens when you change too many times the smbios data with internet connected.

It could be server locked by apple.

1. verify your smbios data, serial must be invalid as you wrote

2. verify that you have en0 "built-in"

3. delete your additional devices (if any):

3a. login to appleid, under "devices", delete additional devices (following picture as example):

 

1u.png.ca0b93c97c8e586667787a3ef68681bb.png

 

3b. login to icloud, go to find my device, on the top click on "all devices" and verify that you don't have additional devices:

 

2u.png.c00b28a7d8aeb3d267864494a06b377c.png

 

Once you have all these things verified, do not change anymore your smbios data and try to login; if it fails, write the specific error message.

 

At the beginning I had the same issue, but with a different error message, with a code to unlock the account, and the only way was calling apple to unlock the account.

Note that you may find comprehensive technicians or not, even if you can run mac os on a vm on a mac hardware as host, some technicians will not give any help.

Just call again, I had to call 2 times.

Link to comment
On 8/28/2021 at 10:59 PM, cat2devnull said:

Hi @ritty,
Not sure exactly what is going on here because you haven't given us enough to work with...
I can't say for sure if this is a show stopping error or just a warning. So I don't know if the error is with the VM or the OS.

What is your system AMD/Intel and what video cards do you have installed?

What type of GT640 do you have?
- Fermi GF108/GF116 with support up to High Sierra or Kepler GK107/GK208 support up to Big Sur.
Have you tried dumping the GPU ROM and loading it in your VM XML?

https://forums.unraid.net/topic/84601-support-spaceinvaderone-macinabox/page/83/?tab=comments#comment-1007917

Have you tried getting the card working on Win10 VM?

Are you passing both the video and audio component of the card using multifunction? Point #3 on this post; https://forums.unraid.net/topic/84601-support-spaceinvaderone-macinabox/page/82/?tab=comments#comment-1000526
Have you tried stubbing the card under system devices?

Passing through Nvidia cards that are your primary GPU can be a bit tricky. Not sure if you have seen this post, along with the SpaceInvaderOne video.
https://forums.unraid.net/topic/71371-resolved-primary-gpu-passthrough/


Just some ideas to get you started... :)

 

Thank you @cat2devnull  - I finally got it working!!! It took multiple things to make it work. This is what worked for me:

 

1. Assign graphics card, bios, AND sound card (from gpu) in unraid template. Press save.

2. Run @SpaceInvaderOne script macinabox_helper - did not remove topology, kept as "custom" and set first install to "no.

3. Edited the XML and made these changes:

   a) Set multifunction='on' for gpu

   b) Changed sound function from 0x0 to 0x1

   c) Changed graphics bus from 0x03 to 0x00 on gpu AND changed slot from 0x00 to 0x03 since the 00, 01, and 02 slots were taken already (THIS STEP WAS THE CRITICAL STEP THAT TOOK FOREVER FOR ME TO GET)

   d) Changed sound bus from 0x04 to 0x00 and changed slot from 0x00 to 0x03 -> this needs to match the graphics address.

 

BOOOOOOMMM and then it worked.

 

Hope this helps somebody else.

 

Cheers,

Link to comment
1 minute ago, ritty said:

Changed graphics bus from 0x03 to 0x00

Hi, this is not recommended, since bus 0x00 means "built-in" and the gpu is never attached to bus 0 in macs.

I recommend to change bus 0 (both video and audio) to something else.

Remember that a pcie device attached to bus x means that you have attached to a pcie-root-port with index=x.

For example:

    <controller type='pci' index='5' model='pcie-root-port'>
      <model name='pcie-root-port'/>
      <target chassis='5' port='0xa'/>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x01' function='0x2'/>
    </controller>

this pcie-root-port will give bus 0x05, so to attach the gpu to this bus:

    <hostdev mode='subsystem' type='pci' managed='yes'>
      <driver name='vfio'/>
      <source>
        <address domain='0x0000' bus='0x04' slot='0x00' function='0x0'/>
      </source>
      <address type='pci' domain='0x0000' bus='0x05' slot='0x00' function='0x0' multifunction='on'/>
    </hostdev>
    <hostdev mode='subsystem' type='pci' managed='yes'>
      <driver name='vfio'/>
      <source>
        <address domain='0x0000' bus='0x04' slot='0x00' function='0x1'/>
      </source>
      <address type='pci' domain='0x0000' bus='0x05' slot='0x00' function='0x1'/>
    </hostdev>

 

See the <address> lines attached to bus 0x05.

 

If you find to be too difficult just post your xml.

Link to comment
8 hours ago, ghost82 said:

Hi, this is not recommended, since bus 0x00 means "built-in" and the gpu is never attached to bus 0 in macs.

I recommend to change bus 0 (both video and audio) to something else.

Remember that a pcie device attached to bus x means that you have attached to a pcie-root-port with index=x.

For example:

    <controller type='pci' index='5' model='pcie-root-port'>
      <model name='pcie-root-port'/>
      <target chassis='5' port='0xa'/>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x01' function='0x2'/>
    </controller>

this pcie-root-port will give bus 0x05, so to attach the gpu to this bus:

    <hostdev mode='subsystem' type='pci' managed='yes'>
      <driver name='vfio'/>
      <source>
        <address domain='0x0000' bus='0x04' slot='0x00' function='0x0'/>
      </source>
      <address type='pci' domain='0x0000' bus='0x05' slot='0x00' function='0x0' multifunction='on'/>
    </hostdev>
    <hostdev mode='subsystem' type='pci' managed='yes'>
      <driver name='vfio'/>
      <source>
        <address domain='0x0000' bus='0x04' slot='0x00' function='0x1'/>
      </source>
      <address type='pci' domain='0x0000' bus='0x05' slot='0x00' function='0x1'/>
    </hostdev>

 

See the <address> lines attached to bus 0x05.

 

If you find to be too difficult just post your xml.

The VM doesnt work unless i keep the bus as 0x00 so I think it needs to remain that way @ghost82 but my XML is below. Hopefully there is a good explanation

 

<?xml version='1.0' encoding='UTF-8'?>
<domain type='kvm' xmlns:qemu='http://libvirt.org/schemas/domain/qemu/1.0'>
  <name>Macinabox BigSur</name>
  <uuid>xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx</uuid>
  <description>MacOS Big Sur</description>
  <metadata>
    <vmtemplate xmlns="unraid" name="Windows 10" icon="BigSur.png" os="osx"/>
  </metadata>
  <memory unit='KiB'>8388608</memory>
  <currentMemory unit='KiB'>8388608</currentMemory>
  <memoryBacking>
    <nosharepages/>
  </memoryBacking>
  <vcpu placement='static'>8</vcpu>
  <cputune>
    <vcpupin vcpu='0' cpuset='0'/>
    <vcpupin vcpu='1' cpuset='6'/>
    <vcpupin vcpu='2' cpuset='1'/>
    <vcpupin vcpu='3' cpuset='7'/>
    <vcpupin vcpu='4' cpuset='2'/>
    <vcpupin vcpu='5' cpuset='8'/>
    <vcpupin vcpu='6' cpuset='3'/>
    <vcpupin vcpu='7' cpuset='9'/>
  </cputune>
  <os>
    <type arch='x86_64' machine='pc-q35-4.2'>hvm</type>
    <loader readonly='yes' type='pflash'>/mnt/user/system/custom_ovmf/Macinabox_CODE-pure-efi.fd</loader>
    <nvram>/etc/libvirt/qemu/nvram/8ea67332-9908-4c8e-88da-98c9babcf1b6_VARS-pure-efi.fd</nvram>
  </os>
  <features>
    <acpi/>
    <apic/>
  </features>
  <cpu mode='host-passthrough' check='none' migratable='on'>
    <topology sockets='1' dies='1' cores='4' threads='2'/>
    <cache mode='passthrough'/>
    <feature policy='require' name='topoext'/>
  </cpu>
  <clock offset='utc'>
    <timer name='rtc' tickpolicy='catchup'/>
    <timer name='pit' tickpolicy='delay'/>
    <timer name='hpet' present='no'/>
  </clock>
  <on_poweroff>destroy</on_poweroff>
  <on_reboot>restart</on_reboot>
  <on_crash>restart</on_crash>
  <devices>
    <emulator>/usr/local/sbin/qemu</emulator>
    <disk type='file' device='disk'>
      <driver name='qemu' type='raw' cache='writeback'/>
      <source file='/mnt/user/domains/Macinabox BigSur/macos_disk.img'/>
      <target dev='hdc' bus='sata'/>
      <boot order='1'/>
      <address type='drive' controller='0' bus='0' target='0' unit='2'/>
    </disk>
    <controller type='usb' index='0' model='ich9-ehci1'>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x07' function='0x7'/>
    </controller>
    <controller type='usb' index='0' model='ich9-uhci1'>
      <master startport='0'/>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x07' function='0x0' multifunction='on'/>
    </controller>
    <controller type='usb' index='0' model='ich9-uhci2'>
      <master startport='2'/>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x07' function='0x1' multifunction='on'/>
    </controller>
    <controller type='usb' index='0' model='ich9-uhci3'>
      <master startport='4'/>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x07' function='0x2'/>
    </controller>
    <controller type='pci' index='0' model='pcie-root'/>
    <controller type='pci' index='1' model='pcie-root-port'>
      <model name='pcie-root-port'/>
      <target chassis='1' port='0x8'/>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x01' function='0x0' multifunction='on'/>
    </controller>
    <controller type='pci' index='2' model='pcie-root-port'>
      <model name='pcie-root-port'/>
      <target chassis='2' port='0x9'/>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x01' function='0x1'/>
    </controller>
    <controller type='pci' index='3' model='pcie-root-port'>
      <model name='pcie-root-port'/>
      <target chassis='3' port='0x12'/>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x02' function='0x2'/>
    </controller>
    <controller type='pci' index='4' model='pcie-root-port'>
      <model name='pcie-root-port'/>
      <target chassis='4' port='0x13'/>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x02' function='0x3'/>
    </controller>
    <controller type='virtio-serial' index='0'>
      <address type='pci' domain='0x0000' bus='0x02' slot='0x00' function='0x0'/>
    </controller>
    <controller type='sata' index='0'>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x1f' function='0x2'/>
    </controller>
    <interface type='bridge'>
      <mac address='52:54:00:d9:66:31'/>
      <source bridge='br0'/>
      <model type='e1000-82545em'/>
      <address type='pci' domain='0x0000' bus='0x01' slot='0x00' function='0x0'/>
    </interface>
    <serial type='pty'>
      <target type='isa-serial' port='0'>
        <model name='isa-serial'/>
      </target>
    </serial>
    <console type='pty'>
      <target type='serial' port='0'/>
    </console>
    <channel type='unix'>
      <target type='virtio' name='org.qemu.guest_agent.0'/>
      <address type='virtio-serial' controller='0' bus='0' port='1'/>
    </channel>
    <input type='tablet' bus='usb'>
      <address type='usb' bus='0' port='1'/>
    </input>
    <input type='mouse' bus='ps2'/>
    <input type='keyboard' bus='ps2'/>
    <hostdev mode='subsystem' type='pci' managed='yes'>
      <driver name='vfio'/>
      <source>
        <address domain='0x0000' bus='0x0c' slot='0x00' function='0x0'/>
      </source>
      <rom file='/mnt/user/isos/vbios/Downloaded Header Removed/DellGT640.rom'/>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x03' function='0x0' multifunction='on'/>
    </hostdev>
    <hostdev mode='subsystem' type='pci' managed='yes'>
      <driver name='vfio'/>
      <source>
        <address domain='0x0000' bus='0x0c' slot='0x00' function='0x1'/>
      </source>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x03' function='0x1'/>
    </hostdev>
    <memballoon model='none'/>
  </devices>
  <qemu:commandline>
    <qemu:arg value='-usb'/>
    <qemu:arg value='-device'/>
    <qemu:arg value='usb-kbd,bus=usb-bus.0'/>
    <qemu:arg value='-device'/>
    <qemu:arg value='isa-applesmc,osk=xxxxxx'/>
    <qemu:arg value='-smbios'/>
    <qemu:arg value='type=2'/>
    <qemu:arg value='-cpu'/>
    <qemu:arg value='Penryn,kvm=on,vendor=GenuineIntel,+invtsc,vmware-cpuid-freq=on,+pcid,+ssse3,+sse4.2,+popcnt,+avx,+aes,+xsave,+xsaveopt,check'/>
  </qemu:commandline>
</domain>

 

Link to comment
9 hours ago, Elmojo said:

Hi all,

Does anyone have any input on my issue? I'd like to get this working if possible. See my post from Aug 30, please.

 

Again unfortunately there isn't enough here for us to go on.

It's complaining about the OS.dmg.root_hash which makes me think that there is an issue with the image that was downloaded...

 

Given that you are working with a VM, most of the normal hardware compatibility issues should not exist because it's all virtualized. Hence there is most likely something about your VM config that is incorrect and causing an issue.
Start again from scratch with a fresh docker and OS download. Don't try to pass any hardware through at first, just get the system booting and then worry about USB/GPU/etc.


Apple have a tendency to keep changing the product IDs of their OS images and of course new versions come out all the time. It is a lot of work to keep the Macinabox code up to date and probably more than Spacinvaderone was counting on.

 

@ghost82 has been hard at work to fix a lot of these issues;

https://github.com/SpaceinvaderOne/Macinabox/commit/2aba67bc2738d3ecc7a156a1a9b897665d6982ff

https://forums.unraid.net/topic/84601-support-spaceinvaderone-macinabox/page/84/?tab=comments#comment-1010581

 

This was for OpenCore 0.7.0 and Mac OS 11.4

I'm not sure on the state of this work now with OpenCore 0.7.2 and Mac OS 11.5 being out.

 

Take a look at the dortania debug guide. You may need to install the debug version of OpenCore to get more information. 

https://dortania.github.io/OpenCore-Install-Guide/troubleshooting/extended/kernel-issues.html#stuck-on-eb-log-exitbs-start

 

You can also just try building your own setup from scratch. It isn't that bad if you don't mind investing some time to tinker. https://dortania.github.io/OpenCore-Install-Guide/
It's pretty rewarding.

  • Like 1
Link to comment

All I did was watch SIO's video, click through the docker settings as shown in the video, accept all the defaults, and click start. According to the instructions, that should be all that's required to get the basic image up and running. I didn't make any edits to any VM settings. I'm not sure what I could have done wrong, but anything's possible. :)

Since this isn't really anything beyond a curiosity to me, I likely won't put much effort into it. Even if I had a running Mac VM, I don't really have any use for it.

Link to comment
10 hours ago, ritty said:

The VM doesnt work unless i keep the bus as 0x00 so I think it needs to remain that way

 

What do you mean by "doesn't work"?

 

Anyway, this is optimized, replace the whole xml (add again the osk at the end of the xml and the machine uuid at the top of the xml), save and start.

 

Changes:

1. Moved pcie-root-port index 3 and index 4 from slot 0x02 to slot 0x01, into the already existing multifunction; there's no need to use another slot

 

2. Moved ethernet from bus 0x01 to bus 0x00, and from slot 0x00 to slot 0x02 so it's built-in (slot 0x00 is already in use by host bridge, slot 0x01 is already in use by pcie-root-port with index=1)

 

3. Moved gpu from bus 0x00 to bus 0x01, slot 0x00 (first slot not in use on bus 0x01)

 

4. Moved first usb ehci1/uhci1 from slot 0x07 to slot 0x03 (first slot not in use on bus 0x00)
Moved ehci1 from function 0x07 to function 0x01 (first function not in use on bus 0x00, slot 0x03)

 

5. Deleted usb controllers uhci2 and uhci3, no need

 

6. Changed from pc-q35-4.2 to pc-q35-5.1 (please check that your unraid version (qemu) supports the 5.1, otherwise set it to max supported version)

 

This is the topology of the following xml:

 

Topology.png.378556ce07c66699bacd12ccb24f96cd.png

 

vm xml:

<?xml version='1.0' encoding='UTF-8'?>
<domain type='kvm' xmlns:qemu='http://libvirt.org/schemas/domain/qemu/1.0'>
  <name>Macinabox BigSur</name>
  <uuid>xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx</uuid>
  <description>MacOS Big Sur</description>
  <metadata>
    <vmtemplate xmlns="unraid" name="Windows 10" icon="BigSur.png" os="osx"/>
  </metadata>
  <memory unit='KiB'>8388608</memory>
  <currentMemory unit='KiB'>8388608</currentMemory>
  <memoryBacking>
    <nosharepages/>
  </memoryBacking>
  <vcpu placement='static'>8</vcpu>
  <cputune>
    <vcpupin vcpu='0' cpuset='0'/>
    <vcpupin vcpu='1' cpuset='6'/>
    <vcpupin vcpu='2' cpuset='1'/>
    <vcpupin vcpu='3' cpuset='7'/>
    <vcpupin vcpu='4' cpuset='2'/>
    <vcpupin vcpu='5' cpuset='8'/>
    <vcpupin vcpu='6' cpuset='3'/>
    <vcpupin vcpu='7' cpuset='9'/>
  </cputune>
  <os>
    <type arch='x86_64' machine='pc-q35-5.1'>hvm</type>
    <loader readonly='yes' type='pflash'>/mnt/user/system/custom_ovmf/Macinabox_CODE-pure-efi.fd</loader>
    <nvram>/etc/libvirt/qemu/nvram/8ea67332-9908-4c8e-88da-98c9babcf1b6_VARS-pure-efi.fd</nvram>
  </os>
  <features>
    <acpi/>
    <apic/>
  </features>
  <cpu mode='host-passthrough' check='none' migratable='on'>
    <topology sockets='1' dies='1' cores='4' threads='2'/>
    <cache mode='passthrough'/>
    <feature policy='require' name='topoext'/>
  </cpu>
  <clock offset='utc'>
    <timer name='rtc' tickpolicy='catchup'/>
    <timer name='pit' tickpolicy='delay'/>
    <timer name='hpet' present='no'/>
  </clock>
  <on_poweroff>destroy</on_poweroff>
  <on_reboot>restart</on_reboot>
  <on_crash>restart</on_crash>
  <devices>
    <emulator>/usr/local/sbin/qemu</emulator>
    <disk type='file' device='disk'>
      <driver name='qemu' type='raw' cache='writeback'/>
      <source file='/mnt/user/domains/Macinabox BigSur/macos_disk.img'/>
      <target dev='hdc' bus='sata'/>
      <boot order='1'/>
      <address type='drive' controller='0' bus='0' target='0' unit='2'/>
    </disk>
    <controller type='usb' index='0' model='ich9-ehci1'>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x03' function='0x1'/>
    </controller>
    <controller type='usb' index='0' model='ich9-uhci1'>
      <master startport='0'/>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x03' function='0x0' multifunction='on'/>
    </controller>
    <controller type='pci' index='0' model='pcie-root'/>
    <controller type='pci' index='1' model='pcie-root-port'>
      <model name='pcie-root-port'/>
      <target chassis='1' port='0x8'/>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x01' function='0x0' multifunction='on'/>
    </controller>
    <controller type='pci' index='2' model='pcie-root-port'>
      <model name='pcie-root-port'/>
      <target chassis='2' port='0x9'/>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x01' function='0x1'/>
    </controller>
    <controller type='pci' index='3' model='pcie-root-port'>
      <model name='pcie-root-port'/>
      <target chassis='3' port='0x12'/>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x01' function='0x2'/>
    </controller>
    <controller type='pci' index='4' model='pcie-root-port'>
      <model name='pcie-root-port'/>
      <target chassis='4' port='0x13'/>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x01' function='0x3'/>
    </controller>
    <controller type='virtio-serial' index='0'>
      <address type='pci' domain='0x0000' bus='0x02' slot='0x00' function='0x0'/>
    </controller>
    <controller type='sata' index='0'>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x1f' function='0x2'/>
    </controller>
    <interface type='bridge'>
      <mac address='52:54:00:d9:66:31'/>
      <source bridge='br0'/>
      <model type='e1000-82545em'/>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x02' function='0x0'/>
    </interface>
    <serial type='pty'>
      <target type='isa-serial' port='0'>
        <model name='isa-serial'/>
      </target>
    </serial>
    <console type='pty'>
      <target type='serial' port='0'/>
    </console>
    <channel type='unix'>
      <target type='virtio' name='org.qemu.guest_agent.0'/>
      <address type='virtio-serial' controller='0' bus='0' port='1'/>
    </channel>
    <input type='tablet' bus='usb'>
      <address type='usb' bus='0' port='1'/>
    </input>
    <input type='mouse' bus='ps2'/>
    <input type='keyboard' bus='ps2'/>
    <hostdev mode='subsystem' type='pci' managed='yes'>
      <driver name='vfio'/>
      <source>
        <address domain='0x0000' bus='0x0c' slot='0x00' function='0x0'/>
      </source>
      <rom file='/mnt/user/isos/vbios/Downloaded Header Removed/DellGT640.rom'/>
      <address type='pci' domain='0x0000' bus='0x01' slot='0x00' function='0x0' multifunction='on'/>
    </hostdev>
    <hostdev mode='subsystem' type='pci' managed='yes'>
      <driver name='vfio'/>
      <source>
        <address domain='0x0000' bus='0x0c' slot='0x00' function='0x1'/>
      </source>
      <address type='pci' domain='0x0000' bus='0x01' slot='0x00' function='0x1'/>
    </hostdev>
    <memballoon model='none'/>
  </devices>
  <qemu:commandline>
    <qemu:arg value='-usb'/>
    <qemu:arg value='-device'/>
    <qemu:arg value='usb-kbd,bus=usb-bus.0'/>
    <qemu:arg value='-device'/>
    <qemu:arg value='isa-applesmc,osk=xxxxxx'/>
    <qemu:arg value='-smbios'/>
    <qemu:arg value='type=2'/>
    <qemu:arg value='-cpu'/>
    <qemu:arg value='Penryn,kvm=on,vendor=GenuineIntel,+invtsc,vmware-cpuid-freq=on,+pcid,+ssse3,+sse4.2,+popcnt,+avx,+aes,+xsave,+xsaveopt,check'/>
  </qemu:commandline>
</domain>

 

Edited by ghost82
Link to comment
5 hours ago, ghost82 said:

 

What do you mean by "doesn't work"?

 

Anyway, this is optimized, replace the whole xml (add again the osk at the end of the xml and the machine uuid at the top of the xml), save and start.

 

Changes:

1. Moved pcie-root-port index 3 and index 4 from slot 0x02 to slot 0x01, into the already existing multifunction; there's no need to use another slot

 

2. Moved ethernet from bus 0x01 to bus 0x00, and from slot 0x00 to slot 0x02 so it's built-in (slot 0x00 is already in use by host bridge, slot 0x01 is already in use by pcie-root-port with index=1)

 

3. Moved gpu from bus 0x00 to bus 0x01, slot 0x00 (first slot not in use on bus 0x01)

 

4. Moved first usb ehci1/uhci1 from slot 0x07 to slot 0x03 (first slot not in use on bus 0x00)
Moved ehci1 from function 0x07 to function 0x01 (first function not in use on bus 0x00, slot 0x03)

 

5. Deleted usb controllers uhci2 and uhci3, no need

 

6. Changed from pc-q35-4.2 to pc-q35-5.1 (please check that your unraid version (qemu) supports the 5.1, otherwise set it to max supported version)

 

This is the topology of the following xml:

 

Topology.png.378556ce07c66699bacd12ccb24f96cd.png

 

vm xml:

<?xml version='1.0' encoding='UTF-8'?>
<domain type='kvm' xmlns:qemu='http://libvirt.org/schemas/domain/qemu/1.0'>
  <name>Macinabox BigSur</name>
  <uuid>xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx</uuid>
  <description>MacOS Big Sur</description>
  <metadata>
    <vmtemplate xmlns="unraid" name="Windows 10" icon="BigSur.png" os="osx"/>
  </metadata>
  <memory unit='KiB'>8388608</memory>
  <currentMemory unit='KiB'>8388608</currentMemory>
  <memoryBacking>
    <nosharepages/>
  </memoryBacking>
  <vcpu placement='static'>8</vcpu>
  <cputune>
    <vcpupin vcpu='0' cpuset='0'/>
    <vcpupin vcpu='1' cpuset='6'/>
    <vcpupin vcpu='2' cpuset='1'/>
    <vcpupin vcpu='3' cpuset='7'/>
    <vcpupin vcpu='4' cpuset='2'/>
    <vcpupin vcpu='5' cpuset='8'/>
    <vcpupin vcpu='6' cpuset='3'/>
    <vcpupin vcpu='7' cpuset='9'/>
  </cputune>
  <os>
    <type arch='x86_64' machine='pc-q35-5.1'>hvm</type>
    <loader readonly='yes' type='pflash'>/mnt/user/system/custom_ovmf/Macinabox_CODE-pure-efi.fd</loader>
    <nvram>/etc/libvirt/qemu/nvram/8ea67332-9908-4c8e-88da-98c9babcf1b6_VARS-pure-efi.fd</nvram>
  </os>
  <features>
    <acpi/>
    <apic/>
  </features>
  <cpu mode='host-passthrough' check='none' migratable='on'>
    <topology sockets='1' dies='1' cores='4' threads='2'/>
    <cache mode='passthrough'/>
    <feature policy='require' name='topoext'/>
  </cpu>
  <clock offset='utc'>
    <timer name='rtc' tickpolicy='catchup'/>
    <timer name='pit' tickpolicy='delay'/>
    <timer name='hpet' present='no'/>
  </clock>
  <on_poweroff>destroy</on_poweroff>
  <on_reboot>restart</on_reboot>
  <on_crash>restart</on_crash>
  <devices>
    <emulator>/usr/local/sbin/qemu</emulator>
    <disk type='file' device='disk'>
      <driver name='qemu' type='raw' cache='writeback'/>
      <source file='/mnt/user/domains/Macinabox BigSur/macos_disk.img'/>
      <target dev='hdc' bus='sata'/>
      <boot order='1'/>
      <address type='drive' controller='0' bus='0' target='0' unit='2'/>
    </disk>
    <controller type='usb' index='0' model='ich9-ehci1'>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x03' function='0x1'/>
    </controller>
    <controller type='usb' index='0' model='ich9-uhci1'>
      <master startport='0'/>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x03' function='0x0' multifunction='on'/>
    </controller>
    <controller type='pci' index='0' model='pcie-root'/>
    <controller type='pci' index='1' model='pcie-root-port'>
      <model name='pcie-root-port'/>
      <target chassis='1' port='0x8'/>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x01' function='0x0' multifunction='on'/>
    </controller>
    <controller type='pci' index='2' model='pcie-root-port'>
      <model name='pcie-root-port'/>
      <target chassis='2' port='0x9'/>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x01' function='0x1'/>
    </controller>
    <controller type='pci' index='3' model='pcie-root-port'>
      <model name='pcie-root-port'/>
      <target chassis='3' port='0x12'/>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x01' function='0x2'/>
    </controller>
    <controller type='pci' index='4' model='pcie-root-port'>
      <model name='pcie-root-port'/>
      <target chassis='4' port='0x13'/>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x01' function='0x3'/>
    </controller>
    <controller type='virtio-serial' index='0'>
      <address type='pci' domain='0x0000' bus='0x02' slot='0x00' function='0x0'/>
    </controller>
    <controller type='sata' index='0'>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x1f' function='0x2'/>
    </controller>
    <interface type='bridge'>
      <mac address='52:54:00:d9:66:31'/>
      <source bridge='br0'/>
      <model type='e1000-82545em'/>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x02' function='0x0'/>
    </interface>
    <serial type='pty'>
      <target type='isa-serial' port='0'>
        <model name='isa-serial'/>
      </target>
    </serial>
    <console type='pty'>
      <target type='serial' port='0'/>
    </console>
    <channel type='unix'>
      <target type='virtio' name='org.qemu.guest_agent.0'/>
      <address type='virtio-serial' controller='0' bus='0' port='1'/>
    </channel>
    <input type='tablet' bus='usb'>
      <address type='usb' bus='0' port='1'/>
    </input>
    <input type='mouse' bus='ps2'/>
    <input type='keyboard' bus='ps2'/>
    <hostdev mode='subsystem' type='pci' managed='yes'>
      <driver name='vfio'/>
      <source>
        <address domain='0x0000' bus='0x0c' slot='0x00' function='0x0'/>
      </source>
      <rom file='/mnt/user/isos/vbios/Downloaded Header Removed/DellGT640.rom'/>
      <address type='pci' domain='0x0000' bus='0x01' slot='0x00' function='0x0' multifunction='on'/>
    </hostdev>
    <hostdev mode='subsystem' type='pci' managed='yes'>
      <driver name='vfio'/>
      <source>
        <address domain='0x0000' bus='0x0c' slot='0x00' function='0x1'/>
      </source>
      <address type='pci' domain='0x0000' bus='0x01' slot='0x00' function='0x1'/>
    </hostdev>
    <memballoon model='none'/>
  </devices>
  <qemu:commandline>
    <qemu:arg value='-usb'/>
    <qemu:arg value='-device'/>
    <qemu:arg value='usb-kbd,bus=usb-bus.0'/>
    <qemu:arg value='-device'/>
    <qemu:arg value='isa-applesmc,osk=xxxxxx'/>
    <qemu:arg value='-smbios'/>
    <qemu:arg value='type=2'/>
    <qemu:arg value='-cpu'/>
    <qemu:arg value='Penryn,kvm=on,vendor=GenuineIntel,+invtsc,vmware-cpuid-freq=on,+pcid,+ssse3,+sse4.2,+popcnt,+avx,+aes,+xsave,+xsaveopt,check'/>
  </qemu:commandline>
</domain>

 

You are a guru and a wizard all in one. You are very very intelligent @ghost82 thank you for all of your great advice!!! Unreal :) Much appreciated.

  • Like 1
Link to comment
4 hours ago, ritty said:

You are a guru and a wizard all in one

thank you for your kind words, but Naaa, you're wrong!

It took to me sometime to read and understand how the q35 xml works, once understood it's really simple.

Moreover mac os vms need special attention, they're more difficult to setup compared to linux and windows.

The real gurus are that developing bootloaders (clover and opencore), the kexts and in general all the coders who make possible all these things to happen.

"Bad" thing is that if you want an up to date and optimized mac os vm, you need to be updated, especially about bootloaders updates: it's known that apple likes to break things...for example it seems that they recently changed server side the delta ota update...for monterey they don't show for smbios that have a T2 chip, still not tested on big sur...it took only some days to the real gurus to understand how to fix this, and an updated bootloader will be available soon.

See this:

https://github.com/acidanthera/bugtracker/issues/1769

🙈🙉🙊

And I need to thank also SIO, because without him I never knew 2 years ago how to easly setup a basic mac os vm with gpu passthrough, and obviously all the unraid team, which introduced me with their os to qemu and libvirt without knowing near nothing, it was so easy the setup with the vm gui!

All the other things depends on you, how curious you are and how much time you have to spend..nothing is difficult!

Edited by ghost82
Link to comment

Hi guys,

 

as a 25 years Mac user and former SysAdmin I loved the idea of having a macOS VM on my unRAID Server and spent the last days making it fully capable of being my daily driver. 
I struggled with different things on my way, including a very restive Quadro K2000 refusing to make GPU passthrough working, although working fine as a standalone card in another rig. I finally managed to make this grouch work via BIOS update, the last resort I was willing to give this card.
Anyway, there is one last thing that is preventing this setup from being perfect: my Harman Kardon Soundsticks (first Rev., with software controlled volume). They are showing up correctly in system devices on unRAID and macOS SystemProfiler displays them the same as on a baremetal system. But the sound is distorted and discontinuous. It sounds like the bandwidth of the USB port wouldn't be sufficient and therefore be interrupted.
I tried all the usual things:

  • check MidiSettings for sampling rate
  • put the Sticks on a separate USB port
  • try with 2.0 and 3.0 USB ports
  • uncheck all other devices in unRAIDs VM settings to make the USB controller exclusive to the Sticks
  • some other weird things I can't recall

But worst of all: the same setup is working completely fine under Windows!

I even daisy-chained the Sticks through a USB selector and an active hub and they still played perfect with Redmond-Ware.

Having read through several, mostly outdated threads in other forums, there has been no real clue about why macOS seems to handle the data transfer for this DAC differently. There have been some hints about timings, but no real information to make this work.

If anyone out there in this community has some idea that could help, I would really appreciate any answer here.

Thanks in advance, d.

Edited by disco4000
Link to comment

did you try to passthrough the PCI USB card instead a USB device through libvirt ?

 

afaik not all PCI USB cards are fine with macOS, i had some trouble when i was playing with this and in the end, the onboard USB was the only one which worked fine in my usecase.

 

btw, the same likes to happen on a win VM with a USB audio device, fixed likely with MSI Interrupt settings, may look at allow unsafe MSI interrupts too ...

Link to comment
Quote

did you try to passthrough the PCI USB card instead a USB device through libvirt ?

Just gave that a shot. My Z420 has 3 USB controllers, 2 Intel Chipset C600/X79 series 2.0 and one Texas Instruments TUSB73x0 SuperSpeed USB 3.0 controller.
Unfortunately the TUSB73x0 is not recognised as a USB controller by macOS due to the lack of appropriate drivers.
Moving the unRAID flash drive to the front USB port, I was able to bind the rear ports of the C600 to VFIO and pass it through to the VMs. Again mixed results are my problem:

  1. It works perfectly fine under Windows together with the passed through K2000
  2. Passing through GPU and USB in a macOS VM refuses to boot, black screen
  3. Passing through USB and using VNC makes the macOS VM boot again, show the C600 in system profiler, but only the controller, no devices

This is really kind of a hit&miss game. 
I just ordered an Inateck USB PCIe card. According to tonymacx86 the FL1100 chipset on this card is fully supported by macOS.

Lets see when it arrives tomorrow.

 

Quote

btw, the same likes to happen on a win VM with a USB audio device, fixed likely with MSI Interrupt settings, may look at allow unsafe MSI interrupts too ...

Same result, didn't change anything.

Link to comment

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.