Virtualization

RSS for tag

Create hardware-accelerated virtual machines to run macOS and Linux-based operating systems.

Posts under Virtualization tag

203 Posts

Post

Replies

Boosts

Views

Activity

Virtualization API - Share folders when VM running
I want to expose a directory to MacOS VM when it is running. Apple's documentation mentions this (here) : The VZDirectoryShare on the configuration defines the host directories to expose to the guest. To limit or expose new directories to the guest while the VM is running, you can update the directory share with VZVirtioFileSystemDevice. But I tried the following when VM is running: Changing the original configuration of directory (saved the config applied, then changed it) Added new directory share in the original configuration Restarted running VM after (1) and (2) None of them are working. Anyone has any idea how to make this work ? Or this is not currently supported ?
1
0
943
Jun ’23
Creating a vsock socket on the host results in ENODEV
I'm trying to create a vsock socket on the host but it fails with ENODEV. I know I can use a VZVirtioSocketDeviceConfiguration and get one through the Virtualization Framework, but for my use case it would be easier to integrate if I can create the socket myself. This works from inside a VM assuming I've configured a VZVirtioSocketDeviceConfiguration, but not on the host. #include <sys/types.h> #include <sys/socket.h> #include <stdio.h> int main() { int fd = socket(PF_VSOCK, SOCK_STREAM, 0); if (fd < 0 ) { perror("socket"); } return 0; }
1
1
1.1k
Jun ’23
Developer Credentials not working in Virtual Machine
Hello, I am running a virtual machine on my Apple Silicon Mac, using the sample Xcode project provided by Apple last year. I have Ventura 13.4 installed on on the host and the VM. I try to enter my Apple ID credentials in "Sign In with Apple ID" in the VM so I may then update this VM to Sonoma. I am sure I am getting my password correct. I cannot log in. Please see the screen shot. Am I supposed to be able to do this? I can log into developer.apple.com within the VM OK. Thank you. FB12263051
1
0
1.2k
Jun ’23
What you need to know to boot your kernel
It's important to notice how Virtualization.framework seems to be a work in progress framework. I thank the Apple team to have prioritized the Virtualization features in macOS. This post will be a sum up of personal findings I found while playing with Virtualization.framework and a custom EFI Kernel. The thread will be updated as soon as I find any particular information about building a custom kernel and trying to load in Virtualization.framework. Naturally, it's not endorsed by anyone. Before starting... Before a list of "what to do", it's important to say that there are few details about how Virtualization.framework works under the hood. You might be a little demotivated, and creating a custom kernel for aarch64/x86_64 is very hard. Give a look for resources and do not loose your head! Custom Kernel To boot a custom kernel for Virtualization.framework, you need: UEFI compliant bootloader: pick the one you prefer. Among the popular options, there is GRUB, Limine, BootBoot. It's fundamental to be sure that bootloader is for UEFI and can load your kernel. You might want to try to run qemu for the architecture you're looking for. VirtIO support. This probably is a little bit difficult task. The devices (such as network, graphics, sound) can be retrieved using the PCI bus. Look at Intel or ARM documentation to specifically know how to write to I/O ports (e.g. ARM has its devices memory mapped, while on Intel you need to dig a little bit). Another note is about graphics. Some bootloader such as GRUB or Limine supports the framebuffer protocol and can ask directly to UEFI where the screen device is (returning an address that you can use to write pixel.) The VirtIO support is based on PCI drivers. I can suggest at first to load an hello world kernel, building the fundamental parts of OS for memory, and then start to implement PCI drivers. Once you did that, you can start to think about VirtIO and its queue. How to run it To boot the custom kernel, usually developers prefer to deploy it as a valid ISO image that contains the correct bootloader and kernel, or as a RAW image of the disk. It's important to notice that you need to build a VM machine with VZEFIBootLoader that creates a UEFI bootloader. RAW image of the disk MUST BE a valid APFS image. ISO image should be prepared with xorriso or anything similar: you have to be sure that the ISO respects the DOS format and is bootable. TL;DR: any ISO uefi-compatible should be runnable in Virtualization.framework. In case of any issues, or questions you can post a question in this forum. Resources include: the documentation for Virtualization.framework ARM/Intel assembly manuals
0
1
914
Jun ’23
Forwarding Ports between VM and Host
I have a vm up and running after following some of the examples in the documentation. One thing I can't quite figure out how to do, is allow the Host to access services running on the VM from localhost. From the documentation it looks like there might be a couple options: Write a function that checks for new broadcasted ports from the guest, and then sets up a socket connection to the host for the port Try to obtain the com.apple.vm.networking entitlement for my application and setup a Bridged network device instead of a NAT Is there anything I am missing like a way to accomplish this easier with NAT, or are those the main options?
1
0
1.1k
May ’23
Issues trying to create a VZVirtioSocketDevice
Hello all, I am trying to setup a socket for communication between the host/guest. According to the documentation after adding a VZVIrtioSocketDeviceConfiguration object to configuration.socketDevices, the resulting virtualMachine object should have an array of VZVirtioSocketDevices with the member function setListener. So I have: let socketConfig = VZVirtioSocketDeviceConfiguration() configuration.socketDevices = [socketConfig] ... let virtualMachine = VZVirtualMachine(configuration: configuration) virtualMachine.socketDevices[0].setSocketListener(<#T##VZVirtioSocketListener#>, forPort: <#T##UInt32#>) but Xcode throws this error Value of type 'VZSocketDevice' has no member 'setSocketListener' Is there something I am missing?
2
0
658
May ’23
Ventura does not accept my Apple ID
Hi, I use MacVM to install Ventura on a VM. With macOS Ventura beta 2 I have several problems that I would have liked to report via the "Feedback assistant" application. The problem is that the application refuses my Apple ID and display the message "An error occurred during authentication." To verify my Apple ID I logged into my developer account via Safari. I was able to do it with no problem.
9
1
4.6k
May ’23
Can't enable com.apple.vm.networking entitlement
Host: Mac Ventura 13.3/m1 Xcode:14.3 My request for access to the com.apple.vm.networking entitlement has been approved. In Xcode I have also enabled the ability to automatically manage signing. Then i followed the steps in the link, focusing on new process part (https://developer.apple.com/forums/thread/663271) I encountered some problems when I was trying to enable "com.apple.vm.networking" Adopt an Explicit App ID I already have an explicit App ID for a macOS target. Configure Your App ID My App ID has the VM Networking option checked. Enable the Entitlement (in the https://developer.apple.com/documentation/virtualization/running_macos_in_a_virtual_machine_on_apple_silicon_macs to download sample code) In the sample code macOSVirtualMachineSampleApp.entitlements and InstallationTool.entitlements these two file, I have added the "com.apple.vm.net working", and set the value to YES, but for my build target(InstallationTool-Swift), there is no Personal VPN capability here, so I did not add this capability to update profile, but when I build my target, the terminal always appears the following error. This error caused my virtual machine to not start at all: Message from debugger: no such process. Program ended with exit code: -1 I searched the Internet for this error which may have been caused by my developer account authentication failure, but i'm not sure. Please let me know where I went wrong. Now it seems that "com.apple.vm.networking" does not take effect or authorization is not successful. I also don't know whether there is something wrong with my configuration. Anyway, I hope you can give me some advice.
2
0
1.8k
May ’23
No error handler for XPC error: Connection invalid
I am on Ventura 13.3.1 with the M2 and I was trying to set up a Linux VM, following the steps on your website, but after I chose the ISO the following Error in Xcode appeared: GUILinuxVirtualMachineSampleApp[5863:111794] [client] No error handler for XPC error: Connection invalid . There was already a question about the No error handler on this forum, but that still didn't help me fix my Problem. So now my question is how do I fix it, because I have almost no good idea where to start. I can give more informations if needed. Big thanks and regards in advance :). Sincerely, Bieber
1
0
1.7k
Apr ’23
Running built macOS app in 13.3 beta VM on M1?
I managed to get a macOS 13.3 beta install running in Parallels on my M1 VM, but it was really hard to get my app (built on my 13.2.1 M1 native macOS) installed on it, because so many features are unsupported in the VM (e.g. I can't drop files onto it like I can with other OSes, or on Intel; I can't log in with my Apple ID because Apple doesn't allow that, etc.). I finally copied it over using File Sharing from the VM, but the virtual OS won't launch it. It throws up a vague alert saying "The application can’t be opened." If I try to launch it from the command line, I get The application cannot be opened for an unexpected reason, error=Error Domain=RBSRequestErrorDomain Code=5 "Launch failed." UserInfo={NSLocalizedFailureReason=Launch failed., NSUnderlyingError=0x600000f2da10 {Error Domain=NSPOSIXErrorDomain Code=153 "Unknown error: 153" UserInfo={NSLocalizedDescription=Launchd job spawn failed}}} I assume it's some kind of code signing/gatekeeper issue, but I don't really know. I also tried this using the Apple virtualization framework and sample virtual machine tools (neat that those exist). I'm pretty sure this is exactly what Parallels is using internally, btw. It lacks a LOT. Is there any way to make running macOS betas in a VM a viable way of testing?
4
1
1.6k
Feb ’23
Folder sharing with VZVirtioFileSystemDeviceConfiguration Not Working (Linux Guest)?
I'm trying to share a directory on my Mac with a virtual machine I created using the Virtualization framework. The virtual machine is running Fedora. I configure the share like this:  NSError *error = nil; if ([VZVirtioFileSystemDeviceConfiguration validateTag:tag error:&error]) { //Tag validates...   VZSharedDirectory *sharedDirectiory = [[VZSharedDirectory alloc]initWithURL:theURL readOnly:NO];    VZSingleDirectoryShare *singleDirectoryShare = [[VZSingleDirectoryShare alloc]initWithDirectory:sharedDirectiory]; VZVirtioFileSystemDeviceConfiguration *shareConfig = [[VZVirtioFileSystemDeviceConfiguration alloc]initWithTag:tag];  shareConfig.share = singleDirectoryShare;  virtualMachineConfiguration.directorySharingDevices = @[shareConfig]; } The virtual machine starts up without any errors but the shared directory is nowhere to be found. Anyone know where am I'm going wrong? Thanks in advance.
1
1
797
Feb ’23
Is it possible to use the Swift Virtualization Framework on an iPad or iPhone?
Given that the new iPads have M1 chips, would it be possible to use the virtualization framework on the on an iPad/iPhone? Though it is not currently listed as a possibility in the documentation, is it possible to modify any configuration settings to make it work in a mobile environment? I would like to run a virtual machine on an iPad/iOS to run python applications.
3
0
1.9k
Dec ’22
Problem with starting Gentoo Linux in Virtualization
Im playing a bit with Virtualization framework. I have problem starting Gentoo Linux on x86_64 machine. It shows EFI boot device selection screen, and after that black screen with just carriage (not blinking). Not sure how to check what is going on. I tried with different settings and devices. I think probably something is missing from Gentoo installer iso, that I need to add to the kernel? How would I learn what is missing?
1
0
949
Dec ’22
Virtualization API - Share folders when VM running
I want to expose a directory to MacOS VM when it is running. Apple's documentation mentions this (here) : The VZDirectoryShare on the configuration defines the host directories to expose to the guest. To limit or expose new directories to the guest while the VM is running, you can update the directory share with VZVirtioFileSystemDevice. But I tried the following when VM is running: Changing the original configuration of directory (saved the config applied, then changed it) Added new directory share in the original configuration Restarted running VM after (1) and (2) None of them are working. Anyone has any idea how to make this work ? Or this is not currently supported ?
Replies
1
Boosts
0
Views
943
Activity
Jun ’23
Creating a vsock socket on the host results in ENODEV
I'm trying to create a vsock socket on the host but it fails with ENODEV. I know I can use a VZVirtioSocketDeviceConfiguration and get one through the Virtualization Framework, but for my use case it would be easier to integrate if I can create the socket myself. This works from inside a VM assuming I've configured a VZVirtioSocketDeviceConfiguration, but not on the host. #include &lt;sys/types.h&gt; #include &lt;sys/socket.h&gt; #include &lt;stdio.h&gt; int main() { int fd = socket(PF_VSOCK, SOCK_STREAM, 0); if (fd &lt; 0 ) { perror("socket"); } return 0; }
Replies
1
Boosts
1
Views
1.1k
Activity
Jun ’23
Developer Credentials not working in Virtual Machine
Hello, I am running a virtual machine on my Apple Silicon Mac, using the sample Xcode project provided by Apple last year. I have Ventura 13.4 installed on on the host and the VM. I try to enter my Apple ID credentials in "Sign In with Apple ID" in the VM so I may then update this VM to Sonoma. I am sure I am getting my password correct. I cannot log in. Please see the screen shot. Am I supposed to be able to do this? I can log into developer.apple.com within the VM OK. Thank you. FB12263051
Replies
1
Boosts
0
Views
1.2k
Activity
Jun ’23
What you need to know to boot your kernel
It's important to notice how Virtualization.framework seems to be a work in progress framework. I thank the Apple team to have prioritized the Virtualization features in macOS. This post will be a sum up of personal findings I found while playing with Virtualization.framework and a custom EFI Kernel. The thread will be updated as soon as I find any particular information about building a custom kernel and trying to load in Virtualization.framework. Naturally, it's not endorsed by anyone. Before starting... Before a list of "what to do", it's important to say that there are few details about how Virtualization.framework works under the hood. You might be a little demotivated, and creating a custom kernel for aarch64/x86_64 is very hard. Give a look for resources and do not loose your head! Custom Kernel To boot a custom kernel for Virtualization.framework, you need: UEFI compliant bootloader: pick the one you prefer. Among the popular options, there is GRUB, Limine, BootBoot. It's fundamental to be sure that bootloader is for UEFI and can load your kernel. You might want to try to run qemu for the architecture you're looking for. VirtIO support. This probably is a little bit difficult task. The devices (such as network, graphics, sound) can be retrieved using the PCI bus. Look at Intel or ARM documentation to specifically know how to write to I/O ports (e.g. ARM has its devices memory mapped, while on Intel you need to dig a little bit). Another note is about graphics. Some bootloader such as GRUB or Limine supports the framebuffer protocol and can ask directly to UEFI where the screen device is (returning an address that you can use to write pixel.) The VirtIO support is based on PCI drivers. I can suggest at first to load an hello world kernel, building the fundamental parts of OS for memory, and then start to implement PCI drivers. Once you did that, you can start to think about VirtIO and its queue. How to run it To boot the custom kernel, usually developers prefer to deploy it as a valid ISO image that contains the correct bootloader and kernel, or as a RAW image of the disk. It's important to notice that you need to build a VM machine with VZEFIBootLoader that creates a UEFI bootloader. RAW image of the disk MUST BE a valid APFS image. ISO image should be prepared with xorriso or anything similar: you have to be sure that the ISO respects the DOS format and is bootable. TL;DR: any ISO uefi-compatible should be runnable in Virtualization.framework. In case of any issues, or questions you can post a question in this forum. Resources include: the documentation for Virtualization.framework ARM/Intel assembly manuals
Replies
0
Boosts
1
Views
914
Activity
Jun ’23
Forwarding Ports between VM and Host
I have a vm up and running after following some of the examples in the documentation. One thing I can't quite figure out how to do, is allow the Host to access services running on the VM from localhost. From the documentation it looks like there might be a couple options: Write a function that checks for new broadcasted ports from the guest, and then sets up a socket connection to the host for the port Try to obtain the com.apple.vm.networking entitlement for my application and setup a Bridged network device instead of a NAT Is there anything I am missing like a way to accomplish this easier with NAT, or are those the main options?
Replies
1
Boosts
0
Views
1.1k
Activity
May ’23
Issues trying to create a VZVirtioSocketDevice
Hello all, I am trying to setup a socket for communication between the host/guest. According to the documentation after adding a VZVIrtioSocketDeviceConfiguration object to configuration.socketDevices, the resulting virtualMachine object should have an array of VZVirtioSocketDevices with the member function setListener. So I have: let socketConfig = VZVirtioSocketDeviceConfiguration() configuration.socketDevices = [socketConfig] ... let virtualMachine = VZVirtualMachine(configuration: configuration) virtualMachine.socketDevices[0].setSocketListener(<#T##VZVirtioSocketListener#>, forPort: <#T##UInt32#>) but Xcode throws this error Value of type 'VZSocketDevice' has no member 'setSocketListener' Is there something I am missing?
Replies
2
Boosts
0
Views
658
Activity
May ’23
Ventura does not accept my Apple ID
Hi, I use MacVM to install Ventura on a VM. With macOS Ventura beta 2 I have several problems that I would have liked to report via the "Feedback assistant" application. The problem is that the application refuses my Apple ID and display the message "An error occurred during authentication." To verify my Apple ID I logged into my developer account via Safari. I was able to do it with no problem.
Replies
9
Boosts
1
Views
4.6k
Activity
May ’23
Can't enable com.apple.vm.networking entitlement
Host: Mac Ventura 13.3/m1 Xcode:14.3 My request for access to the com.apple.vm.networking entitlement has been approved. In Xcode I have also enabled the ability to automatically manage signing. Then i followed the steps in the link, focusing on new process part (https://developer.apple.com/forums/thread/663271) I encountered some problems when I was trying to enable "com.apple.vm.networking" Adopt an Explicit App ID I already have an explicit App ID for a macOS target. Configure Your App ID My App ID has the VM Networking option checked. Enable the Entitlement (in the https://developer.apple.com/documentation/virtualization/running_macos_in_a_virtual_machine_on_apple_silicon_macs to download sample code) In the sample code macOSVirtualMachineSampleApp.entitlements and InstallationTool.entitlements these two file, I have added the "com.apple.vm.net working", and set the value to YES, but for my build target(InstallationTool-Swift), there is no Personal VPN capability here, so I did not add this capability to update profile, but when I build my target, the terminal always appears the following error. This error caused my virtual machine to not start at all: Message from debugger: no such process. Program ended with exit code: -1 I searched the Internet for this error which may have been caused by my developer account authentication failure, but i'm not sure. Please let me know where I went wrong. Now it seems that "com.apple.vm.networking" does not take effect or authorization is not successful. I also don't know whether there is something wrong with my configuration. Anyway, I hope you can give me some advice.
Replies
2
Boosts
0
Views
1.8k
Activity
May ’23
Cannot start more than 2 macOS VM instances (macOS 13.3, M1 Ultra 128GB)
I am not able to power on more than 2 macOS VM on my host Mac Studio with M1 Ultra and 128 GB RAM. I have only 32 GB RAM allocated to each VM. What is causing this issue and is there any workaround to run more VMs? Is this an apple enforced restriction? If so is there any documentation regarding this?
Replies
1
Boosts
1
Views
1.2k
Activity
May ’23
No error handler for XPC error: Connection invalid
I am on Ventura 13.3.1 with the M2 and I was trying to set up a Linux VM, following the steps on your website, but after I chose the ISO the following Error in Xcode appeared: GUILinuxVirtualMachineSampleApp[5863:111794] [client] No error handler for XPC error: Connection invalid . There was already a question about the No error handler on this forum, but that still didn't help me fix my Problem. So now my question is how do I fix it, because I have almost no good idea where to start. I can give more informations if needed. Big thanks and regards in advance :). Sincerely, Bieber
Replies
1
Boosts
0
Views
1.7k
Activity
Apr ’23
Can we add our own devices when using Virtualization.Framework
Hi, I wonder can we add our own devices when using Virtualization.Framework? i mean the devices that not comes with VF. Thanks.
Replies
3
Boosts
0
Views
745
Activity
Mar ’23
Apple Virtualization path forward with ARRM
What is the recommended path forward that Apple is recommending for old Intel Mac users? what are they expecting users to switch to for supporting virtualization? Intel/VMWare solutions seem to have reached the end of the road probably and what is the path forward for automated hyper visor virtualization solution on top of Mac Hardware?
Replies
1
Boosts
0
Views
902
Activity
Mar ’23
RunningGUILinuxInAVirtualMachineOnAMac
Hi, I ran the demo on Mac M1. It worked fine when i launch it first. But an error will occur since the second start, and the error shows "EFI Boot Options returned. Exiting VM" And we can see the tip "Guest did stop virtual machine."on the terminal. How to fix it? Regards.
Replies
1
Boosts
0
Views
731
Activity
Mar ’23
Is Virtualizing an Intel Mac Supported on Apple Silicon Via the Virtualization Framework?
I wasn't able to find an answer to this question via search but I was wondering if it is possible to virtualize an Intel Mac using the Virtualization framework on macOS? I have an M1 MacBook Pro and I want to virtualize macOS as if it is running on a Mac with an Intel processor.
Replies
2
Boosts
1
Views
1.2k
Activity
Feb ’23
Running built macOS app in 13.3 beta VM on M1?
I managed to get a macOS 13.3 beta install running in Parallels on my M1 VM, but it was really hard to get my app (built on my 13.2.1 M1 native macOS) installed on it, because so many features are unsupported in the VM (e.g. I can't drop files onto it like I can with other OSes, or on Intel; I can't log in with my Apple ID because Apple doesn't allow that, etc.). I finally copied it over using File Sharing from the VM, but the virtual OS won't launch it. It throws up a vague alert saying "The application can’t be opened." If I try to launch it from the command line, I get The application cannot be opened for an unexpected reason, error=Error Domain=RBSRequestErrorDomain Code=5 "Launch failed." UserInfo={NSLocalizedFailureReason=Launch failed., NSUnderlyingError=0x600000f2da10 {Error Domain=NSPOSIXErrorDomain Code=153 "Unknown error: 153" UserInfo={NSLocalizedDescription=Launchd job spawn failed}}} I assume it's some kind of code signing/gatekeeper issue, but I don't really know. I also tried this using the Apple virtualization framework and sample virtual machine tools (neat that those exist). I'm pretty sure this is exactly what Parallels is using internally, btw. It lacks a LOT. Is there any way to make running macOS betas in a VM a viable way of testing?
Replies
4
Boosts
1
Views
1.6k
Activity
Feb ’23
Folder sharing with VZVirtioFileSystemDeviceConfiguration Not Working (Linux Guest)?
I'm trying to share a directory on my Mac with a virtual machine I created using the Virtualization framework. The virtual machine is running Fedora. I configure the share like this:  NSError *error = nil; if ([VZVirtioFileSystemDeviceConfiguration validateTag:tag error:&error]) { //Tag validates...   VZSharedDirectory *sharedDirectiory = [[VZSharedDirectory alloc]initWithURL:theURL readOnly:NO];    VZSingleDirectoryShare *singleDirectoryShare = [[VZSingleDirectoryShare alloc]initWithDirectory:sharedDirectiory]; VZVirtioFileSystemDeviceConfiguration *shareConfig = [[VZVirtioFileSystemDeviceConfiguration alloc]initWithTag:tag];  shareConfig.share = singleDirectoryShare;  virtualMachineConfiguration.directorySharingDevices = @[shareConfig]; } The virtual machine starts up without any errors but the shared directory is nowhere to be found. Anyone know where am I'm going wrong? Thanks in advance.
Replies
1
Boosts
1
Views
797
Activity
Feb ’23
Running macOS in a Virtual Machine
https://developer.apple.com/documentation/virtualization/running_macos_in_a_virtual_machine_on_apple_silicon_macs I want to know whether I can launch the virtual machine using terminal. If so, what are the commands to do so? Does it require Xcode or Xcode Command Line Tools to be installed beforehand?
Replies
4
Boosts
0
Views
1.4k
Activity
Jan ’23
Check if process is running under Rosetta 2 under Linux?
i.e. basically the same question as here: https://developer.apple.com/forums/thread/653009 (https://developer.apple.com/documentation/apple-silicon/about-the-rosetta-translation-environment#Determine-Whether-Your-App-Is-Running-as-a-Translated-Binary) is there any way to find this thing out under linux? i.e. the sysctl method of course does not work.
Replies
1
Boosts
1
Views
853
Activity
Jan ’23
Is it possible to use the Swift Virtualization Framework on an iPad or iPhone?
Given that the new iPads have M1 chips, would it be possible to use the virtualization framework on the on an iPad/iPhone? Though it is not currently listed as a possibility in the documentation, is it possible to modify any configuration settings to make it work in a mobile environment? I would like to run a virtual machine on an iPad/iOS to run python applications.
Replies
3
Boosts
0
Views
1.9k
Activity
Dec ’22
Problem with starting Gentoo Linux in Virtualization
Im playing a bit with Virtualization framework. I have problem starting Gentoo Linux on x86_64 machine. It shows EFI boot device selection screen, and after that black screen with just carriage (not blinking). Not sure how to check what is going on. I tried with different settings and devices. I think probably something is missing from Gentoo installer iso, that I need to add to the kernel? How would I learn what is missing?
Replies
1
Boosts
0
Views
949
Activity
Dec ’22