My Journey to Make MacOS Run On ANY PC
To begin with today’s topic, let’s watch a video first:
The idea behind running MacOS on any PC is that
we are able to boot MacOS on virtual machine and that virtual machine can run on any PC equals to MacOS can run on any PC.
This article is about my experience on how I made MacOS run on my PC and how I resolved some related issues. Please follow the steps on The Passthrough Post website.
Step 1: New and Improved Mac OS Tutorial, Part 1 (The Basics) — Install MacOS on VM
Step 2 (Optional): Mac OS VM Guide Part 2 (GPU Passthrough and Tweaks) — Enable GPU on VM
Step 3 (Optional): Edev Passthrough Keyboard and Mouse — Passthrough keyboard and mouse that can be used on both host and VM at the same time
Step 4 (Optional): Prepare for Apple ID
Step 5 (Optional): USB Passthrough (From UNRAID forum) — Passthrough USB controller enables the ability to of USB slot on VM, and resolves USB port (NOT ENOUGH)
issue.
Debug Journey
After following the instructions on the above websites, I encountered some errors and these errors were not very straightforward for a VM newbie like me. Therefore, I want to share my search results to help someone struggling with the similar issues.
Error 1: vfio: error group X is not viable, please ensure all devices within the iommu_group after Step 2.
Solution: Make sure every device in different iommu group
- Check iommu group to see if every device is in different group with this script or simply enter
ls /sys/kernel/iommu_groups/*/devices
in the terminal. In this case, there should be several devices in one iommu group. - Make sure ACS is enabled in bios. Install and boot ACS kernel patch. Then, every device should be in different groups. If not, proceed to the next step.
- Add
pcie_acs_override=downstream,multifunction
in/etc/default/grub
underGRUB_CMDLINE_LINUX
section. Reboot. This method is overkilled. Please refer to the following video for how to properly setting pcie_acs_override parameter.
I found a good video explaining about the theory behind Passthrough, PCIe, and IOMMU Groups.
Error 2: Host UI freezes when virtual machine is booted after Step 2.
Solution: Make sure the passing through GPU is using the correct kernel — vfio-pci
.
- Enter
lspci -vnn
in the terminal to see if the GPU is usingvfio-pci
kernel. - Edit
/etc/modprobe.d/vfio.conf
configuration withoptions vfio-pci ids=1002:67df
(1002:67df is your GPU id which we can find by enteringlspci -nkk | grep "VGA\|Audio")
- Enter
cat/sys/bus/pci/devices/0000:0b:00.0 /modalias
to get the modalias id for GPU with PCI ID0000:0b:00.0
which we can find by excuting this script - Update initramfs by entering
update-initramfs -u -k all
- Reboot and check again with
lspci -vnn
Reference: QEMU Virtual Machine PCIe Device Passthrough Using vfio-pci
Error 3: Could not open /dev/input/by-id/… Permission Deny when launch virtual machine after Step 3.
Solution 1: Change /dev/input/by-id/…
to /dev/input/evnet…
- Enter
ls -l /dev/input/by-id
in terminal to see the connecting event with corresponding device - Replace every
/dev/input/by-id/…
with corresponding/dev/input/evnet…
in/etc/libvirt/qemu.conf
file andvirsh edit [your VM]
configuration.
Side effect: The event may change whenever the system is reboot. Therefore, it is better to keep /dev/input/by-id/…
if available.
Solution 2: Add parameter in /etc/libvirt/qemu.conf
file
- Add
security_driver="none"
in/etc/libvirt/qemu.conf
file service libvirtd restart
and reboot
Finally, everything is working smoothly.
Thanks for every resource that I referenced in this article for resolving all my issues. Hope this information solve your issue as well.