cirruslabs / tart

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

Failed to suspend the VM: Invalid virtual machine configuration. Unsupported console device in configuration. #803

Closed sc0rp10 closed 2 months ago

sc0rp10 commented 2 months ago

Hi, constantly getting this error when trying to suspend any VM:

$ tart clone ghcr.io/cirruslabs/macos-sonoma-vanilla:14.4.1 foobar
pulling manifest...
pulling disk (16.0 GB compressed)...
100%
pulling NVRAM...

$ tart run foobar
# in the second terminal I ran `tart suspend foobar`
Failed to suspend the VM: Invalid virtual machine configuration. Unsupported console device in configuration.

$ tart --version
2.9.0

Also I have a question: is there a way to stop VM gracefully - without failing with a CancellationError the tart run command? I'm trying to build an API-wrapper for Tart and at the moment it's impossible to distinguish where the error is and where the graceful VM stop is because both of them produce the same error. I thought that I can suspend VM and then stop it - and the tart run command will get different error, but unfortunately it doesn't work as I posted below.

edigaryev commented 2 months ago

Hi, constantly getting this error when trying to suspend any VM:

This is a limitation of Virtualization.Framework where it does not support suspending a VM with certain devices.

To disable these devices, pass the --suspendable flag to tart run.

Also I have a question: is there a way to stop VM gracefully - without failing with a CancellationError the tart run command?

Simply shut down the guest from within it, e.g. by running sudo halt command in Terminal or over SSH.

We've opted not to do clean shutdowns because otherwise there would be a GUI pop-up that is burdensome to automate (you can check this yourself by clicking Control → Request Stop in tart run GUI menu):

Screenshot 2024-04-24 at 10 59 15

In your API-wrapper you could probably distinguish the point of time where the tart stop was invoked. Before that time, tart run exits should be considered premature and an error should be reported.

edigaryev commented 2 months ago

is there a way to stop VM gracefully - without failing with a CancellationError the tart run command

Also, this should be now fixed by https://github.com/cirruslabs/tart/pull/808.

The fix is available in the latest 2.10.0 release.