UTM icon indicating copy to clipboard operation
UTM copied to clipboard

utmctl list gives error: OSStatus error -1743

Open muzzah opened this issue 1 year ago • 9 comments

Describe the issue
This has been reported in a closed issue so Im creating a new ticket for this as I think its an important fix thats needed.

When using utmctl over ssh, the list command returns an error. This seems to be a gap in capability as I cannot now remotely manage the VMs.

#5001 Is the original issue where this was reported.

[9:41:21] universe:bin $ sudo utmctl list
Error from event: The operation couldn’t be completed. (OSStatus error -600.)

Any known workaround would be appreciated since I am remote and cannot physically access my Mac Studio.

Configuration

  • UTM Version: 4.2.5
  • macOS Version: 13.4
  • Mac Chip (Intel, M1, ...): M1

muzzah avatar Jun 08 '23 07:06 muzzah

As a side note, I looked into the config.plist under the ~Library/Containers/com.utmapp.UTM/Data/Documents/[VM NAME] and even if I use the ID or Name of the VM with utmctl it still fails.

I used the key located under UUID below, if this is not correct, can you advise which UUID I should be using? Why does it not work with the name field?

<dict>
		<key>Icon</key>
		<string>linux</string>
		<key>IconCustom</key>
		<false/>
		<key>Name</key>
		<string>Dev Server</string>
		<key>UUID</key>
		<string>8EB11628-544C-44BF-9EDE-4A65A616BEE2</string>
	</dict>

muzzah avatar Jun 08 '23 13:06 muzzah

I have the same problem, I'm not able to manipulate VMs by using utmctl from an SSH session, even if I'm logged in to GUI in another session.

utmctl from a Terminal app from GUI works fine.

antekone avatar Jun 26 '23 10:06 antekone

@osy hey! First of all, very thank you for your product! Could you help to answer here? This issue is very critical regarding the usage of UTM VMs in clouds and etc.

matzuk avatar Jul 27 '23 08:07 matzuk

This is unfortunately a limitation of how apple scripting bridge works. You must have the GUI launched or launchable in an interactive instance. I don’t think it works with SSH.

osy avatar Jul 27 '23 08:07 osy

Probably UTMCtl.eventDidFail could print a more helpful error message in the case of errAEEventNotPermitted. Not sure how easy it is to get the numeric code from the Error object (I haven't written any Swift code)

mitchblank avatar Jul 27 '23 17:07 mitchblank

This is unfortunately a limitation of how apple scripting bridge works. You must have the GUI launched or launchable in an interactive instance. I don’t think it works with SSH.

This makes sense, thanks for the explanation. Is there no way to work around this? For example, by requiring the same user to be logged-in and having the UTM app running?

I was really hoping that our company could use UTM for Mac VMs, but unfortunately as we use Ansible for VM deployments (which runs over SSH), this limitation is a dealbreaker for us. However, our Ansible playbooks use osascript in other places (for example, osascript -e 'tell application "System Events" to keystroke RETURN to dismiss some system dialogs), so it seems like there should theoretically be a way to get this working. :thinking:

nre-ableton avatar Apr 15 '24 14:04 nre-ableton

I am open to suggestions. Not an expect at Apple script APIs so maybe there's some hidden option I'm not aware of.

osy avatar Apr 15 '24 15:04 osy

I am open to suggestions. Not an expect at Apple script APIs so maybe there's some hidden option I'm not aware of.

Sadly nor am I, but I'm willing to do a bit of research on the topic. I assume that "rewriting the CLI in another language" is not an acceptable solution? :sweat_smile:

On that note, why was AppleScript used for the CLI, just out of curiosity?

nre-ableton avatar Apr 15 '24 15:04 nre-ableton

The CLI should be done in the same manner as it is done in https://github.com/cirruslabs/tart. I mean, the CLI is just a tiny wrapper over Virtualization.Framework not over GUI.

matzuk avatar Apr 26 '24 05:04 matzuk