Virtualisation on M1
With the arrivial of the 2021 MacBook Pro, I have been testing client-side virtualisation on Apple Silicon.
I use virtualisation frequently for testing and to run specialist workloads. Historically, these virtual machines leveraged the x86-64 instruction set, which is native to Intel and AMD processors. However, with the shift to Apple Silicon, the AArch64 (ARM64) instruction set is required to achieve native/optimal performance.
The AArch64 ecosystem is less mature than x86-64 for “desktop” computing, reducing the number of compatible guest operating systems.
Thankfully, the main bases are covered, including Fedora, Ubuntu (Debian-based) and Arch Linux, as well as Microsoft Windows 10/11.
- Ubuntu Server (AArch64)
- Fedora Workstation (AArch64)
- Arch Linux (AArch64)
- Microsoft Windows 10 Insider Preview for ARM
- Microsoft Windows 11 Insider Preview for ARM
On a Linux or Windows host, I use VMware Workstation for client-side virtualisation, mainly because I have years of experience working with VMware products (e.g. ESXi, etc.).
However, VMware is a little behind with their Apple Silicon implementation, therefore I have selected UTM, which is free and open-source software, but also offered via the Mac App Store (£8.99) if you would like to support the project.
Similar to VMware Workstation (and Parallels), UTM allows you to securely virtualise and emulate guest operating systems on your Mac.
What makes UTM unique is that it employs the Apple Hypervisor virtualization framework to run AArch64 operating systems on Apple Silicon at near-native speeds, as well as lower performance emulation for x86/x64 operating systems.
Behind the scenes, UTM leverages QEMU, which is a mature, free and open-source emulation software that is actively maintained by a passionate community. UTM takes the best parts of QEMU, providing a user-friendly GUI for simple configuration and maintenance.
This architecture makes UTM very versatile, perfect for developers that what to emulate different physical architecture, such as ARM32, MIPS, PPC, and RISC-V.
The only watch-out relates to GPU hardware acceleration, which is not currently supported across virtualisation or emulation. Therefore, do not expect to use UTM for running graphics-intensive software or playing modern games.
Linux Virtual Machine Installation
The following screenshots highlight the installation process for Linux (Ubuntu Server), including the setup of a Desktop Environment (GUI).
Launch UTM and select to create a new Virtual Machine. Provide some basic information (metadata) about the virtual machine, including the name, style and icon.
Under the “System” tab, select the “ARM64 (AArch64)” architecture and allocated the desired amount of memory. For a local, single-user server I normally allocate 8GB (8192MB).
Select “Show Advanced Settings” and specify the desired number of CPU cores. I found that leaving this setting “blank” resulted in a boot error.
Under the “Drives” tab, create two drives. The first will serve as the system drive (NVMe), while the second is used for the installation media (ISO). The allocated drive space is not provisioned upfront, therefore it is safe to specify a reasonable drive size (e.g. 60GB).
Once configured, the virtual machine will be accessible from the UTM Library. At which point. select the CD/DVD drive and attach the desired installation media (ISO).
Start the virtual machine. If everything is configured correctly, you should be presented with the classic Linux GNU GRUB menu, allowing you to select “Ubuntu Server”.
This will launch the Ubuntu Server installation wizard. Use the “Cursor Keys” to navigate, “Space” to check options and “Enter” to select.
The majority of the options can be left as default. However, a few require manual intervention. For example, the profile setup.
You may also want to specify any required features (e.g. Docker) as part of the installation, however, these features can also be added later.
Once complete, the wizard will prompt you to reboot. Instead, close the virtual machine and eject the installation media (ISO).
Start the virtual machine and you will be prompted to log in with the previously defined profile information.
As this is a server product, Ubuntu Server does not include a Desktop Environment (GUI). This is perfectly fine for most server workflows, however, if you would like the Ubuntu GNOME Desktop Environment, run the following commands:
sudo apt-get update
sudo apt-get install tasksel
sudo tasksel install ubuntu-desktop
These commands will update the package information from configured sources and install the Ubuntu GNOME Desktop Environment. The process will take several minutes, but once complete, the subsequent reboot will display the standard Ubuntu GNOME Desktop Environment login screen.
If the installation process fails, simply re-run the ‘install ubuntu-desktop’ command, which should pick up at the point of the failure.
Finally, it is worth installing the SPICE Guest Tools and Drivers, which allows for advanced display setting to be enabled, such as “Retina Mode”, etc.
sudo apt-get install spice-vdagent spice-webdavd
That’s it! Ubuntu Server, with the Ubuntu GNOME Desktop Environment, is now ready for use.