cirruslabs / tart

macOS and Linux VMs on Apple Silicon to use in CI and other automations
https://tart.run
Other
3.85k stars 115 forks source link

Support Linux #62

Closed fkorotkov closed 2 years ago

fkorotkov commented 2 years ago

At the moment Tart only supports macOS VMs but Virtualization.Framework allows to run Linux VMs itself. Linux subsystem seems to even have better support for Virtio related stuff and things like #13 should work for Linux even right now.

One of the use case might be @mitchellh's NixOS setup simplification: https://github.com/mitchellh/nixos-config

jmgilman commented 2 years ago

As far as I know, the "scripted VM" space for the M1 architecture is very limited right now. UTM is the most popular open-source solution for M1, but the developer has noted that scripted interactions are not in the short-term plan. There's multipass, but for obvious reasons it's very biased towards Ubuntu.

So, if the maintainers of this project are so interested, I think there's a large gap that needs to be covered here. Tart looks promising so long as it remains open-source and committed to development workflows.

fkorotkov commented 2 years ago

@jmgilman, "scripted VM" term is new for me so I want to clarify something. If I understood you correctly you'd like to see Tart Vagrant Provider, right?

Tart is built to be interacted with via CLI and we are very open to providing necessary APIs for more tools.

We already created a Packer Plugin which can automate VM creation. You kind of scripting them with templates. For example, here is how we build our virtual machines (see files in templates folder).

ChefAustin commented 2 years ago

+1 to Tart Vagrant Provider.

fkorotkov commented 2 years ago

Sounds good. Let's leave scope of this issue to just support booting and running Linux VMs.

I've created a separate feature request in Vagrant repository about Tart provider. Please upvote and subscribe to it.

scottslowe commented 2 years ago

Big +1 for Linux support in Tart

fkorotkov commented 2 years ago

@scottslowe are you also interested in the Vagrant support or you have something different in mind? Trying to compile a list of possible workflows.

jmgilman commented 2 years ago

To clarify, I wasn't explicitly asking for Vagrant support. There are a plethora of task runners out there that can do as much or as little as needed for automation - the only pre-requisite is a useful CLI interface with sane outputs. As such, I'm only pushing for adopting Linux support so that I can engage in that rich ecosystem to further improve my development workflows and pipelines on the M1 architecture.

scottslowe commented 2 years ago

@fkorotkov Like @jmgilman, I'm also not asking specifically for Vagrant support; I'm seeking first-class Linux support in Tart (and, I suppose, in cirrus-cli).

fkorotkov commented 2 years ago

Got it. Thank you @scottslowe and @jmgilman for swifty response! Right now our thinking is to wait for the new macOS which will be available after WWDC next month and we'll see what will change in the Virtualization.Framework.

Right now there is a concerning thing like #13 which we can implement for Linux even right now since virtiofs is supported there but not in macOS Monterey. Which means in case of supporting both Linux and macOS there will be a feature disturbancy. Or alternatively we'll support only thing that work both in Linux and macOS in Tart.

ringods commented 2 years ago

+1 to Tart Vagrant Provider.

@ChefAustin I made a new ticket for this: #108

fkorotkov commented 2 years ago

Seems there are some extra Linux support just got announced at WWDC https://developer.apple.com/documentation/virtualization/running_gui_linux_in_a_virtual_machine_on_a_mac

We'll investigate and will reevaluate feasibility of supporting Linux. But so far it looks promising...

geerlingguy commented 2 years ago

Mostly a +1 for Linux support here, but partly for selfish reasons; Tart has been the nicest VM-on-Apple-Silicon experience so far, at least for automated/scripted use, so I would love to adopt Tart (instead of VirtualBox, which doesn't work at all anymore) for all my examples testing SSH-based automation on macOS for things like my Ansible for DevOps examples.

I might not be able to help as much on the Swift/code side, but I would be quite willing to help with testing, and also porting Packer image builds over to Tart (https://github.com/geerlingguy/packer-boxes).

b00ga commented 2 years ago

I'm still Intel mac at home, but at work, I'm transitioning to an M1 MBP and ordered a Mac Studio, so I'm looking for a good virtualization story on Apple Silicon mac. On x86 Mac, I use vagrant and virtualbox extensively for building and testing applications and ansible development on Linux, including maintaining OS base images for my organization, so I'm interested in both Linux support and a vagrant provider.

fkorotkov commented 2 years ago

We just release 0.22.0 version of Tart with early Linux support. Please try it out! You can either create a linux VM from scratch from an *.iso file:

# Create a bare VM
tart create --linux ubuntu

# Install Ubuntu
tart run --disk focal-desktop-arm64.iso ubuntu

# Run VM
tart run ubuntu

Or try one that we pushed to GitHub packages:

tart clone ghcr.io/cirruslabs/ubuntu:focal ubuntu
tart run ubuntu

The one that we pushed has username preconfigured as tart with tart as password as well. In contrast with macOS VMs where admin is used for both.

dan-snelson commented 2 years ago
❯ tart --version
0.22.0

❯ tart create --linux ubuntu
UnsupportedOSError()

❯ sw_vers
ProductName:    macOS
ProductVersion: 12.5.1
BuildVersion:   21G83
fkorotkov commented 2 years ago

I should note that Linux support is only available on Ventura hosts. Otherwise you'll get an exception like @dan-snelson has!

ringods commented 2 years ago

@fkorotkov out of curiosity, why do you specifically need Ventura?

fkorotkov commented 2 years ago

Apple added Linux support to their Virtualization.Framework only in Ventura unfortunately. To be more precise usable Linux support to have a UI, folder sharing and so on. Before there was some low level support that Docker was using for their Docker machine but it didn't support UI, installation from ISO, etc.

unikzforce commented 11 months ago

can you please add these into official website documentations?