News for hackers. Stuff that matters.
Re:Show HN: Vmctl/Vmcli – Easily Run Linux VMs on M1 Macs by gyf304 on Thursday January 14, 2021 @10:27PM (#25786646)
I recently got myself a M1 Mac and I want to run Linux on it. By reading the docker M1 tech preview release (https://www.docker.com/blog/download-and-try-the-tech-previe...), I was made aware of the existence of Virtualization.framework on recent macOS releases.

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.

Re:Show HN: Vmctl/Vmcli – Easily Run Linux VMs on M1 Macs by pabs3 on Friday January 15, 2021 @02:07AM (#25787896)
Re:Show HN: Vmctl/Vmcli – Easily Run Linux VMs on M1 Macs by cbhl on Friday January 15, 2021 @04:30AM (#25788762)
Asahi is for running Linux on M1 bare metal, no? Also super early stage, IIRC.
Re:Show HN: Vmctl/Vmcli – Easily Run Linux VMs on M1 Macs by pabs3 on Friday January 15, 2021 @07:47AM (#25790305)
Right.
Re:Show HN: Vmctl/Vmcli – Easily Run Linux VMs on M1 Macs by aaomidi on Friday January 15, 2021 @01:26AM (#25787664)
Would be super nice if you get this on homebrew
Re:Show HN: Vmctl/Vmcli – Easily Run Linux VMs on M1 Macs by mbreese on Friday January 15, 2021 @04:56AM (#25788943)
>I also made a script for provisioning a Ubuntu VM

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!

Re:Show HN: Vmctl/Vmcli – Easily Run Linux VMs on M1 Macs by pdimitar on Friday January 15, 2021 @05:00AM (#25788976)
Can you share what needed tweaking?
Re:Show HN: Vmctl/Vmcli – Easily Run Linux VMs on M1 Macs by mbreese on Friday January 15, 2021 @07:46AM (#25790291)
I needed to add a persistent network configuration (which I didn't really figure out -- I was okay with starting an interface manually. I also had to re-generate the SSH host keys for some reason.

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.

https://github.com/evansm7/vftool/issues/2

Re:Show HN: Vmctl/Vmcli – Easily Run Linux VMs on M1 Macs by mjard on Thursday January 14, 2021 @11:12PM (#25786912)
That’s really cool, nice work!