Create macOS or Linux virtual machines

RSS for tag

Discuss the WWDC22 Session Create macOS or Linux virtual machines

Posts under wwdc2022-10002 tag

16 Posts
Sort by:
Post not yet marked as solved
6 Replies
2.0k Views
My device is MacBook Pro 13-inch, M1, 2020 Use source code provided by article https://developer.apple.com/documentation/virtualization/running_gui_linux_in_a_virtual_machine_on_a_mac When installing Debian, Fedora or Ubuntu, installation process can stuck at any point and cause the installation failed. Even if it is lucky enough to pass the installation phase, stuck could still happen at any time when the virtual machine is started. It seems that there is some low level error that cause the Linux kernel panic, while during this process error seems to be accumulated--it starts with some user level application in Linux starts to behave weirdly, such as sudo does not authenticate a valid user, apt can not run properly, then Linux kernel panic. Sometimes it behaves like the VM get stuck where it is not sure what happened inside it. I can't provide more detail as it happens randomly and the phenomenon differs each time. While generally it appears to be an accumulated error and eventually the VM get stuck.
Posted
by mark07.
Last updated
.
Post not yet marked as solved
3 Replies
479 Views
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?
Posted
by joeljohnk.
Last updated
.
Post not yet marked as solved
7 Replies
1.9k Views
The new Virtualization framework (and sample code!) are great. It's a lot of fun to run the sample code and quickly fire up multiple VMs of macOS running as a guest. However, the inability to authenticate with any iCloud services is a significant roadblock. Xcode, for example, is not allowing me to authenticate my developer account. Are there any plans to resolve this issue so that iCloud accounts can be authenticated from within a VM?
Posted
by kennyc.
Last updated
.
Post marked as solved
1 Replies
831 Views
Im learning about Virtualization framework from Apple, and Im currently trying to create an Arch Linux environment to run on top of it. Im still a bit confused about few concepts regarding how this works, so I gathered them into 3 sections. Kernel and Initial Ram Disk (initrd) usage. From what I learned to start Virtual Machine, I need to have extracted linuz and initrdfiles, and use them to create a bootloader. This is kind of different approach from other VMsolutions, but I think I get why it is. But to make sure few questions: Since Im loading the kernel and initramdisk at this step, I can extract exact files from my linux distribution disk image, and remove them from linux /boot folder right? And going forward since this is a bootloader, I don’t really need to install Grub to run it, right? Kernel and inited capabilities and format. Until now I was only able to run a single kernel and initrd - some Ubuntu cloud 20.04images downloaded from the internet. I tried also other versions of Ubuntu, and my own Arch build, but it usually ends with either some error or sometimes virtualMachine.start()returns success but after that nothing is happening. I think I need either to compile some required features into the kernel (but have no idea which) or have these files with some specific format. I noticed that when using file command on initrd I get different information about these files. For example, the one from Ubuntu that works for me is: LZ4 compressed data (v0.1-v0.9). The other one I tried, but didn’t work was Zstandard compressed data (v0.8+), Dictionary ID: None. Does that play a role here? If so how to prepare initrd in correct format? Virtual disk format. After booting into the environment I would like to perform Arch Linux installation on separate virtual disk, and later switch to use this disk as the main one. How should I prepare .img empty file to use? From Disk utility Im only able to prepare .dmg format. Can I use some other formats as well? And later how should I partition this disk? I was planning to create GTP partition table with just a single Linux ext4 partition. On other Virtual Machine I was also creating a 1MB partition for Grub, but I think this can be skipped here. Is that correct? Do I need initrd? I think that I will need to compile my own kernel to achieve nicely working environment. And this might be the good solution for me. If that's the case do I really need initrd at all? Would it be possible to create fully prepared kernel that boots without it? If so what features do I need to use in kernel config?
Posted Last updated
.
Post marked as solved
1 Replies
714 Views
Apple Docs describe how to create a Swift executable to run Linux on an Intel based Mac, but the docs don't include the import statements required for the code to compile. I've determined I need to import both Cocoa and Virtualization but the following code from the final section Instantiate and Start the Virtual Machine is still generating an error: let virtualMachine = VZVirtualMachine(configuration: configuration) let delegate = Delegate() // Cannot find 'Delegate' in scope virtualMachine.delegate = delegate How do I resolve the Delegate() constructor?
Posted
by harr1424.
Last updated
.
Post not yet marked as solved
3 Replies
1.3k Views
I'd like to be able to run Linux in a virtual environment on my M1 macOS Monterey system that is managed by my IT department. Can I use the Virtualization Framework Virtualization Framework to do the installation without any admin privileges? Are there other virtualization products (eg, Parallels, VMware, VirtualBox) that are usable without admin privileges? The side-by-side comparison that I found (at https://www.pcmag.com/picks/the-best-virtualization-software) doesn't have any indication either way. In asking about these 3rd-party ones, I'm not looking for a recommendation per se, but just a yay/nay on being able to work within an unprivileged account.
Posted
by rsindlin.
Last updated
.
Post not yet marked as solved
2 Replies
674 Views
Hi, I run the RunningMacOSInAVirtualMachineOnAppleSiliconMacs to build the VM and I get the error ".swift:119: Fatal error: Internal Virtualization error. Installation failed." when it go to install step. I am using M1 Mac Studios and MacOS Monterey 12.4 Thanks, Gavin
Posted Last updated
.
Post not yet marked as solved
1 Replies
918 Views
Hi, I am trying the GUILinuxVirtualMachineSampleApp.xcodeproj to build the Linux VM to also take advantage of the Rosetta in there. However, I get some errors compiling the sample app. Cannot find 'VZGenericMachineIdentifier' in scope I have the Macbook Pro M1 laptop with MacOS Monterey 12.4 Thanks, Saeed
Posted
by hashe038.
Last updated
.
Post not yet marked as solved
10 Replies
1.5k Views
I have been building virtual machines and running macOS 12 & 13 on them for over a week now using the "macOSVirtualMachineSampleApp" referenced in wwdc2022-10002 session "Create macOS or Linux virtual machines", but not without some initial issues and only after considerable sleuthing. I need someone to explain what's going on. I followed the instruction given at: "https://developer.apple.com/documentation/virtualization/running_macos_in_a_virtual_machine_on_apple_silicon_macs" I ran "InstallationTool-Swift" and it created "VM.bundle" in my home directory as per the documentation. However... Running "macOSVirtualMachineSampleApp-Swift" the VM fails to load and the app returns :"Thread 1: Fatal error: Missing Virtual Machine Bundle at /Users/myUserName/Library/Containers/com.example.apple-samplecode.macOSVirtualMachineSampleAppBA8MNGZ7WS.macOSVirtualMachineSampleApp/Data/VM.bundle/. Run InstallationTool first to create it." The app seems to have created a series of nested folders in myUserName/Library/Containers/ and is looking for "VM.bundle" there! Only after I copy "VM.bundle" to the location above will the VM load and run without issue. "Path.swift" sets vmBundlePath = NSHomeDirectory() + "/VM.bundle/" and one would think "macOSVirtualMachineSampleApp" would look for it there. Why isn't it? What am I missing? Where in the code in "vmBundlePath" is being changed if that is in fact what's happening? I want to teak the code so that when the installer creates "VM.bundle", the app runs it from there. NOTE: "vmBundlePath" cannot be set to the location where "macOSVirtualMachineSampleApp" currently wants to find it because only after that app runs does the path get created but the installer needs that path to create the bundle.
Posted
by Buzz.
Last updated
.
Post marked as solved
1 Replies
702 Views
When SandBox is turned on, /Library/Apple/usr/libexec/oah/RosettaLinux is blocked by SandBox which cause the Rosetta file sharing to be failed. A possible solution is to manually ask user to select /Library/Apple/usr/libexec/oah/RosettaLinux in the file importer so that the app is allowed to access the corresponding path.
Posted
by mark07.
Last updated
.
Post not yet marked as solved
1 Replies
832 Views
Hi, i'm trying to follow the steps from the Virtualization WWDC22 session. The sample app provided works ok "as is", but if I use the same APIs in my own app (i.e. a project I started from scratch), I get errors such as Internal Virtualization error. Installation service returned an unexpected error. when downloading the "best supported" image via VZMacOSRestoreImage.fetchLatestSupportedWithCompletionHandler, and Internal Virtualization error. Unable to connect to installation service. if I try and install one I downloaded myself. I did add the <key>com.apple.security.virtualization</key> <true/> entitlement to my own app and (since this is arm), it is codesigned (with -) . But could it be that there is some other application-level flag or setup needed to enable virtualization use? Since I'm calling the exact same APIs, and neither seem to depend on much prior setup I could get wrong, it seems weird that they work in the sample app but not when called from my own app... Ideas? thanx!
Posted
by dwarfland.
Last updated
.
Post not yet marked as solved
1 Replies
1k Views
I've seen this video - https://developer.apple.com/videos/play/wwdc2022/10002/ It seems to me that using the Virtualization framework, I can create an application similar to VirtualBox or Gnome Boxes. Is there any other use case for the Virtualization framework? If that would be the only kind of application for it, isn't one virtualization app enough? I mean, wouldn't it make more sense for Apple to release a GUI on top of the Virtualization framework, a kind of VM Manager, similar to VirtualBox? Why do developers actually need to play with such kind of code?
Posted
by Loreno.
Last updated
.