UTM icon indicating copy to clipboard operation
UTM copied to clipboard

Add button for ACPI shutdown

Open fulldecent opened this issue 3 years ago • 8 comments
trafficstars

Background

There's three ways to turn off a physical computer:

  1. Login, ask the operating system to shutdown (may require admin permission)
  2. Yank the power cord.
  3. Press a physical button on the computer to indicate you want to shutdown.

Abstract

UTM supports the first two. I hope we can support 3., which is called ACPI shutdown.

Proposal

In the GUI this can be done by changing what happens when you click the shut down button.

Currently it asks if you are sure you want to yank the power cord "CONFIRMATION: this may corrupt the VM and any unsaved changes will be lost. To quit safely, shut down from the guest."

But this could be changed instead to show a dialog box with options:

  1. Soft shutdown (ACPI, requires OS support)
  2. Hard shutdown (immediate stop, may corrupt VM)
  3. Cancel

Note you may also be able to shut down inside the guest operating system.

fulldecent avatar May 11 '22 18:05 fulldecent

alternative dialog:

How would you like to shutdown the VM?

  • ACPI shutdown
  • Hard shutdown
  • Cancel

(hard shutdown button is red to indicate a slightly dangerous action, both shutdown action would prompt for confirmation and hard shutdown may include info that vm might corrupt, may also apply to restarts if that exists)

JacksonChen666 avatar May 12 '22 20:05 JacksonChen666

It is my opinion that such a feature will lead to "complexity creep". Most (90%) of people won't know what "ACPI shutdown" means or how it's different from other kinds of shutdown. Most people also won't need such an option. Maximum flexibility will come at a cost of a more difficult to understand UX. In most cases, you can trigger an ACPI shutdown directly from the guest.

osy avatar May 12 '22 23:05 osy

In order to shutdown from the guest you need to login. And then you need the root password.

It's a lot of steps. So maybe other people also like the ACPI option.

ACPI and a way to type CTRL-ALT-DELETE are basic things nearly all VM GUIs have.

fulldecent avatar May 12 '22 23:05 fulldecent

Agree we need a “safe shutdown” button. See https://github.com/utmapp/UTM/issues/3859#issuecomment-1114787051, closes 3859

conath avatar May 13 '22 07:05 conath

...Most (90%) of people won't know what "ACPI shutdown" means or how it's different from other kinds of shutdown...

To be honest UTM is already pretty "complex" as such pieces of specialized software are. I tend to believe most users with the need to emulate/virtualize are more tech-savvy to begin with.

peterneutron avatar May 17 '22 12:05 peterneutron

Agree we need a “safe shutdown” button. See #3859 (comment), closes 3859

+1

alejandroacostaalamo avatar Jun 30 '22 11:06 alejandroacostaalamo

Agree we need a “safe shutdown” button. See #3859 (comment), closes 3859

+1

mbbee avatar Jul 01 '22 19:07 mbbee

+1

anonymousaga avatar Sep 03 '22 16:09 anonymousaga

Just curious:

  1. Will this require spice guest tools or any acpi-compliant os?
  2. When approximately will 4.1 be released with this feature (beta and stable)?

Thanks in advance for adding this feature!

anonymousaga avatar Nov 26 '22 14:11 anonymousaga

this feature requires ACPI functioning systems because it uses ACPI stuff

JacksonChen666 avatar Nov 26 '22 14:11 JacksonChen666

The way QEMU implemented it is more generic. Any hw can hook on to that call. In practice I think it’s probably most useful in ACPI systems.

osy avatar Nov 26 '22 16:11 osy

+1

+1

fgclue avatar Mar 15 '23 18:03 fgclue

@osy sometimes I find myself clicking the power button accidentally instead of holding it down. I know this is petty and thank you for configuring the ACPI, but do you think it would be possible in settings to add a toggle to "show advanced shutdown options by default"? Many thanks in advance, and I love your software!

anonymousaga avatar Mar 15 '23 23:03 anonymousaga

I had no idea that holding down the power button showed more options until reading this.

It would be nice if the defaults were the safest for the user: closing the window could save a snapshot that is restored next time, and hitting the power button would attempt an ACPI shutdown, after some timeout a dialogue could ask if you want to force shutdown.

stuaxo avatar Sep 01 '23 11:09 stuaxo

I didn't either, maybe either what anonymousaga suggests or let people set the default action.

mbk5631 avatar Oct 01 '23 11:10 mbk5631

For me having a setting to define default close action, as one can with VirtualBox, will be the only way to gracefully handle host shutdowns and reboots.

Without that I'm left with complex hooks into the host shutdown process to run an SSH shutdown command on all guests. It's a mess.

A bare minimum is a pop up on any close request asking what type of shutdown is required, Request Shutdown, Force, or Cancel.

Mister-A avatar Oct 02 '23 11:10 Mister-A

I'd love to have a setting that would either send ACPI shutdown for all running guests on host user log out or shutdown/reboot. The second option could be to save a snapshot. This would block UTM quitting until all guests gracefully exit.

wpiekutowski avatar Nov 03 '23 11:11 wpiekutowski

I believe you'll find the newest build does now save state of guest VMs that are capable of being suspended when the host application is requested to quit.

Automatically save state when you close a VM This will only work on VMs that support save states. If your VM does not support it, you will get an error message with an explanation.

https://docs.getutm.app/updates/v4.4/

Mister-A avatar Nov 03 '23 11:11 Mister-A

Great stuff, I'll wait until the GL_ARB_clear_texture bug is resolved before trying this, but it looks good.

stuaxo avatar Nov 03 '23 17:11 stuaxo