Virtualization

RSS for tag

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

Posts under Virtualization tag

60 Posts
Sort by:

Post

Replies

Boosts

Views

Activity

detecting if my process is running on a virtual macos x instance and not on my local mac machine
I m trying to identify if my launched process is running on a local mac machine(desktop/laptop) or a virtual macOS X instance like AWS EC2, Azure, MacStadium etc. I have followed this link which searched for its limited providers in the output, but I m not bound to any limited providers and looking for a general solution which is applicable to all the providers. Is there some hardware/network/virtualization-related information that can be used to identify if the process is launched on a virtual MacOS instance? OR is there some system Information that I can use to be sure that my process is running on a local machine?
3
1
885
Oct ’23
Virtual serial ports
Hello, I want to add virtual serial ports to a macOS VM (host = Sonoma, guest = Sonoma). Here is what I tried so far: option 1 I create a VZVirtioConsoleDeviceConfiguration and I add a port to it, with a VZFileHandleSerialPortAttachment connected to two pipes: let consoleDeviceConfiguration = VZVirtioConsoleDeviceConfiguration() let guestPort = VZVirtioConsolePortConfiguration() guestPort.isConsole = false guestPort.name = "myserialport" let guestToHostPipe = Pipe() let hostToGuestPipe = Pipe() guestPort.attachment = VZFileHandleSerialPortAttachment( fileHandleForReading: hostToGuestPipe.fileHandleForReading, fileHandleForWriting: guestToHostPipe.fileHandleForWriting ) consoleDeviceConfiguration.ports[0] = guestPort // config is my VZVirtualMachineConfiguration config.consoleDevices = [consoleDeviceConfiguration] Then after the VZVirtualMachine is instantiated, I get the runtime VZVirtioConsoleDevice for my device and I set my service as its delegate. In the guest system, the device is created with the expected name (/dev/cu.myserialport) When I open it (e.g. screen /dev/cu.myserialport 9600), the consoleDevice(_:,didOpen:) delegate method is called as expected. Then I start sending data to hostToGuestPipe.fileHandleForWriting, but I get nothing in my guest system. option 2 Instead of using config.consoleDevices, I add a VZVirtioConsoleDeviceSerialPortConfiguration to config.serialPorts and I use the same scheme as above with a VZFileHandleSerialPortAttachment and two pipes. It works, but: I can't find a way to rename the devices (/dev/cu.virtio, /dev/cu.virtio1, etc) I can't detect when the endpoint is opened/closed. Am I missing something?
0
0
75
4d
macOS Routing from VMs & Internet Sharing to VPN
My company uses a VPN to provide access to cloud services for development purposes. I am unable to reach these services from VMs or devices using Internet Sharing. In both cases, those instances can reach the Internet just fine. Here is what the routing table looks like for the VPN: 100.20.x.x 100.65.0.1 UGHS utun1 100.21.x.x 100.65.0.1 UGHS utun1 100.64/10 utun0 Uc utun0 100.65/16 100.65.0.1 UGSc utun1 If I add a custom pf rule, I can get the VM packets routed to the VPN: nat from 192.168.66.0/24 to 100.65.0.0/16 -> (utun1) But, inexplicably, a similar rule for 192.168.2.0/24 does nothing. Using Wireshark, I still see packets sent out the default interface, instead of being sent through utun1. Two questions: Why doesn't the routing "just work" in this case? I expected that, after the NAT rules installed by the system are applied, the packets destined for 100.64.0.0/15 would be properly routed without the need for any custom rules. What else should I try, either to gather more data or attempt to fix the routing?
1
0
116
1w
USB Device Support in Virtualization Framework in macOS Sequoia 15
I was looking through the different Core OS announcements from WWDC24 and stumbled upon documentation for USB Device support in the Virtualization Framework. However, I haven't found any mention about it or the virtualization framework from the event or otherwise. Are there any related release notes, examples or additional material besides the API documentation for the Beta OS?
2
0
170
2w
install macOS 15 as virtual machine with Virtualisation framework
Has anyone tried to install macOS 15 (24A5264n) from the downloaded restore image with the sample project RunningMacOSInAVirtualMachineOnAppleSilicon on the latest macOS 14.5? I am getting a strange error Fatal error: A software update is required to complete the installation. Installation requires a software update. System also shows this dialogue But when I click install it says that the software is not currently available from the Software Update server. I'm trying with the latest public Xcode 15.4 on an M3 Mac.
5
1
310
2w
Shared directories configuration not running on macOS virtual machine
When using the sample code included on the Running macOS in a virtual machine on Apple silicon. I am adding the following changes to the swift files: Added to 'MacOSVirtualMachineConfigurationHelper' file: static func createAutomountSingleDirectoryShareDeviceConfiguration() -> VZVirtioFileSystemDeviceConfiguration { let sharedDirectory = VZSharedDirectory(url: directoryURL, readOnly: false) let singleDirectoryShare = VZSingleDirectoryShare(directory: sharedDirectory) // Assign the automount tag to this share. macOS shares automounted directories automatically under /Volumes in the guest. let sharingConfiguration = VZVirtioFileSystemDeviceConfiguration(tag: VZVirtioFileSystemDeviceConfiguration.macOSGuestAutomountTag) sharingConfiguration.share = singleDirectoryShare return sharingConfiguration } Added to 'path' file: let directoryURL = URL(fileURLWithPath: NSHomeDirectory() + "Projects") Added to the 'AppDelegate' file: virtualMachineConfiguration.directorySharingDevices = [MacOSVirtualMachineConfigurationHelper.createAutomountSingleDirectoryShareDeviceConfiguration()] When the above is added and the sample app is run, the following error is shown: macOSVirtualMachineSampleApp/AppDelegate.swift:95: Fatal error: Virtual machine failed to start with Error Domain=VZErrorDomain Code=2 "A directory sharing device configuration is invalid." UserInfo={NSLocalizedFailure=Invalid virtual machine configuration., NSLocalizedFailureReason=A directory sharing device configuration is invalid., NSUnderlyingError=0x600000c343c0 {Error Domain=NSPOSIXErrorDomain Code=2 "No such file or directory"}} On the host device the directory that is being shared is ~/Projects and it does exist. What do I need to change to create the shared directory and have it work? Is there a sample code project for the same configuration that was shown in the demo?
2
0
387
Apr ’24
Fan Speed on Fedora Asahi Remix
Hi there, I have got a question but I don't know if this is the right place. I am using an M1 Mac mini and have installed Fedora Asahi Remix for certain developing Tasks next to MacOS. How is the fan speed controlled? Does Fedora turn on the fan when the CPU gets warm or does the hardware firmware set the fan speed? Thank you for your answers! Laurin
1
0
435
Mar ’24
Rosetta fail on shared memory in Sonoma 14.3
I use UTM.app for virtualisation. I have full virtualise "Fedora 38-aarch64" in UTM.app with rosetta enabled. After upgrading Sonoma to 14.3 it stop properly virtualised shared memory. I have this test file: #include <stdio.h> #include <sys/shm.h> #include <sys/stat.h> int main () { int segment_id; char* shared_memory; struct shmid_ds shmbuffer; int segment_size; const int shared_segment_size = 0x6400; /* Allocate a shared memory segment. */ segment_id = shmget (IPC_PRIVATE, shared_segment_size, IPC_CREAT | IPC_EXCL | S_IRUSR | S_IWUSR); /* Attach the shared memory segment. */ shared_memory = (char*) shmat (segment_id, 0, 0); printf ("shared memory attached at address %p\n", shared_memory); /* Determine the segment's size. */ shmctl (segment_id, IPC_STAT, &shmbuffer); segment_size = shmbuffer.shm_segsz; printf ("segment size: %d\n", segment_size); /* Write a string to the shared memory segment. */ sprintf (shared_memory, "Hello, world."); /* Detach the shared memory segment. */ shmdt (shared_memory); /* Reattach the shared memory segment, at a different address. */ shared_memory = (char*) shmat (segment_id, (void*) 0x5000000, 0); printf ("shared memory reattached at address %p\n", shared_memory); /* Print out the string from shared memory. */ printf ("%s\n", shared_memory); /* Detach the shared memory segment. */ shmdt (shared_memory); /* Deallocate the shared memory segment. */ shmctl (segment_id, IPC_RMID, 0); return 0; } Command to compile it is gcc -Wall a.c && ./a.out When I compile it in virtualised Fedora work properly show this: shared memory attached address segment size: shared memory reattached address Hello, world. When I compile directly on M1 mac id it die shared memory attached address segment size: shared memory reattached address Segmentation fault: I'm try it also in docker x86 in virtualised fedora and also show error In "Fedora 38-aarch64 virtualised" run x86 docker "docker run -it --platform linux/amd64 oraclelinux:7.9 bash" Install gcc in docker shell "yum install -y gcc" After compile and run it die with shared memory attached address segment size: shared memory reattached address Hello, world. assertion failed [rem_idx != ]: Unable find existing allocation shared memory segment to unmap (VMAllocationTracker.cpp remove_shared_mem) Trace/breakpoint (core dumped) How can I fix it? On previous version of Sonoma works properly. Thank you
2
1
1.4k
Feb ’24
Build signing on Sonoma virtual runner
I've tried to implement the steps suggested for configuring code signing https://docs.github.com/en/actions/deployment/deploying-xcode-applications/installing-an-apple-certificate-on-macos-runners-for-xcode-development on runners However, I could not sign my app build when I was using Virtual Runner. Is it a limitation coming from the Apple virtualization framework restriction (for signing in with Apple ID), or did I miss some configuration for Xcode? I was trying both manual and automatic signing but never succeeded (
1
0
443
Feb ’24
Any virtual machine software on M1/arm?
I used to run VirtualBox on macOS to run Windows guests for some reasons. Recently I bought a new Mac mini M1, now I have a problem - VB does not have a stable release for arm (yet). What other options do I have? BTW, I came across this doc article (https://developer.apple.com/documentation/virtualization/running_macos_in_a_virtual_machine_on_apple_silicon). I read thru it, but could not conclude if it offers the same functionalities as a full-blown VM suite; and more specifically I want to run Windows guests.
1
0
800
Feb ’24
Any plans for Bluetooth device pass thru with Apple Virtualization Framework
With Apple Virtualization Framework, we can create virtual machines and run macOS and Linux-based operating systems and pass thru USB devices like mice and keyboards. Are there any plans to be able to pass thru bluetooth or bluetooth devices to the Virtual Machine so that the VM OS could connect to bluetooth devices? Related docs: https://developer.apple.com/documentation/virtualization
1
0
354
Feb ’24
Camera usage inside Virtualization?
I'm trying to use the host camera from inside a virtual machine created using the Virtualization framework in Swift. I can't seem to figure out how to achieve this though, and unlike audio devices, keyboards, displays etc there doesn't seem to be a corresponding class and docs page for cameras or generic usb devices. Is there any way to connect a built in Apple camera to a mac virtual machine created with the Virtualization framework?
1
1
447
Jan ’24
Configuring virtual linux devices for save/restore
When I call either of VZVirtualMachineConfiguration.validateSaveRestoreSupport(..) VZVirtualMachine.saveMachineStateTo(URL) I get the error: NSLocalizedFailure=Invalid virtual machine configuration. NSLocalizedFailureReason=Unsupported graphics device in configuration For Linux there seems to be only vanilla size configuration (at least 1 scanout is required): let graphicsDevice = VZVirtioGraphicsDeviceConfiguration() graphicsDevice.scanouts = [ VZVirtioGraphicsScanoutConfiguration(widthInPixels: 1920, heightInPixels: 1080) ] I've tried valid sizes and aspect ratios. I've otherwise removed console and audio devices provoking similar errors, but I can't find an acceptable graphics configuration. I believe it should work because my code is substantially similar to the open-source tart application that supports suspend. I'm running Sonoma 14.2.1 on an M1 Studio with an HP24mh external monitor via a third-party HDMI/USB-C adapter. I see nothing in the Console (except some ...wakeups_resource.diag common to other applications). So I'm looking for help with How to get more information for this failure How to configure suspendable/resumable devices: graphics for sure, but also console, audio, keyboard, etc. Thanks! GUI Linux guest: https://developer.apple.com/documentation/virtualization/running_gui_linux_in_a_virtual_machine_on_a_mac macos guest: https://developer.apple.com/documentation/virtualization/running_macos_in_a_virtual_machine_on_apple_silicon wwdc-2022: https://developer.apple.com/videos/play/wwdc2022/10002/ wwdc-2023: https://developer.apple.com/videos/play/wwdc2023/10007/
1
0
360
Jan ’24