Show HN: Vmctl/Vmcli – Easily Run Linux VMs on M1 Macs
github.com
github.com
Virtualization.framework provides 99% of the building blocks for running a Linux VM on a Mac, but there’s no off-the-shelf CLI for running a VM.
Inspired by https://github.com/evansm7/vftool, I wrote another CLI (vmcli) with some more features (better termios handling / escape sequence detection) in Swift, and build a script (vmctl) to daemon-ize vmcli and help manage VMs. I also made a script for provisioning a Ubuntu VM, so you can run a Ubuntu VM from scratch in minutes.
FYI - for an Intel Mac at least, the Ubuntu script needed a little manual tweaking, but the script was more than enough to get a VM working. Thanks!
In order to do these, I loaded the image in initramfs (basically started the VM w/o specifying root=/dev/vda as the command line argument). Then I mounted /dev/vda and chroot'd to it. Then I could change the root password to something that I knew, and setup the keys / config.
So, instead of tweaking the setup script, I ended up making the changes manually, but it should be scriptable.
I also was able to use the Ubuntu kernel/initrd to load a Debian 10 image as well. The default Debian 10 cloud image doesn't include the necessary kernel modules (virtio_console might be the only one necessary to add).
I've spent a few days testing out this and the linked vftool (https://github.com/evansm7/vftool) to try to get a Debian VM. It's not an easy thing, but it did eventually work. I ended up corrupting the disk image though, so that wasn't fun.
In order to do this on my Mac w/o needing a Linux machine, I installed ext4fuse so that I could mount raw disk images and mount partitions. I followed instructions from this GH issue, which was a great help.
I am personally more interested in tools that are based on Hypervisor.framework (which as I understand offers lower-level support for virtualization). Anyone knows what is the current state of Qemu support for M1 (last time I heard there were some out-of-tree patches)?
Oh how I long for the days when the most controversial thing about Mac OS X was that it included some, gasp, GNU tools.
It's not 1997 anymore. Security needs have changed over time.
With modern systems, running unknown code is vastly riskier than it was 20 years ago.
There have always been unspoken dividing lines between software based on reputation. Systems software. Utilities. Trusted apps. Speculative apps from less well know authors. Web Browsers that run the most dangerous code of all: webpages.
Sliding down the loss-of-permissions slope seems to mean that everything is untrusted these days and nothing counts as part of the club anymore, unless it’s shipped by the vendor.
What made Mac OS X so wonderful was that the vendor seemed humble. They shipped their glitter but it was on top of an open system. Third parties were kept at arms length if they were apps but underneath — if you knew what you were doing enough to know there was an underneath — the choices were yours to make.
Those choices were taken away. I use Linux now.
Ended using Parallels Desktop Lite which to my understanding is a GUI to VF. Used to be free for Linux VMs then they’ve changed to yearly subscriptions. And they charge premium for a year of their glorified virt-manager.
To make things worse their 1 year subscription is blocking me from changing countries on app store. I hate that company to guts now.
No, Parallels has its own hypervisor as a kernel module (mainly used pre-Big Sur) and can use Hypervisor Framework (mainly used with Big Sur). It also emulates a lot of hardware.
Virtualization Framework only supports booting Linux VMs with minimal hardware emulation at the moment. It is only available on Big Sur.
Hopefully QEMU 6.0 will include ARM support for the low-level Hypervisor.framework and you should be able to run both Linux and Windows with it.
Edit: I don't see the option to list running VMs though. I was hoping to check that powering off the VM worked. The inability to ping the VM tells me it is off, but if I didn't have the IP, I don't know how I would check this.
Sorry.. that was HVK. VK is newer
Has anyone tried running this on an intel Mac?
Any way to build it without installing xcode, just with xcode command line tools?