A MacBook Virtualization Qwest

A MacBook Virtualization Qwest

So I recently upgraded my macbook pro 6,2 with an intel 530 ssd…. and with that, new possibilities with a chance to start over with my laptop and make it as versatile as possible for onsite client visits.  Previously, my macbook with mavericks dual booted with Fedora 20.  Both of which could access and use my windows 7 virtualbox machine.

My idea for my laptop involves as close to 100% virtualization as possible using the best hypervisor that I can find — for a laptop.  I wanted to be able to snapshot my OS and also be able to allocate as much physical resources to the vms as possible.  I already knew a good amount about type 1 and type 2 hypervisors.

Here’s a list off the top of my head of the major Type 2 hypervisors …

  • Vmware workstation
  • Vmware fusion (for Mac)
  • Virtualbox
  • Parallels

 

and the Type 1 Hypervisors….

  • Microsoft Hyper-V
  • Vmware Esxi
  • Xen (including XenClient and XenServer)
  • Kvm/Qemu

 

And a whole lot more: http://en.wikipedia.org/wiki/Comparison_of_platform_virtualization_software.

A type 1 hypervisor is the most desirable, but not the easiest to use as these do not provide a way to see/use the vm’s with only the laptop itself.   Yes, video passthrough could be an option, but this means I can only start 1 guest vm at a time.  I also did not want to run Ubuntu or a Hackintosh.

 

I decided to first try Xen4Centos (installed with the minimal desktop selection).  However, I began to run into issues between centos and the macbook that required too much fiddling – something I did not want to deal with when at a client site in case something went wrong.  I then turned to a trial copy of Windows Server 2012 R2 and enabled the HyperV feature.  However, I was unable to create a mac osx virtual machine and found nothing on the interwebs to assist with a workaround to do so.  Next I tried XenClient… and it worked very nicely…except I couldn’t create a mac OS X guest vm despite a youtube video of such a feat from years prior ( https://www.youtube.com/watch?v=kxoWxjThzo0).

My luck was running out.  I then decided to look at this from another angle…. “what hypervisors actually support a Mac OS X guest?” was my thinking but I did not put too much faith into the official lists – with a simple and unofficial 3rd party unlocker software, vmware workstation can run/create mac osx guests.   Turns out, only a few type 2 hypervisors do tolerate Mac OS X…, namely Parallels, Vmware Fusion, and Virtualbox.  I eliminated Fusion and Parallels, as I wanted something as low cost as possible – so enter Virtualbox.

I downloaded the Yosemite installer from the Mac store… and attempted to follow these steps from http://sqar.blogspot.de/2014/10/installing-yosemite-in-virtualbox.html.  However, these steps did not work for me as I received the error “This is not a supported method of installing the operating system. Please run Install OS X 10.10.app  that you downloaded from the app store.”  I suspect the Yosemite version I downloaded has been slightly updated by Apple to 10.10.1.  Here are the recorded steps in case the site goes offline:

Downloading the software

At first you need to download “Install OS X Yosemite.app” from the App Store of course. And you need to download and install VirtualBox from https://www.virtualbox.org/wiki/Downloads if you haven’t done so already.

Preparing the ISO image

Since VirtualBox needs an ISO image to boot from you need to create one from the downloaded “Install OS X Yosemite.app”

For this purpose I basically adapted the script found here:

http://forums.appleinsider.com/t/159955/howto-create-bootable-mavericks-iso

with stuff from here

https://tekshrek.com/os-x-yosemite-clean-install/

#!/bin/bash

# Mount the installer image
hdiutil attach /Applications/Install OS X Yosemite.app/Contents/SharedSupport/InstallESD.dmg -noverify -nobrowse -mountpoint /Volumes/install_app

# Convert the boot image to a sparse bundle
hdiutil convert /Volumes/install_app/BaseSystem.dmg -format UDSP -o /tmp/Yosemite

# Increase the sparse bundle capacity to accommodate the packages
hdiutil resize -size 8g /tmp/Yosemite.sparseimage

# Mount the sparse bundle for package addition
hdiutil attach /tmp/Yosemite.sparseimage -noverify -nobrowse -mountpoint /Volumes/install_build

# Remove Package link and replace with actual files
rm /Volumes/install_build/System/Installation/Packages
cp -rp /Volumes/install_app/Packages /Volumes/install_build/System/Installation/

# Copy Base System
cp -rp /Volumes/install_app/BaseSystem.dmg /Volumes/install_build/
cp -rp /Volumes/install_app/BaseSystem.chunklist /Volumes/install_build/

# Unmount the installer image
hdiutil detach /Volumes/install_app

# Unmount the sparse bundle
hdiutil detach /Volumes/install_build

# Resize the partition in the sparse bundle to remove any free space
hdiutil resize -size `hdiutil resize -limits /tmp/Yosemite.sparseimage | tail -n 1 | awk ‘{ print $1 }’`b /tmp/Yosemite.sparseimage

# Convert the sparse bundle to ISO/CD master
hdiutil convert /tmp/Yosemite.sparseimage -format UDTO -o /tmp/Yosemite

# Remove the sparse bundle
rm /tmp/Yosemite.sparseimage

# Rename the ISO and move it to the desktop
mv /tmp/Yosemite.cdr ~/Desktop/Yosemite.iso
Adjust the paths in the script if necessary (e.g. if you have moved the “Install OS X Yosemite.app”) and save this script as “prepare_yosemite_iso.sh”. Then you cd in Terminal.app to the directory where you saved the script and make it executable with

chmod 755 prepare_yosemite_iso.sh

and run it like this:

./prepare_yosemite_iso.sh

Then you’ll find a file called Yosemite.iso on your Desktop. This is the ISO image you need to boot from in VirtualBox later.

Setting up the virtual machine in VirtualBox

The next thing to do is to set up a virtual machine in VirtualBox. Since the latest version of VirtualBox available at the moment (version 4.3.18)
has no build in support for Yosemite we’ll set up a virtual machine for Mavericks which will work just fine.

For this just click on “New” inside the VirtualBox Manager
and choose a name for your virtual machine. Set the type to “Mac OS X” and the Version to “Mac OS X 10.9 Mavericks (64 bit)”.
Follow the steps of the assistant and leave everything as is, especially the RAM setting since a bug in the UEFI of VirtualBox blocks you from assigning more RAM (the virtual machine simply won’t boot, see https://www.virtualbox.org/ticket/13211 ).
The only exception is the format and the size of the virtual hard disk you create, you’ll probably prefer the VMDK format over the VDI format since that format can be used with other types of virtual machines (not VirtualBox ones) too

and you better choose a size that exceeds 80GB of maximum size (this size isn’t a problem since this amount of storage space isn’t allocated right now but the disk grows dynamically in size as needed).

After this step your virtual machine is set up and ready to boot.

Installing Yosemite
Boot up your virtual machine by clicking on “Start”. A dialog panel will appear which asks for a “virtual optical disk file”. Here our ISO image comes into the game. Click onto that small yellow folder icon next to the pop up button.
Now select the Yosemite.iso created in the first step
and click the “Start” button.
Now at first the EFI boot loader runs
followed by lots of boot messages scrolling by — this is a verbose boot as VirtualBox does it.
After a while the boot process seems to be stuck with the last message “DSMOS has arrived”. Don’t panic, this is normal, be patient.
After some time the Welcome and language selection screen will appear. Now you’ll also probably hear some crackling sound from your speakers. This is the installer trying to play some music which VirtualBox performs very badly, so bad that even the mouse is stuttering and lagging. Now you can either wait until this “music” ends after a time and the mouse behaves normal again or you use the keyboard (arrow keys and tab) to navigate this screen.
Next this screen appears. Don’t click on “Continue” right now, we first need to prepare the virtual hard disk.
Choose “Disk Utility…” from the “Utilities” Menu
and format the virtual hard disk.
After this Quit Disk Utility and you’re back to the Installer screen. Now click “Continue”.

Select the virtual hard disk for installation.
The installation will take some time but require no interaction during this process.
After a reboot you will be asked to select your country (to determine time zones, languages and the like). Again some crackling noise and a stuttering mouse pointer are telling you that VirtualBox is trying to play some “music”. Wait for it to end or use the keyboard.
All the following stuff is somewhat self-explanatory and doesn’t differ from a normal OS X install.
And there it is in all its beauty!
Don’t forget to eject the “DVD”, e.g. the ISO image or the installation will start again after the next reboot.
Running Yosemite
As System Information reveals, inside your “Mac” is some very special hardware.
All the 3D acceleration by using OpenGL will not work with this. As you can see by some quirks that originate from the fact, that Yosemite is assuming you’re having proper OpenGL (and also OpenCL I guess): look at the corners of the windows and the missing title bar of the about box.
There could also be more RAM but due to https://www.virtualbox.org/ticket/13211 this isn’t possible.
But the virtual disk work pretty good so far.
Maps doesn’t show a map and even crashes.
Mail I did not test further and Safari seems to work.
That’s it for now.

 

So, I instead downloaded Mavericks form the Mac store and followed these steps (http://engineering.bittorrent.com/2014/07/16/how-to-guide-for-mavericks-vm-on-mavericks/#comments) , then upgraded Mavericks to Yosemite…. While not clean, it worked.  I will create a new post if/when a clean procedure is found in the near future.  Here are the recorded steps (slightly editted) in case the original site goes offline:

…While we’re waiting for the Mavericks Installer to download, lets get started on configuring our new Virtual Machine.

Create a New Virtual Machine

Lets call it “Mavericks”

mavericks

Lets allocate 2 GB of my host machine’s 8 GB of RAM

Lets create a new blank disk image for this machine

The VDI format should be fine for what we’re doing (I use a VMDK dynamic split to 2gb files)

A dynamically sized disk should also be fine for what we’re doing

Lets call this disk image “Mavericks” too (I used Disk1)

And we’re successfully created our virtual machine

We need to check if your computer has an Intel Haswell processor. We’re going to use “About This Mac” to check.

Lets launch “About This Mac”

Click on “More Info…”

If you see “Late 2013″ or later, we’ll need to change the CPUID for our virtual machine so the installer image boots

We need to determine the name of the virtual machine, if you called it something other than “Mavericks” you’ll need to use the name you get from this command:

VBoxManage list vms

Now that we have the name, we can specify the CPUID for that virtual machine

Run VBoxManage modifyvm Mavericks –cpuidset 00000001 000306a9 00020800 80000201 178bfbff (Substitue Mavericks with what you got from VBoxManage list vms if you have something different)

In your terminal, run “sudo gem install iesd”

iesd is a Ruby applicaiton with extracts the installer disk image from the installer application to for use as a boot disk for your virtualization software.

Gem Install

Run iesd -i /Applications/Install OS X Mavericks.app -o Mavericks.dmg -t BaseSystem

Now you’ll have a Mavericks.dmg inside your user’s home folder.

Now we’ll attach this disk image to our virtual machine

Click on the “Storage” text of this new machine

Click on the “Empty” list item

Click on the CD icon to “Choose A Virtual CD/DVD Disk File…”

Choose the Mavericks.dmg file that iesd produced in your home folder

Now we’re set to install Mavericks within the VM!

Wait for the VM to boot. You’ll see plenty of black on white text scroll by with some errors and warnings, but they are acceptable.

And we’ve booted!

The mouse will be very laggy on this screen because of the animation, so it may be easier to hit the “Enter” key than to navigate to the next button with the mouse.

Before continuing with the installer, we need to format the blank disk so that the installer detects it as an install location.

Go to “Utilities” -> “Disk Utility…” to launch the Disk Utility

Select the “VBOX” disk and go to the “Erase” tab. Give the disk a better name than “Untitled”, I’m partial to “Mavericks” and then click “Erase”

Click “Erase” again when prompted

Wait for the disk to be erased. Once it’s ready, the named disk will appear in the top left of Disk Utility.

Quit Disk Utility

Now we’re all set to install Mavericks!

Click “Continue” on the Installer

Agree to the EULA and note the section that permits what we are doing

Select the volume we created with Disk Utility and click Install

It will take a little over 20 minutes for the installer to run

Restarting

We’ve successfully installed Mavericks.

 

So, while my Yosemite virtualbox guest is running, its slow…. but thats ok.  I can at least test, snapshot, and run a virtual os x environment (unfortunately on top of OS X Mavericks).  I’m sure, with time, things will get better but for now I have my old Virtualbox win7 vm, an OSX vm, and a new Fedora 21 vm.

Dee
No Comments

Post a Comment

Comment
Name
Email
Website