article: Running OSX Mavericks under KVM with QEMM


Recommended Posts

My xml is as follows

<domain type='kvm' xmlns:qemu='http://libvirt.org/schemas/domain/qemu/1.0'>
  <name>OSX-Yosemite-10.10</name>
  <uuid>0ba39646-7ba1-4d41-9602-e2969a3fc26d</uuid>
  <metadata>
    <type>None</type>
  </metadata>
  <memory unit='KiB'>4194304</memory>
  <currentMemory unit='KiB'>4194304</currentMemory>
  <vcpu placement='static'>2</vcpu>
  <resource>
    <partition>/machine</partition>
  </resource>
  <os>
    <type arch='x86_64' machine='pc-q35-2.1'>hvm</type>
    <kernel>/mnt/disk1/vm_images/extra/chameleon_svn2549_boot</kernel>
    <boot dev='cdrom'/>
    <bootmenu enable='yes'/>
  </os>
  <features>
    <acpi/>
  </features>
  <cpu mode='custom' match='exact'>
    <model fallback='allow'>core2duo</model>
  </cpu>
  <clock offset='utc'/>
  <on_poweroff>destroy</on_poweroff>
  <on_reboot>restart</on_reboot>
  <on_crash>destroy</on_crash>
  <devices>
    <emulator>/usr/bin/qemu-system-x86_64</emulator>
    <disk type='file' device='disk'>
      <driver name='qemu' type='qcow2'/>
      <source file='/mnt/disk1/vm_images/Yosemite.qcow2'/>
      <target dev='hda' bus='ide'/>
      <address type='drive' controller='0' bus='0' target='0' unit='0'/>
    </disk>
    <controller type='usb' index='0'>
      <address type='pci' domain='0x0000' bus='0x02' slot='0x01' function='0x0'/>
    </controller>
    <controller type='ide' index='0'/>
    <controller type='sata' index='0'>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x1f' function='0x2'/>
    </controller>
    <controller type='pci' index='0' model='pcie-root'/>
    <controller type='pci' index='1' model='dmi-to-pci-bridge'>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x1e' function='0x0'/>
    </controller>
    <controller type='pci' index='2' model='pci-bridge'>
      <address type='pci' domain='0x0000' bus='0x01' slot='0x01' function='0x0'/>
    </controller>
    <interface type='bridge'>
      <mac address='52:54:00:00:20:20'/>
      <source bridge='br0'/>
      <model type='e1000-82545em'/>
      <address type='pci' domain='0x0000' bus='0x02' slot='0x03' function='0x0'/>
    </interface>
    <input type='mouse' bus='ps2'/>
    <input type='keyboard' bus='ps2'/>
    <graphics type='vnc' port='-1' autoport='yes' websocket='-1' listen='0.0.0.0'>
      <listen type='address' address='0.0.0.0'/>
    </graphics>
    <video>
      <model type='vga' vram='9216' heads='1'/>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x01' function='0x0'/>
    </video>
    <memballoon model='virtio'>
      <address type='pci' domain='0x0000' bus='0x02' slot='0x02' function='0x0'/>
    </memballoon>
  </devices>
  <seclabel type='none' model='none'/>
  <qemu:commandline>
    <qemu:arg value='-device'/>
    <qemu:arg value='ioh3420,bus=pcie.0,addr=1c.0,multifunction=on,port=1,chassis=1,id=root.1'/>
    <qemu:arg value='-device'/>
    <qemu:arg value='vfio-pci,host=01:00.0,bus=root.1,addr=00.0,multifunction=on,x-vga=on'/>
    <qemu:arg value='-device'/>
    <qemu:arg value='vfio-pci,host=01:00.1,bus=pcie.0'/>
    <qemu:arg value='-device'/>
    <qemu:arg value='usb-kbd'/>
    <qemu:arg value='-device'/>
    <qemu:arg value='usb-mouse'/>
    <qemu:arg value='-device'/>
    <qemu:arg value='isa-applesmc,osk=64_Character_OSK_Key'/>
    <qemu:arg value='-smbios'/>
    <qemu:arg value='type=2'/>
    <qemu:arg value='-device'/>
    <qemu:arg value='ide-drive,bus=ide.1,drive=MacDVD'/>
    <qemu:arg value='-drive'/>
    <qemu:arg value='id=MacDVD,if=none,snapshot=on,file=/mnt/disk1/vm_images/installer/Yosemite.iso'/>
  </qemu:commandline>
</domain>

Link to comment
  • Replies 128
  • Created
  • Last Reply

Top Posters In This Topic

Top Posters In This Topic

Posted Images

  • 2 months later...

Superb guide! I can get everything going, but my VM hangs on the Apple Logo screen when booting for the first time. Any ideas? I'm running OSX Yosemite. I can post my XML:

 

<domain type='kvm' id='11' xmlns:qemu='http://libvirt.org/schemas/domain/qemu/1.0'>
  <name>OSX-Yosemite</name>
  <uuid>0ba39646-7ba1-4d41-9602-e2969a3fc26d</uuid>
  <metadata>
    <type>None</type>
  </metadata>
  <memory unit='KiB'>4194304</memory>
  <currentMemory unit='KiB'>4194304</currentMemory>
  <vcpu placement='static'>2</vcpu>
  <resource>
    <partition>/machine</partition>
  </resource>
  <os>
    <type arch='x86_64' machine='pc-q35-2.2'>hvm</type>
    <kernel>/mnt/extra/vm_tools/chameleon_svn2510_boot</kernel>
    <boot dev='hd'/>
    <bootmenu enable='yes'/>
  </os>
  <features>
    <acpi/>
  </features>
  <cpu mode='custom' match='exact'>
    <model fallback='allow'>core2duo</model>
  </cpu>
  <clock offset='utc'/>
  <on_poweroff>destroy</on_poweroff>
  <on_reboot>restart</on_reboot>
  <on_crash>destroy</on_crash>
  <devices>
    <emulator>/usr/bin/qemu-system-x86_64</emulator>
    <disk type='file' device='disk'>
      <driver name='qemu' type='qcow2'/>
      <source file='/mnt/extra/vms/Yosemite/Yosemite.qcow2'/>
      <backingStore/>
      <target dev='hda' bus='ide'/>
      <alias name='ide0-0-0'/>
      <address type='drive' controller='0' bus='0' target='0' unit='0'/>
    </disk>
    <controller type='usb' index='0'>
      <alias name='usb0'/>
      <address type='pci' domain='0x0000' bus='0x02' slot='0x01' function='0x0'/>
    </controller>
    <controller type='ide' index='0'>
      <alias name='ide0'/>
    </controller>
    <controller type='sata' index='0'>
      <alias name='sata0'/>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x1f' function='0x2'/>
    </controller>
    <controller type='pci' index='0' model='pcie-root'>
      <alias name='pcie.0'/>
    </controller>
    <controller type='pci' index='1' model='dmi-to-pci-bridge'>
      <alias name='pci.1'/>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x1e' function='0x0'/>
    </controller>
    <controller type='pci' index='2' model='pci-bridge'>
      <alias name='pci.2'/>
      <address type='pci' domain='0x0000' bus='0x01' slot='0x01' function='0x0'/>
    </controller>
    <interface type='bridge'>
      <mac address='52:54:00:00:20:20'/>
      <source bridge='br0'/>
      <target dev='vnet1'/>
      <model type='e1000-82545em'/>
      <alias name='net0'/>
      <address type='pci' domain='0x0000' bus='0x02' slot='0x03' function='0x0'/>
    </interface>
    <input type='mouse' bus='ps2'/>
    <input type='keyboard' bus='ps2'/>
    <graphics type='vnc' port='5901' autoport='yes' websocket='5701' listen='0.0.0.0'>
      <listen type='address' address='0.0.0.0'/>
    </graphics>
    <video>
      <model type='vga' vram='16384' heads='1'/>
      <alias name='video0'/>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x01' function='0x0'/>
    </video>
    <memballoon model='virtio'>
      <alias name='balloon0'/>
      <address type='pci' domain='0x0000' bus='0x02' slot='0x02' function='0x0'/>
    </memballoon>
  </devices>
  <seclabel type='none' model='none'/>
  <qemu:commandline>
    <qemu:arg value='-device'/>
    <qemu:arg value='usb-kbd'/>
    <qemu:arg value='-device'/>
    <qemu:arg value='usb-mouse'/>
    <qemu:arg value='-device'/>
    <qemu:arg value='isa-applesmc,osk=shhhhh '/>
    <qemu:arg value='-smbios'/>
    <qemu:arg value='type=2'/>
    <qemu:arg value='-device'/>
    <qemu:arg value='ide-drive,bus=ide.1,drive=MacDVD'/>
    <qemu:arg value='-drive'/>
    <qemu:arg value='id=MacDVD,if=none,snapshot=on,file=/mnt/extra/vm_tools/Yosemite.iso'/>
  </qemu:commandline>
</domain>

Link to comment

I have my OS X machine up and running since months now (mainly as iTunes server) and I have to say: awesome!!!

 

I', shutting down the server each night. The Powerdown script is doing this very well by just pressing the power button (..that is something my wife is also capable to do  ;D )

 

However, the "normal" shutdown procedure (the usage of the "S" script if I'm not mistaken) of the Powerdown isn't working for the OS X VM. How are you guy's deal with OS X KVM shutdown before shutting down the whole server?

Link to comment

I'm fairly certain that when unRAID shutdowns or reboots that it force shuts down the OS X VM. The old VM plugin used to at least bring a prompt to my Mac screen asking to shutdown but the new VM plugin built into beta15 doesn't even tell me anything is about to shutdown. I am not sure how to get the VM plugin to play nice with OS X like it does with my windows and linux VMs. For now, if I am planning on restarting the server to just go over to my OS X desktop and manually shut it down first.

Link to comment

Superb guide! I can get everything going, but my VM hangs on the Apple Logo screen when booting for the first time. Any ideas? I'm running OSX Yosemite. I can post my XML:

 

<domain type='kvm' id='11' xmlns:qemu='http://libvirt.org/schemas/domain/qemu/1.0'>
  <name>OSX-Yosemite</name>
  <uuid>0ba39646-7ba1-4d41-9602-e2969a3fc26d</uuid>
  <metadata>
    <type>None</type>
  </metadata>
  <memory unit='KiB'>4194304</memory>
  <currentMemory unit='KiB'>4194304</currentMemory>
  <vcpu placement='static'>2</vcpu>
  <resource>
    <partition>/machine</partition>
  </resource>
  <os>
    <type arch='x86_64' machine='pc-q35-2.2'>hvm</type>
    <kernel>/mnt/extra/vm_tools/chameleon_svn2510_boot</kernel>
    <boot dev='hd'/>
    <bootmenu enable='yes'/>
  </os>
  <features>
    <acpi/>
  </features>
  <cpu mode='custom' match='exact'>
    <model fallback='allow'>core2duo</model>
  </cpu>
  <clock offset='utc'/>
  <on_poweroff>destroy</on_poweroff>
  <on_reboot>restart</on_reboot>
  <on_crash>destroy</on_crash>
  <devices>
    <emulator>/usr/bin/qemu-system-x86_64</emulator>
    <disk type='file' device='disk'>
      <driver name='qemu' type='qcow2'/>
      <source file='/mnt/extra/vms/Yosemite/Yosemite.qcow2'/>
      <backingStore/>
      <target dev='hda' bus='ide'/>
      <alias name='ide0-0-0'/>
      <address type='drive' controller='0' bus='0' target='0' unit='0'/>
    </disk>
    <controller type='usb' index='0'>
      <alias name='usb0'/>
      <address type='pci' domain='0x0000' bus='0x02' slot='0x01' function='0x0'/>
    </controller>
    <controller type='ide' index='0'>
      <alias name='ide0'/>
    </controller>
    <controller type='sata' index='0'>
      <alias name='sata0'/>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x1f' function='0x2'/>
    </controller>
    <controller type='pci' index='0' model='pcie-root'>
      <alias name='pcie.0'/>
    </controller>
    <controller type='pci' index='1' model='dmi-to-pci-bridge'>
      <alias name='pci.1'/>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x1e' function='0x0'/>
    </controller>
    <controller type='pci' index='2' model='pci-bridge'>
      <alias name='pci.2'/>
      <address type='pci' domain='0x0000' bus='0x01' slot='0x01' function='0x0'/>
    </controller>
    <interface type='bridge'>
      <mac address='52:54:00:00:20:20'/>
      <source bridge='br0'/>
      <target dev='vnet1'/>
      <model type='e1000-82545em'/>
      <alias name='net0'/>
      <address type='pci' domain='0x0000' bus='0x02' slot='0x03' function='0x0'/>
    </interface>
    <input type='mouse' bus='ps2'/>
    <input type='keyboard' bus='ps2'/>
    <graphics type='vnc' port='5901' autoport='yes' websocket='5701' listen='0.0.0.0'>
      <listen type='address' address='0.0.0.0'/>
    </graphics>
    <video>
      <model type='vga' vram='16384' heads='1'/>
      <alias name='video0'/>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x01' function='0x0'/>
    </video>
    <memballoon model='virtio'>
      <alias name='balloon0'/>
      <address type='pci' domain='0x0000' bus='0x02' slot='0x02' function='0x0'/>
    </memballoon>
  </devices>
  <seclabel type='none' model='none'/>
  <qemu:commandline>
    <qemu:arg value='-device'/>
    <qemu:arg value='usb-kbd'/>
    <qemu:arg value='-device'/>
    <qemu:arg value='usb-mouse'/>
    <qemu:arg value='-device'/>
    <qemu:arg value='isa-applesmc,osk=shhhhh '/>
    <qemu:arg value='-smbios'/>
    <qemu:arg value='type=2'/>
    <qemu:arg value='-device'/>
    <qemu:arg value='ide-drive,bus=ide.1,drive=MacDVD'/>
    <qemu:arg value='-drive'/>
    <qemu:arg value='id=MacDVD,if=none,snapshot=on,file=/mnt/extra/vm_tools/Yosemite.iso'/>
  </qemu:commandline>
</domain>

 

From your signature I can see you are using AMD hardware. I'm not sure if you can operate an  OSX guest VM when the host CPU is AMD as the install checks for an intel CPU and will freeze up when it doesn't find one (your experience). I see you are specifying Core2Duo in the XML but I don't think that works in terms of tricking the OSX install into thinking it is on an Intel machine.

 

If anyone else knows how to set the XML to do this I would love to know (I had the same thing happen).

Link to comment

I'm fairly certain that when unRAID shutdowns or reboots that it force shuts down the OS X VM. The old VM plugin used to at least bring a prompt to my Mac screen asking to shutdown but the new VM plugin built into beta15 doesn't even tell me anything is about to shutdown. I am not sure how to get the VM plugin to play nice with OS X like it does with my windows and linux VMs. For now, if I am planning on restarting the server to just go over to my OS X desktop and manually shut it down first.

Alright, so I didn't missed anything....that what you described is pretty much the same that I'm doing each day when I'm shutting down unRAID. Thanks for your confirmation archedraft.
Link to comment

From your signature I can see you are using AMD hardware. I'm not sure if you can operate an  OSX guest VM when the host CPU is AMD as the install checks for an intel CPU and will freeze up when it doesn't find one (your experience). I see you are specifying Core2Duo in the XML but I don't think that works in terms of tricking the OSX install into thinking it is on an Intel machine.

 

If anyone else knows how to set the XML to do this I would love to know (I had the same thing happen).

 

Would you both try adding this to see if you can get your AMD's to work: (<vendor>Intel</vendor>)

 

  <cpu mode='custom' match='exact'>
    <model fallback='allow'>core2duo</model>
    <vendor>Intel</vendor>
    <topology sockets='1' cores='2' threads='1'/>
  </cpu>

 

Link to comment

From your signature I can see you are using AMD hardware. I'm not sure if you can operate an  OSX guest VM when the host CPU is AMD as the install checks for an intel CPU and will freeze up when it doesn't find one (your experience). I see you are specifying Core2Duo in the XML but I don't think that works in terms of tricking the OSX install into thinking it is on an Intel machine.

 

If anyone else knows how to set the XML to do this I would love to know (I had the same thing happen).

 

Would you both try adding this to see if you can get your AMD's to work: (<vendor>Intel</vendor>)

 

  <cpu mode='custom' match='exact'>
    <model fallback='allow'>core2duo</model>
    <vendor>Intel</vendor>
    <topology sockets='1' cores='2' threads='1'/>
  </cpu>

 

That is pretty much where I was at. I didn't have the topology in there so I added that. Here is the error output from virsh.

 

virsh # start OSX-Yosemite-10.10
error: Failed to start domain OSX-Yosemite-10.10
error: unsupported configuration: guest and host CPU are not compatible: host CPU vendor does not match required CPU vendor Intel

 

For some reason the VM still sees AMD hardware or maybe its just a qemu/kvm error. Can this be bypassed? Without <vendor>Intel</vendor> it will start but it freezes up when it checks the processor. Any other things to try?

 

My xml.

 

<domain type='kvm' xmlns:qemu='http://libvirt.org/schemas/domain/qemu/1.0'>
  <name>OSX-Yosemite-10.10</name>
  <uuid>0ba39646-7ba1-4d41-9602-e2969a3fc26d</uuid>
  <metadata>
    <type>None</type>
  </metadata>
  <memory unit='KiB'>4194304</memory>
  <currentMemory unit='KiB'>4194304</currentMemory>
  <vcpu placement='static'>2</vcpu>
  <resource>
    <partition>/machine</partition>
  </resource>
  <os>
    <type arch='x86_64' machine='pc-q35-2.1'>hvm</type>
    <kernel>/mnt/disk/vmdisk/Images/extras/chameleon_svn2510_boot</kernel>
    <boot dev='cdrom'/>
    <bootmenu enable='yes'/>
  </os>
  <features>
    <acpi/>
  </features>
  <cpu mode='custom' match='exact'>
    <model fallback='allow'>core2duo</model>
    <vendor>Intel</vendor>
    <topology sockets='1' cores='2' threads='1'/>
  </cpu>
  <clock offset='utc'/>
  <on_poweroff>destroy</on_poweroff>
  <on_reboot>restart</on_reboot>
  <on_crash>destroy</on_crash>
  <devices>
    <emulator>/usr/bin/qemu-system-x86_64</emulator>
    <disk type='file' device='disk'>
      <driver name='qemu' type='qcow2'/>
      <source file='/mnt/disk/vmdisk/Image Media/Yosemite.qcow2'/>
      <target dev='hda' bus='ide'/>
      <address type='drive' controller='0' bus='0' target='0' unit='0'/>
    </disk>
    <controller type='usb' index='0'>
      <address type='pci' domain='0x0000' bus='0x02' slot='0x01' function='0x0'/>
    </controller>
    <controller type='ide' index='0'/>
    <controller type='sata' index='0'>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x1f' function='0x2'/>
    </controller>
    <controller type='pci' index='0' model='pcie-root'/>
    <controller type='pci' index='1' model='dmi-to-pci-bridge'>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x1e' function='0x0'/>
    </controller>
    <controller type='pci' index='2' model='pci-bridge'>
      <address type='pci' domain='0x0000' bus='0x01' slot='0x01' function='0x0'/>
    </controller>
    <interface type='bridge'>
      <mac address='52:54:00:00:20:20'/>
      <source bridge='br0'/>
      <model type='e1000-82545em'/>
      <address type='pci' domain='0x0000' bus='0x02' slot='0x03' function='0x0'/>
    </interface>
    <input type='mouse' bus='ps2'/>
    <input type='keyboard' bus='ps2'/>
    <graphics type='vnc' port='-1' autoport='yes' websocket='-1' listen='0.0.0.0'>
      <listen type='address' address='0.0.0.0'/>
    </graphics>
    <video>
      <model type='vga' vram='16384' heads='1'/>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x01' function='0x0'/>
    </video>
    <memballoon model='virtio'>
      <address type='pci' domain='0x0000' bus='0x02' slot='0x02' function='0x0'/>
    </memballoon>
  </devices>
  <seclabel type='none' model='none'/>
  <qemu:commandline>
    <qemu:arg value='-device'/>
    <qemu:arg value='usb-kbd'/>
    <qemu:arg value='-device'/>
    <qemu:arg value='usb-mouse'/>
    <qemu:arg value='-device'/>
    <qemu:arg value='isa-applesmc,osk=********'/>
    <qemu:arg value='-smbios'/>
    <qemu:arg value='type=2'/>
    <qemu:arg value='-device'/>
    <qemu:arg value='ide-drive,bus=ide.1,drive=MacDVD'/>
    <qemu:arg value='-drive'/>
    <qemu:arg value='id=MacDVD,if=none,snapshot=on,file=/mnt/disk/vmdisk/Images/Yosemite.iso'/>
  </qemu:commandline>
</domain>

Link to comment

Try <vendor>GenuineIntel</vendor>

 

Ok I have changed it to <vendor>GenuineIntel</vendor>

 

same result unfortunately.

 

virsh # start OSX-Yosemite-10.10     
error: Failed to start domain OSX-Yosemite-10.10
error: unsupported configuration: guest and host CPU are not compatible: host CPU vendor does not match required CPU vendor GenuineIntel

Link to comment

OK how about this:

 

<vendor name='Intel' string='GenuineIntel'/>

 

Some progress there. The VM starts and I can VNC into it. The boot screen comes up and if I press enter it goes to a grey screen with logo and freezes. If i type in -v at the boot screen something flashes by very quickly and then it goes to a black screen and freezes up.

 

 

Link to comment

opening up the domain XML of the running domain (frozen) shows this for cpu

 

</features>
  <cpu mode='custom' match='exact'>
    <model fallback='allow'>core2duo</model>
    <topology sockets='1' cores='2' threads='1'/>
  </cpu>

 

Don't know if that helps

Link to comment

So it wont take the <vendor name='Intel' string='GenuineIntel'/>

 

It automatically edits that out and that is why the domain starts but leaves us back in the same position.

 

Are you comfortable ssh'ing into unRAID and using the terminal? I have another test but it involves creating a test files with the terminal.

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.