Kramucus2 Mac OS
Kramucus2 Mac OS
If you are developing daemons to run on OS X, it is highly recommended that you design your daemons to be launchd
compliant. Using launchd
provides better performance and flexibility for daemons. It also improves the ability of administrators to manage the daemons running on a given system.
PaulTheTall has made a WineSkin wrapper for running KaM Remake under Mac OSX. Below are two different tutorial videos explaining how to use it: As explained in the videos, for legal reasons you first need to install the original game Knights and Merchants – The Peasants Rebellion, otherwise the KaM Remake installer will fail to. Mac OS VM Networking. Fixing What Ain’t Broke: NAT is fine for most people, but if you use SMB shares or need to access a NAS or other networked device, it can make that difficult. You can switch your network device to macvtap, but that isolates your VM from the host machine, which can also present problems. Here at MacStadium, we're big fans of Code with Chris and the iOS app development training he provides. We're happy you've come to check us out. MacStadium is the only provider of secure enterprise-class Apple Mac infrastructure.Whether you need a dedicated Mac to test your iOS app, or you need to deploy a Mac private cloud for large-scale CI/CD, MacStadium has got you covered. Krusader Alternatives for Mac. There are many alternatives to Krusader for Mac if you are looking to replace it. The most popular Mac alternative is Double Commander, which is both free and Open Source.If that doesn't suit you, our users have ranked more than 25 alternatives to Krusader and 12 are available for Mac so hopefully you can find a suitable replacement. File Name: lxdream-0.9.1-i386.dmg.zip File Size: 1.84 MB System: Sega Dreamcast Version: 0.9.1 Downloads: 104,092 Not what you are looking for? Check out our Mac emulator section!
If you are running per-user background processes for OS X, launchd
is also the preferred way to start these processes. These per-user processes are referred to as user agents. A user agent is essentially identical to a daemon, but is specific to a given logged-in user and executes only while that user is logged in.
Unless otherwise noted, for the purposes of this chapter, the terms “daemon” and “agent” can be used interchangeably. Thus, the term “daemon” is used generically in this section to encompass both system-level daemons and user agents except where otherwise noted.
There are four ways to launch daemons using launchd
. The preferred method is on-demand launching, but launchd
can launch daemons that run continuously, and can replace inetd
for launching inetd
-style daemons. In addition, launchd
can start jobs at timed intervals.
Although launchd
supports non-launch-on-demand daemons, this use is not recommended. The launchd
daemon was designed to remove the need for dependency ordering among daemons. If you do not make your daemon be launched on demand, you will have to handle these dependencies in another way, such as by using the legacy startup item mechanism.
Launching Custom Daemons Using launchd
With the introduction of launchd
in OS X v10.4, an effort was made to improve the steps needed to launch and maintain daemons. What launchd
provides is a harness for launching your daemon as needed. To client programs, the port representing your daemon’s service is always available and ready to handle requests. In reality, the daemon may or may not be running. When a client sends a request to the port, launchd
may have to launch the daemon so that it can handle the request. Once launched, the daemon can continue running or shut itself down to free up the memory and resources it holds. If a daemon shuts itself down, launchd
once again relaunches it as needed to process requests.
In addition to the launch-on-demand feature, launchd
provides the following benefits to daemon developers:
Simplifies the process of making a daemon by handling many of the standard housekeeping chores normally associated with launching a daemon.
Provides system administrators with a central place to manage daemons on the system.
Supports
inetd
-style daemons.Eliminates the primary reason for running daemons as root. Because
launchd
runs as root, it can create low-numbered TCP/IP listen sockets and hand them off to the daemon.Simplifies error handling and dependency management for inter-daemon communication. Because daemons launch on demand, communication requests do not fail if the daemon is not launched. They are simply delayed until the daemon can launch and process them.
The launchd Startup Process
After the system is booted and the kernel is running, launchd
is run to finish the system initialization. As part of that initialization, it goes through the following steps:
It loads the parameters for each launch-on-demand system-level daemon from the property list files found in
/System/Library/LaunchDaemons/
and/Library/LaunchDaemons/
.It registers the sockets and file descriptors requested by those daemons.
It launches any daemons that requested to be running all the time.
As requests for a particular service arrive, it launches the corresponding daemon and passes the request to it.
When the system shuts down, it sends a
SIGTERM
signal to all of the daemons that it started.
The process for per-user agents is similar. When a user logs in, a per-user launchd
is started. It does the following:
It loads the parameters for each launch-on-demand user agent from the property list files found in
/System/Library/LaunchAgents
,/Library/LaunchAgents
, and the user’s individualLibrary/LaunchAgents
directory.It registers the sockets and file descriptors requested by those user agents.
It launches any user agents that requested to be running all the time.
As requests for a particular service arrive, it launches the corresponding user agent and passes the request to it.
When the user logs out, it sends a
SIGTERM
signal to all of the user agents that it started.
Because launchd
registers the sockets and file descriptors used by all daemons before it launches any of them, daemons can be launched in any order. If a request comes in for a daemon that is not yet running, the requesting process is suspended until the target daemon finishes launching and responds.
If a daemon does not receive any requests over a specific period of time, it can choose to shut itself down and release the resources it holds. When this happens, launchd
monitors the shutdown and makes a note to launch the daemon again when future requests arrive.
Important: If your daemon shuts down too quickly after being launched, launchd
may think it has crashed. Daemons that continue this behavior may be suspended and not launched again when future requests arrive. To avoid this behavior, do not shut down for at least 10 seconds after launch.
Creating a launchd Property List File
To run under launchd
, you must provide a configuration property list file for your daemon. This file contains information about your daemon, including the list of sockets or file descriptors it uses to process requests. Specifying this information in a property list file lets launchd
register the corresponding file descriptors and launch your daemon only after a request arrives for your daemon’s services. Table 5-1 lists the required and recommended keys for all daemons.
The property list file is structured the same for both daemons and agents. You indicate whether it describes a daemon or agent by the directory you place it in. Property list files describing daemons are installed in /Library/LaunchDaemons
, and those describing agents are installed in /Library/LaunchAgents
or in the LaunchAgents
subdirectory of an individual user’s Library
directory. (The appropriate location for executables that you launch from your job is /usr/local/libexec
.)
Key | Description |
---|---|
| Contains a unique string that identifies your daemon to |
| Contains the arguments used to launch your daemon. (required) |
| Indicates that your daemon requires a separate instance per incoming connection. This causes |
| This key specifies whether your daemon launches on-demand or must always be running. It is recommended that you design your daemon to be launched on-demand. |
For more information: For a complete listing of the keys, see the launchd.plist
manual page.
For sample configuration property lists, look at the files in /System/Library/LaunchDaemons/
. These files are used to configure many daemons that run on OS X.
Writing a “Hello World!” launchd Job
The following simple example launches a daemon named hello
, passing world
as a single argument, and instructs launchd to keep the job running:
In this example, there are three keys in the top level dictionary. The first is Label
, which uniquely identifies the job. when. The second is ProgramArguments
which has a value of an array of strings which represent the tokenized arguments and the program to run. The third and final key is KeepAlive
which indicates that this job needs to be running at all times, rather than the default launch-on-demand behavior, so launchd should always try to keep this job running.
Listening on Sockets
You can also include other keys in your configuration property list file. For example, if your daemon monitors a well-known port (one of the ports listed in /etc/services
), add a Sockets
entry as follows:
The string for SockServiceName
typically comes from the leftmost column in /etc/services
. The SockType
is one of dgram
(UDP) or stream
(TCP/IP). If you need to pass a port number that is not listed in the well-known ports list, the format is the same, except the string contains a number instead of a name. For example:
Debugging launchd Jobs
There are some options that are useful for debugging your launchd job.
The following example enables core dumps, sets standard out and error to go to a log file, and instructs launchd to temporarily increase the debug level of its logging while acting on behalf of your job (remember to adjust your syslog.conf accordingly):
Running a Job Periodically
The following example creates a job that is run every five minutes (300 seconds):
Alternately, you can specify a calendar-based interval. The following example starts the job on the 7th day of every month at 13:45 (1:45 pm). Like the Unix cron subsystem, any missing key of the StartCalendarInterval
dictionary is treated as a wildcard—in this case, the month is omitted, so the job is run every month.
Monitoring a Directory
The following example starts the job whenever any of the paths being watched have changed:
An additional file system trigger is the notion of a queue directory. The launchd daemon starts your job whenever the given directories are non-empty, and it keeps your job running as long as those directories are not empty:
Emulating inetd
The launchd daemon emulates the older inetd
-style daemon semantics if you provide the inetdCompatibility
key:
Behavior for Processes Managed by launchd
Processes that are managed by launchd
must follow certain requirements so that they interact properly with launchd
. This includes launch daemons and launch agents.
Required Behaviors
To support launchd
, you must obey the following guidelines when writing your daemon code:
You must provide a property list with some basic launch-on-demand criteria for your daemon. See Creating a launchd Property List File.
You must not daemonize your process. This includes calling the
daemon
function, callingfork
followed byexec
, or callingfork
followed byexit
. If you do,launchd
thinks your process has died. Depending on your property list key settings,launchd
will either keep trying to relaunch your process until it gives up (with a “respawning too fast” error message) or will be unable to restart it if it really does die.Daemons and agents that are installed globally must be owned by the root user. Agents installed for the current user must be owned by that user. All daemons and agents must not be group writable or world writable. (That is, they must have file mode set to
600
or400
.)
Recommended Behaviors
To support launchd
, it is recommended that you obey the following guidelines when writing your daemon code:
Wait until your daemon is fully initialized before attempting to process requests. Your daemon should always provide a reasonable response (rather than an error) when processing requests.
Register the sockets and file descriptors used by your daemon in your
launchd
configuration property list file.If your daemon advertises a socket, check in with
launchd
as part of your daemon initialization. For an example implementation of the check-in process, see SampleD.During check-in, get the launch dictionary from
launchd
, extract and store its contents, and then discard the dictionary. Accessing the data structure used for the dictionary is very slow, so storing the whole dictionary locally and accessing it frequently could hurt performance.Provide a handler to catch the
SIGTERM
signal.
In addition to the preceding list, the following is a list of things it is recommended you avoid in your code:
Do not set the user or group ID for your daemon. Include the
UserName
,UID
,GroupName
, orGID
keys in your daemon’s configuration property list instead.Do not set the working directory. Include the
WorkingDirectory
key in your daemon’s configuration property list instead.Do not call
chroot
to change the root directory. Include theRootDirectory
key in your daemon’s configuration property list instead.Do not call
setsid
to create a new session.Do not close any stray file descriptors.
Do not change
stdio
to point to/dev/null
. Include theStandardOutPath
orStandardErrorPath
keys in your daemon’s configuration property list file instead.Do not set up resource limits with
setrusage
.Do not set the daemon priority with
setpriority
Although many of the preceding behaviors may be standard tasks for daemons to perform, they are not recommended when running under launchd
. The reason is that launchd
configures the operating environment for the daemons that it manages. Changing this environment could interfere with the normal operation of your daemon.
Deciding When to Shut Down
If you do not expect your daemon to handle many requests, you might want to shut it down after a predetermined amount of idle time, rather than continue running. Although a well-written daemon does not consume any CPU resources when idle, it still consumes memory and could be paged out during periods of intense memory use.
The timing of when to shut down is different for each daemon and depends on several factors, including:
The number and frequency of requests it receives
The time it takes to launch the daemon
The time it takes to shut down the daemon
The need to retain state information
If your daemon does not receive frequent requests and can be launched and shut down quickly, you might prefer to shut it down rather than wait for it to be paged out to disk. Paging memory to disk, and subsequently reading it back, incurs two disk operations. If you do not need the data stored in memory, your daemon can shut down and avoid the step of writing memory to disk.
Special Dependencies
While launchd
takes care of dependencies between daemons, in some cases, your daemon may depend on other system functionality that cannot be addressed in this manner. This section describes many of these special cases and how to handle them.
Network Availability
If your daemon depends on the network being available, this cannot be handled with dependencies because network interfaces can come and go at any time in OS X. To solve this problem, you should use the network reachability functionality or the dynamic store functionality in the System Configuration framework. This is documented in System Configuration Programming Guidelines and System Configuration Framework Reference. For more information about network reachability, see Determining Reachability and Getting Connected in System Configuration Programming Guidelines.
Disk or Server Availability
If your daemon depends on the availability of a mounted volume (whether local or remote), you can determine the status of that volume using the Disk Arbitration framework. This is documented in Disk Arbitration Framework Reference.
Non-launchd Daemons
If your daemon has a dependency on a non-launchd
daemon, you must take additional care to ensure that your daemon works correctly if that non-launchd
daemon has not started when your daemon is started. The best way to do this is to include a loop at start time that checks to see if the non-launchd
daemon is running, and if not, sleeps for several seconds before checking again.
Be sure to set up handlers for SIGTERM
prior to this loop to ensure that you are able to properly shut down if the daemon you rely on never becomes available.
User Logins
In general, a daemon should not care whether a user is logged in, and user agents should be used to provide per-user functionality. However, in some cases, this may be useful.
To determine what user is logged in at the console, you can use the System Configuration framework, as described in Technical Q&A QA1133.
Kernel Extensions
If your daemon requires that a certain kernel extension be loaded prior to executing, you have two options: load it yourself, or wait for it to be loaded.
The daemon may manually request that an extension be loaded. To do this, run kextload
with the appropriate arguments using exec
or variants thereof. I/O Kit kernel extensions should not be loaded with kextload
; the I/O Kit will load them automatically when they are needed.
Note: The kextload
executable must be run as root in order to load extensions into the kernel. For security reasons, it is not a setuid executable. This means that your daemon must either be running as the root user or must include a helper binary that is setuid root in order to use kextload
to load a kernel extension.
Alternatively, our daemon may wait for a kernel service to be available. To do this, you should first register for service change notification. This is further documented in I/O Kit Framework Reference.
After registering for these notifications, you should check to see if the service is already available. By doing this after registering for notifications, you avoid waiting forever if the service becomes available between checking for availability and registering for the notification.
Note: In order for your kernel extension to be detected in a useful way, it must publish a node in the I/O registry to advertise the availability of its service. For I/O Kit drivers, this is usually handled by the I/O Kit family.
For other kernel extensions, you must explicitly register the service by publishing a nub, which must be an instance of IOService
.
For more information about I/O Kit services and matching, see IOKit Fundamentals, I/O Kit Framework Reference (user space reference), and Kernel Framework Reference (kernel space reference).
For More Information
The manual pages for launchd
and launchd.plist
are the two best sources for information about launchd
.
In addition, you can find a source daemon accompanying the launchd
source code (available from http://www.macosforge.org/). This daemon is also provided from the Mac Developer Library as the SampleD sample code project.
The Daemons and Agents technical note provides additional information about how launchd
daemons and agents work under the hood.
Finally, many Apple-provided daemons support launchd
. Their property list files can be found in /System/Library/LaunchDaemons
. Some of these daemons are also available as open source from http://www.opensource.apple.com/ or http://www.macosforge.org/.
Copyright © 2003, 2016 Apple Inc. All Rights Reserved. Terms of Use Privacy Policy Updated: 2016-09-13
We’ve made every attempt to make this as straightforward as possible, but there’s a lot more ground to cover here than in the first part of the guide. If you find glaring errors or have suggestions to make the process easier, let us know on our discord.
With that out of the way, let’s talk about what you need to get 3D acceleration up and running:
If you’ve arrived here without context, check out part one of the guide here.
General
- A Desktop. The vast majority of laptops are completely incompatible with passthrough on Mac OS.
- A working install from part 1 of this guide, set up to use virt-manager
- A motherboard that supports IOMMU (most AMD chipsets since 990FX, most mainstream and HEDT chipsets on Intel since Sandy Bridge)
- A CPU that fully supports virtualization extensions (most modern CPUs barring the odd exception, like the i7-4770K and i5-4670K. Haswell refresh K chips e.g. ‘4X90K’ work fine.)
- 2 GPUs with different PCI device IDs. One of them can be an integrated GPU. Usually this means just 2 different models of GPU, but there are some exceptions, like the AMD HD 7970/R9 280X or the R9 290X and 390X. You can check here (or here for AMD) to confirm you have 2 different device IDs. You can work around this problem if you already have 2 of the same GPU, but it isn’t ideal. If you plan on passing multiple USB controllers or NVMe devices it may also be necessary to check those with a tool like
lspci
. - The guest GPU also needs to support UEFI boot. Check here to see if your model does.
- Recent versions of Qemu (3.0-4.0) and Libvirt.
AMD CPUs
- The most recent mainline linux kernel (all platforms)
- Bios prior to AGESA 0.0.7.2 or a patched kernel with the workaround applied (Ryzen)
- Most recent available bios (ThreadRipper)
- GPU isolation fixes applied, e.g. CSM toggle and/or efifb:off (Ryzen)
- ACS patch (lower end chipsets or highly populated pcie slots)
- A second discrete GPU (most AMD CPUs do not ship with an igpu)
Intel CPUs
- ACS patch (only needed if you have many expansion cards installed in most cases. Mainstream and budget chipsets only, HEDT unaffected.)
- A second discrete GPU (HEDT and F-sku CPUs only)
Nvidia GPUs
- A 700 Series Card. High Sierra works up to 10 series cards, but Mojave ends support for 9, 10, 20 and all future Nvidia GPUs. Cards older than the 700 series may not have UEFI support, making them incompatible.
- A google search to make sure your card is compatible with Mac OS on Macs/hackintoshes without patching or flashing.
AMD GPUs
- A UEFI compatible Card. AMD’s refresh cycle makes this a bit more complicated to work out, but generally pitcairn chips and newer work fine — check your card’s bios for “UEFI Support” on techpowerup to confirm.
- A card without the Reset Bug (Anything older than Hawaii is bug free but it’s a total crap-shoot on any newer card. 300 series cards may also have Mac OS specific compatibility issues. Vega and Fiji seem especially susceptible)
- A google search to make sure your card is compatible with Mac OS on Macs/hackintoshes without patching or flashing.
Getting Started with VFIO-PCI
Provided you have hardware that supports this process, it should be relatively straightforward.
First, you want to enable virtualization extensions and IOMMU in your uefi. The exact name and locations varies by vendor and motherboard. These features are usually titled something like “virtualization support” “VT-x” or “SVM” — IOMMU is usually labelled “VT-d” or “AMD-Vi” if not just “IOMMU support.”
Once you’ve enabled these features, you need to tell Linux to use them, as well as what PCI devices to reserve for your vm. The best way of going about this is changing your kernel commandline boot options, which you do by editing your bootloader’s configuration files. We’ll be covering Grub 2 here because it’s the most common. Systemd-boot distributions like Pop!OS will have to do things differently.
run lspci -nnk grep 'VGA Audio'
— this will output a list of installed devices relevant to your GPU. You can also just run lspci -nnk
to get all attached devices, in case you want to pass through something else, like an NVMe drive or a usb controller. Look for the device ids for each device you intend to pass through, for example, my GTX 1070 is listed as [10de:1b81]
and [10de:10f0]
for the HDMI audio. You need to use every device ID associated with your device, and most GPUs have both an audio controller and VGA. Some cards, in particular VR-ready nvidia GPUs and the new 20 series GPUs will have more devices you’ll need to pass, so refer to the full output to make sure you got all of them.
If two devices you intend to pass through have the same ID, you will have to use a workaround to make them functional. Check the troubleshooting section for more information.
Once you have the IDs of all the devices you intend to pass through taken down, it’s time to edit your grub config:
It should look something like this:
In the line GRUB_CMDLINE_LINUX=
add these arguments, separated by spaces: intel_iommu=on
OR amd_iommu=on
, iommu=pt
and vfio-pci.ids=
followed by the device IDs you want to use on the VM separated by commas. For example, if I wanted to pass through my GTX 1070, I’d add vfio-pci.ids=10de:1b81,10de:10f0
. Save and exit your editor.
Run grub-mkconfig -o /boot/grub/grub.cfg
. This path may be different for you on different distros, so make sure to check that this is the location of your grub.cfg prior to running this and change it as necessary. The tool to do this may also be different on certain distributions, e.g. update-grub
.
Reboot.
Verifying Changes
Now that you have your devices isolated and the relevant features enabled, it’s time to check that your machine is registering them properly.
grab iommu.sh from our companion repo, make it executable with chmod +x iommu.sh
and run it with ./iommu.sh
to see your iommu groups. No output means you didn’t enable one of the relevant UEFI features, or didn’t revise your kernel commandline options correctly. If the GPU and your other devices you want to pass to the host are in their own groups, move on to the next section. If not, refer to the troubleshooting section.
Run dmesg grep vfio
to ensure that your devices are being isolated. No output means that the vfio-pci module isn’t loading and/or you did not enter the correct values in your kernel commandline options.
From here the process is straightforward. Start virt-manager (conversion from raw qemu covered in part one) and make sure the native resolution of both the config.plist and the OVMF options match each other and the display resolution you intend to use on the GPU. if you aren’t sure, just use 1080p.
Click Add Hardware in the VM details, select PCI host device, select a device you’ve isolated with vfio-pci, and hit OK. Repeat for each device you want to pass through. Remove all spice and Qxl devices (including spice:channel), attach a monitor to the gpu and boot into the VM. Install 3d drivers, and you’re ready to go. Note that you’ll need to add your mouse and keyboard to the VM as usb devices, pass through a usb controller, or set up evdev to get input in the host at this point as well.
If all goes well, you just need to install drivers and you’re ready to use 3d on your OSX VM.
Mac OS VM Networking
Fixing What Ain’t Broke:
NAT is fine for most people, but if you use SMB shares or need to access a NAS or other networked device, it can make that difficult. You can switch your network device to macvtap, but that isolates your VM from the host machine, which can also present problems.
If you want access to other networked devices on your guest machine without stopping guest-host communication, you’ll have to set up a bridged network for it. There are several ways to do this, but we’ll be covering the methods that use NetworkManager, since that’s the most common backend. If you use wicd or systemd-networkd, refer to documentation on those packages for bridge creation and configuration.
Via Network GUI:
This process can be done completely in the GUI on modern desktop environment by going to the network settings dialog, by adding a connection, selecting bridge as the type, adding your network interface as the slave device, and then activating the bridge (sometimes you need to restart network manager if the changes don’t take effect immediately.) From there all you need to do is add the bridge as a network device in virt-manager.
Via NMCLI:
Not everyone uses a full desktop environment, but you can do this with nmcli
as well:
Run ifconfig or nmcli to get the names of your devices, they’ll be relevant in the next steps. take down or copy the name of the adapter you use to connect to the internet.
Next, run these commands, substituting the placeholders with the device name of the network adapter you want to bridge to the guest. They create a bridge device, connect the bridge to your network adapter, and create a tap for the guest system, respectively:
From here, remove the NAT device in virt-manager, and add a new network device with the connection set to br1: host device tap0. You may need to restart network manager for the device to activate properly.
NOTE: Wireless adapters may not work with this method. The ones that do need to support AP/Mesh Point mode and have multiple channels available. Check for these by running iw list
. From there you can set up a virtual AP with hostapd and connect to that with the bridge. We won’t be covering the details of this process here because it’s very involved and requires a lot of prior knowledge about linux networking to set up correctly.
Other Options:
You can also pass through a PCIe NIC to the device if you happen to have a Mac OS compatible model laying around, and you’re comfortable with adding kexts to clover. This is also the best way to get AirDrop working if you need it.
If all else fails, you can manually specify routes between the host and guest using macvtap and ip
, or set up a macvlan. Both are complex and require networking knowledge.
Input Tweaks
Emulated input might be laggy, or give you problems with certain input combinations. This can be fixed using several methods.
Attach HIDs as USB Host devices
This method is the easiest, but has a few drawbacks. Chiefly, you can’t switch your keyboard and mouse back to the host system if the VM crashes. It may also need to be adjusted if you change where your devices are plugged in on the host. Just click the add hardware button, select usb host device, and then select your keyboard and mouse. When you start your VM, the devices will be handed off.
Use Evdev
This method uses a technique that allows both good performance and switchable inputs. We have a guide on how to set it up here. Note that because OS X does not support PS2 Input out of the box, you need to replace your ps/2 devices as follows in your xml:
If you can’t get usb devices working for whatever reason (usually due to an outdated qemu version) you can add the VoodooPS2 Kext to your ESP to enable ps2 input. This may limit compatibility with new releases, so make sure to check that you have an alternative before committing.
Use Barrier/Synergy
Synergy and barrier are networked input packages that allow you to control your host and/or guest on the same machine, or remotely. They offer convenient input, but will not work with certain networking configurations. Synergy is paid software, but Barrier is free, and isn’t hard to set up. with one caveat on MacOS. You either want to stick with a version prior to 1.3.6 or install the binary manually like so:
After that, just follow a synergy configuration guide (barrier is just an open source fork of synergy) to set up your merged input. It’s usually as simple as opening the app, setting one as server, entering the network address of the other, and then arranging the virtual merged screens accordingly. Note that if you experience bad performance on your guest with synergy/barrier, you can make the guest the server and pass usb devices as described above, but this will make your input devices unavailable on the host if the VM crashes.
Use a USB Controller and Hardware KVM Switch
Probably the most elegant solution. You need $20-60 in hardware to do it, but it allows switching your inputs without prior configuration or problems if the guest VM crashes. Simply isolate and pass through a usb controller (as you would a gpu in the section above) and plug a usb kvm switch into a port on that controller as well as a usb controller on the host. Plug your keyboard and mouse into the kvm switch, and press the button to switch your inputs from one to the other.
Some USB3 controllers are temperamental and don’t like being passed through, so stick to usb2 or experiment with the ones you have. Typically newer Asmedia and Intel ones work best. If your built-in USB controller has issues it may still be possible to get it working using a 3rd party script, but this will heavily depend on how your kvm switch operates as well. Your best bet is just to buy a PCIe controller if the one you have doesn’t work.
Audio
By default, audio quality isn’t the best on OS X guest VMs. There are a few ways around it, but we suggest a hardware-based approach for the best reliability.
Hardware-Based Audio Passthrough
This method is fairly simple. Just buy a class compliant USB audio interface advertised as working in Mac OS, and plug it into a USB controller that you’ve passed through to the VM as described in the KVM switch section. If you need seamless audio between host and guest systems, we have a guide on how to get that working as well. We regard this option as the best solution if you plan on using both the host and guest system regularly.
HDMI Audio Extraction
If you’re already passing through a GPU, you can just use that as your audio output for the VM. Just use your monitor’s line out, or grab an audio extractor as described in the linked article above.
Pulseaudio/ALSA passthrough
You can pass through your VM audio via the ich9 device to your host systems’ audio server. We have a guide that goes into detail on this process here.
CoreAudio to Jack
CoreAudio supports sending system sound through Jack, a versatile and powerful unix sound system. Jack supports networking, so it’s possible to connect the guest to the host over the network via Jack. Because Jack is fairly complex and this method requires a specific network setup to get it working, we’ll be saving the specifics of it for a future article. On Linux host systems, tools like Carla can make initial Jack setup easier.
Quality of Life
If you find yourself doing a lot of workarounds or want to customize things even further, these are some tools and resources that can make your life easier.
Clover Configurator
This is a tool that automates some aspects of managing clover and your ESP configuration. It can make things like adding kexts and defining hardware details (needed to get iMessage and other things working) easier. It may change your config.plist in a way that reduces compatibility, so be careful if you elect to use it.
InsanelyMac and AMD-OSX
Forums where people discuss hackintosh installation and maintenance. Many things that work in baremetal hackintoshes will work in a VM, so if you’re looking for tweaks that are only relevant to your software configuration, this is a good place to start.
Troubleshooting
As always, first steps when running into issues should be to read through dmesg
output on the host after starting the VM and searching for common problems.
No output after passing through my GPU
Make sure you have a compatible version of Mac OS, most Nvidia cards will only work on High Sierra and earlier, and 20 series cards will not work at all. Make sure you don’t have spice or QXL devices attached, and follow the steps in the verification section to make sure that your vfio-pci configuration works. If it doesn’t you may have to load the driver manually, but this isn’t the case on most modern linux distributions.
Make sure that your config.plist and OVMF resolution match your monitor’s native resolution. How to edit these settings is covered in Part 1.
If all else fails, you can try passing a vbios to the card by downloading the relevant files from techpowerup and adding the path to them in your XML, usually something like <rom bar='on' file='/var/lib/libvirt/vbios/vbios.rom'/>
in the pci device section that corresponds to the GPU.
Can’t Connect to SMB shares or see other networked devices
Change to a different networking setup as described in the networking section
iMessage/AirDrop/Apple Services not working
You have to configure these just like any other hackintosh. Consult online guides for procedure specifics.
Multiple PCI devices in the same IOMMU group
You need to install the ACS patch. Arch, fedora and Ubuntu all have prepatched kernel repos. Systemd-boot based ubuntu distributions like Pop!OS will need further work to get an installed kernel working. Refer to your distro documentation for exact procedure needed to switch or patch kernels otherwise. You’ll also need to add
2 identical PCI IDs
You’re going to have to add a script that isolates only 1 card early in the boot process. There’s several ways to do this, and our method may not work for you, but this is the methodology we suggest:
open up a text editor as root and and copy/paste this script:
Save it as /usr/bin/vfioverride.sh
.
from there run these commands as root:
On Arch, as root, make a new file called pci-isolate.conf
in /etc/modprobe.d
, open it in an editor and add the line install/usr/bin/init-top/vfioverride.sh
to it. Save it. Make sure modconf
is listed in the HOOKS=(
array section of your initrd config file, mkinitcpio.conf
.
If you’re on fedora or RHEL, you can simply add the install line to install_items+=
array and modconf/vfio-pci to the add_drivers+=
array.
And update your initial ramdisk using mkinitcpio
, dracut
, or update-initramfs
depending on your distribution (Arch, RHEL/Fedora and *Buntu respectively.)
NOTE: script installation methodology varies from distro to distro. You may have to add initramfs hooks for the script to take effect, or force graphics drivers to load later to prevent the card from being captured before it can be isolated. refer to the Arch Wiki article for a different installation methodology if this one fails. You may also have to add the vfio-pci modules to initramfs hooks if your kernel doesn’t load the vfio-pci module automatically.
Reboot and verify your devices are isolated by checking lspci
for them (if they’re missing you’re good to go.)
If not, set vfio-pci to load early with hooks and try again. If it still doesn’t work, you may need to compile a kernel that does not load the module and follow the archwiki guide on traditional setup.
The best preventative measure for this problem is to buy different cards in the first place.
I did everything instructed but the GPU still won’t isolate/VM crashes or hardlocks system on startup
Your Graphics drivers are probably set to load earlier in the boot process than vfio-pci. You can fix this one of 2 ways:
- blacklisting the graphics driver early
- tell your initial ramdisk to load vfio-pci earlier than your graphics drivers
The first option can be achieved by adding amdgpu,radeon
or nouveau
to module_blacklist=
in your kernel command line options (same way you added vfio device IDs in the first section of this tutorial.)
The second is done by adding vfio_pci vfio vfio_iommu_type1 vfio_virqfd
to your initramfs early modules list, and removing any graphics drivers set to load at the same time. This process varies depending on your distro.
Onmkinitcpio
systems (Arch,) you add these to the MODULES=
section of /etc/mkinitcpio.conf
and then rebuild your initramfs by running mkinitcpio -P
.
Kramucus2 Mac Os Download
On dracut
systems (Fedora, RHEL, Centos, Arch in future releases,) you add these to a .conf file in the /etc/modules-load.d/
folder.
Images Courtesy Foxlet, Pixabay
Kramucus2 Mac Os X
Consider Supporting us on Patreon if you like our work, and if you need help or have questions about any of our articles, you can find us on our Discord. We provide RSS feeds as well as regular updates on Twitter if you want to be the first to know about the next part in this series or other projects we’re working on.
Kramucus2 Mac OS