My previous Proxmox post described how to install Sierra into Proxmox using the Enoch bootloader (SeaBIOS boot). Since then, I’ve been using it as my daily-use desktop, and it has generally been working out great for me. However, I had some real struggles getting the graphics card passthrough to work reliably. I managed to fix these by updating to UEFI boot with Clover.
One of the problems with legacy BIOS boot and GPU passthrough is VGA arbitration. From what I understand, the video cards in the host and guest can end up both contending to own the VGA resources, which can cause a deadlock on boot. When a Sierra guest loads its video driver during boot, my Proxmox host hangs, and the screen fills with black and white bars.
UEFI boot doesn’t suffer from this problem, since it does away with the legacy VGA interface. So if your video card’s firmware supports UEFI/EFI boot (my R9 280X already does), you can switch the guest to boot using OVMF instead. This requires us to use a macOS bootloader that supports UEFI. I chose Clover.
However, there’s an issue at the moment with Clover and QEMU which causes macOS’s detected CPU speed to be wrong. This makes window animations, the system clock, movie players, typematic repeat, etc., run much too fast or too slow.
On Proxmox 4.4, we have to patch Clover to fix this, follow the instructions in the next section.
Proxmox 5 has support for telling macOS exactly what the CPU’s frequency is, by exposing a VMWare-style interface that macOS knows how to read. This fixes the CPU speed problem. So on Proxmox 5, we can just edit the VM configuration to enable this feature, and afterwards we can install an unmodified official Clover release (I’m using r4097) using the install instructions further down this page.
Building your own copy of Clover with the QEMU CPU speed patch for Proxmox 4.4
You can either just download my prebuilt patched Clover r4061 / EDK2 r24132 installer, or follow the instructions in this section to patch and build Clover yourself.
We’ll be following the official Clover building instructions, but we’ll be modifying those slightly.
Install XCode from the App Store before you start. Run “sudo xcodebuild -license” to accept the license agreement. Run “sudo xcode-select –install” to ensure the command-line tools are installed.
Note that when the instructions say to make a directory called “src” in your home directory, you should listen! There are hardcoded paths that will look for built tools in that directory, so it’s much easier to just go with the flow here.
Fetching Clover source
Follow steps 1-3 from the section “compiling from source“, with some changes:
On the line that fetches EDK2:
svn co -r 18198 svn://svn.code.sf.net/p/edk2/code/trunk/edk2 edk2
Fetch EDK2 revision 24132 instead:
svn co -r 24132 svn://svn.code.sf.net/p/edk2/code/trunk/edk2 edk2
When it checks out the latest Clover source:
svn co svn://svn.code.sf.net/p/cloverefiboot/code Clover
Check out revision 4061 instead:
svn co -r 4061 svn://svn.code.sf.net/p/cloverefiboot/code Clover
You can skip the line that runs “./buildgcc-4.9.sh”, since we’ll be using XCode instead.
Apply the patch
User “arne ziegert” over on the Clover issue tracker came up with a patch to fix the CPU speed issue on QEMU, which we’ll apply before we build Clover.
Download this patch to “edk2/Clover”. Change into that directory and run:
svn patch clover-r4061-qemu-cpu-speed-patch.diff
Change into the “edk2/Clover” directory, and run:
The default options, which use XCode to build an X64 bootloader, are perfect for us.
After that completes, run “cd CloverPackage; ./makepkg”. This will produce an installable package for us in “edk2/Clover/CloverPackage/sym/Clover_v2.4k_r4061.pkg.”.
Proxmox 5: Enabling vmware-cpuid-freq support
In Proxmox 5, we don’t need to patch Clover, we just need to enable the vmware-cpuid-freq feature on the CPU in our VM’s configuration.
You should currently have an “args:” option in your VM configuration that contains:
We need to edit that to add +invtsc to enable invariant timestamp counter support, add the vmware-cpuid-freq option, and turn kvm back on (exposing the fact that this is a virtual machine to macOS):
At this point you might want to take a snapshot of your Sierra install, so you can roll things back if it goes wrong. Though note that we will still be able to boot with Enoch/SeaBIOS even after we’re done, so if you mess up Clover/OVMF, you should be able to switch right back to SeaBIOS in your VM options to fix things.
Run the Clover.pkg installer in your Sierra guest:
The Clover installer should leave the EFI partition mounted for us. Open that up in Finder.
Configure Proxmox to use OVMF/UEFI
We’re nearly done! Just switch over to OVMF in your VM’s settings:
Now fire it up!
Editing your Clover/EFI settings in the future
You can use the Clover Configurator tool to edit your Clover configuration. This tool should mount the EFI partition for you. If you want to mount it manually, first check the device name of the EFI partition in the terminal:
~$ diskutil list /dev/disk0 (external): #: TYPE NAME SIZE IDENTIFIER 0: GUID_partition_scheme 512.1 GB disk0 1: EFI EFI 209.7 MB disk0s1 2: Apple_HFS Main 511.8 GB disk0s2
Then you can mount it like so:
sudo mkdir /Volumes/EFI sudo mount -t msdos /dev/disk0s1 /Volumes/EFI
Alternative process: Dedicated Clover boot device
Rather than installing Clover by executing the .pkg on the guest, you can attach a dedicated Clover disk to your VM and just fill it with a Clover disk image that I’ve prepared.
On the hardware tab, add a new disk of size 1GB to hold Clover (if you’re already using IDE0 then add to IDE2). On the options tab, change the boot order to boot from this drive.
If you haven’t already switched your VM settings from SeaBIOS to OVMF, change the BIOS type to OVMF on the options tab, and add an EFI disk to store UEFI settings on the hardware tab.
If you have the Sierra install DVD mounted, make sure the line for that in your VM’s config contains the “media=cdrom” flag (unlike Enoch which needed that to be removed). For example:
Download this Clover disk image (5MB, uncompresses to 1GB), upload it to Proxmox and unpack it there with “gunzip clover-r4061-1gb.img.gz”. Now write that image onto the 1GB disk you added. For my ZFS-backed volume, that was accomplished with:
dd if=clover-r4061-1gb.img of=/dev/zvol/tank/vms/vm-104-disk-2 bs=1M
Be sure to get the device name correct so you don’t overwrite the wrong drive! Now you should be able to use this Clover boot disk to boot the Sierra installer, or an already-installed copy of Sierra.