MacOS Xen: Snow Leopard as guest on a Xen domU

Some days ago I started trying to get MacOS X to run as a virtual machine on Xen. After all if the OSx86 guys are getting it to run on normal PC hardware, why not on virtual hardware?

There’s not much info available and most of them is incomplete. The more accurate sites I could find were:

Some notes:

  • I’m using Debian Squeeze with the bundled Xen 4.0 for the hypervisor and the dom0. The server si a cheap (~300€) PC with a DualCore E5700 @3Ghz and 4Gb of RAM. Other versions of Xen may need different options or have a slightly different config file syntax.
  • I assume you already know how to configure a Xen domU, access it through Xen’s built-in VNC server, etc.
  • Instead of using the original Snow Leopard DVD and then patching like here, I’m taking the easy road using iATKOS S3 v2 which is already upgraded to 10.6.3 and bundles several the OSx86 patches.

My /etc/xen/hackosx.cfg file is a mix of those on the previously mentioned pages:

kernel = "/usr/lib/xen/boot/hvmloader"
builder='hvm'
memory = 512
device_model='/usr/lib64/xen/bin/qemu-dm'

name = "hackosx"
#vcpus=1
pae=1
acpi=1
apic=1
#HPET=1
#timer_mode=0
#vpt_align=0
#vcpus_avail=1
#localtime=1
NE2000=0

vif = [ 'type=ioemu,ip=192.168.10.10,bridge=xenbr0' ]
disk = [
        'phy:/dev/mapper/xen-hackosx_hd,ioemu:hda,w',
        'file:/root/iATKOS_S3v2.iso,hdc:cdrom,r',
  ]

# first boot from disk, then from cd if that fails
boot="cd"
sdl=0
vnc=1
vnclisten="0.0.0.0"
vncdisplay=1
vncconsole=0
vncunused=1
vncpasswd='pass'

stdvga=1
serial='pty'
monitor=1

Fix the path to the HD image file/dev and the iATKOS ISO if you need.

So, let’s begin:

  • On the dom0 run “xen create /etc/xen/hackosx.cfg” and access it via VNC.
  • Run Disk Utility and partition the virtual HD. Return to the installer.
  • On the screen where you select the destination HD, click the customize button on the bottom left. Besides the default options (on the screenshot) I also selected the following (NOT on the screenshot and NEEDED for OS X to run on Xen):
    • Patches->Modified Kernels->qoopz 10.3.0
    • Drivers->Main Hardware->SATA/IDE->Intel SATA/IDE
    • Drivers->Main Hardware->PS/2->Apple PS/2
    • Drivers->Network->Wired->Realtek->RTL8139

    iATKOS default options

  • Continue with the installation.

The installer proceeds normally until the end. In my case it gets stuck in “Remaining time: 8 minutes approx.” so after a while seeing the progress bar not… well… progressing, I went to the dom0 and restarted the virtual machine. Note: I had to re-install several times until I got the right options and the installer hanged for me at that point always.

Despite the unfinished installation, access again the VM after restarting it with VNC. This time you’ll see the usual OS X 1st time wizard configuring the language, time zone, user account, etc. Yay!

Now, on to the upgrade to 10.6.6:

If everything worked as expected, now you’re running MacOS X Snow Leopard updated to 10.6.6 on a Xen domU. \o/

Some additional details:

  • Network performance with the default OS X RTL-8139 driver is TERRIBLE (at least right after installing iATKOS, before upgrading to 10.6.6). Follow these instructions to replace it.
  • If you go to apple menu on the upper left corner and then “About this Mac”, the Finder restarts and you don’t get the About window. :-/ Nevertheless the system is upgraded: “uname -r” says 10.6.0 (same as in my MacBook Pro) and the App Store is installed.
  • Run Software Update. There’s a Safari update, a Java one and an iTunes one. ;-) (yes, Software Update works and these upgrades don’t break any of the MultiBeast patching).
  • Install VineServer (it’s free). Is a much better VNC server than the one integrated in Xen and more compatible/standard than the one bundled in OS X.
  • Disable power saving in System Preferences -> Energy Saver. When the virtual OS goes into power saving I don’t know how to wake it, you can VNC to it but it’s completely unresponsive. Maybe there’s a fix, iATKOS and/or MultiBeast have a fix for power saving (not for Xen of course, but maybe it helps) and Xen’s config seems to have some options for power management.

Enjoy. :-)

March 23th update: Apple released the MacOS X 10.6.7 upgrade yesterday. I’ve just tried to install it through Software Update and it works. No need to run MultiBeast even.

7 pensamientos sobre “MacOS Xen: Snow Leopard as guest on a Xen domU”

  1. you didn’t seem to mention how to generate the .img files qemu hard disks for xen also what options are you using with iatkos s2 10.6.3 iso at boot with chameleon?
    for me on 10.6.0 i have to remove AppleTyMCE.kext and AppleIntelCPUPowermanagement.kext or the system won’t boot (KP) unless i use
    NullCPUPowerManagement.kext also when i use a different distro it seems i can install to 10.6.0 using modbin’s kernel for 10.6.0 but when i upgrade to 10.6.3 or 10.6.8 using the combo update the system will load all the kexts but panics as soon as Mac OS X’s dmesg starts.

    1. I’m using LVM partitions for the VMs, so no .img files for me. ;)

      I used the default options + these:

      Patches->Modified Kernels->qoopz 10.3.0
      Drivers->Main Hardware->SATA/IDE->Intel SATA/IDE
      Drivers->Main Hardware->PS/2->Apple PS/2
      Drivers->Network->Wired->Realtek->RTL8139

      No need to remove anything. I’ve updated since to every Snow Leopard new release without problems.

      1. i meant what boot options do you use with chameleon with hazard 10.6.2 i had to use busratio=22 -v in order to boot the hvm in the last 12 hrs ive updated to 10.6.8 and i managed to get vga passthrough sort of working with an ati radeon hd 6870 using xen-4.2 unstable and an ati-vbar-passthru.patch.. but cirrus vga is also enabled which prevents me from driving the card 100% in mac os x in windows 7 i can drive the card 100% with xen no problems

  2. Somehow I always get 0=divide error kernel panic upon attempting to boot from the iATKOS DVD. I tried also with -v -x -f and various busratio options, but that doesn’t make a difference.

  3. Has anyone an idea how to make this work with xen 4.3? Booting DomU from iATKOS S3 v2 shows bootloader (icon and timeout), then 0=divide error and reboot. Tried -x, -nodart, cpus=1, busratio etc. to no success so far. Is the newer qemu-xen the reason for that?

Deja un comentario

Tu dirección de correo electrónico no será publicada. Los campos necesarios están marcados *

Puedes usar las siguientes etiquetas y atributos HTML: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>