Virsh - Graceful Shutdown Guest Prompt

Sending the virsh shutdown command prompts a leave confirmation in both whonix guests instead of graceful shutdown.

Disabled “ask for confirmation before leaving” in Session Settings. same problem.

Modified /etc/systemd/logind.conf to show HandlePowerKey=poweroff same problem.

where is this prompt setting being enforced and how to change it?

Generic LXQt research has yielded no other workarounds.

1 Like

Could you try please Generic Bug Reproduction?

Probably needs to be discussed/reported upstream as per:

1 Like

I have the same problem.
I am using virt-manager and when I click to shut down a virtual machine it does not shut down, because the guest machine asks for a confirmation box and it bothers me. For example, when shutting down whonix gateway I have to open the guest machine to confirm shutdown

3 Likes

I did try looking at the upstream documentation for LXQt, but after trying various settings involving /etc/systemd/logind.conf I couldn’t find a workaround.

From a Whonix perspective, are there any custom modifications that would be over-riding the default behavior of LXQt in regards to shutdown commands?

Not to my awareness, no.

If you click on the Start Menu → Preferences → Power Management → Power Keys → Power Key Action, you might be able to customize things there.

1 Like

It looks like part of labwc configuration

2 Likes

I think I have a solution. It is as @spartack said, it’s to do with labwc. So the solution lies there. The procedure is the same for both user and sysmaint.

Go to ~/.config/labwc/rc.xml (it doesn’t exist, create it). Put this into rc.xml:

<?xml version="1.0"?>
<labwc_config>
<keyboard>
    <keybind key="XF86PowerOff">
      <action name="Execute" command="lxqt-leave --shutdown" />
    </keybind>
</keyboard>
</labwc_config>

Just make sure the LXQt session leave confirmation is turned off and the shutdown signal from virsh shutdown should be received and acted on correctly. It’s been a while since I implemented, so things might or might not need some tweaking.

It didn’t work for me. I entered these settings in whonix-gateway and rebooted. Now in virt-manager I click shut down the machine and it doesn’t shut down, a window appears with a choice of actions (reboot, shut down, lock, etc.)

Okay, that’s strange… From what you’re saying, I gather that when you initially replied in April, your problem was just a yes-no confirmation box on whether to shutdown and now after you’ve applied the labwc settings, it’s instead a window with a choice of actions. Am I correct? If so, could you say if you are using the latest Whonix version and describe the exact steps you took when entering the labwc settings?

Also, to save us some time, if it’s just a yes-no confirmation box on shutdown, it’s likely the LXQt Session shutdown confirmation. Could you go to Session Settings and confirm that the “ask for confirmation before leaving” option is disabled?

My task is to make it so that when you click on the system shutdown button in virt-manager, the system sends a shutdown signal as it was in whonix 17. Now a window appears asking for a choice (on, off, reboot, i.e. you need to confirm the shutdown in this window).

I know. That’s what I’m trying to help with. I had the same problem when I upgraded. Perhaps I should have explained my solution better, just for posterity’s sake. You might already know this so feel free to skip ahead.

To clear the basics, virt-manager is a GUI front-end for virsh. When you press the shutdown button in virt-manager, it is the same as sending a virsh shutdown command. What the virsh shutdown command then does is send a signal to the guest machine, in the form of an ACPI signal (ignoring the --agentoption for now since Whonix does not have that afaik ). It is then up to the guest machine to interpret that signal and act accordingly. The behaviour in Xfce Whonix is to shutdown immediately, whereas in LXQt Whonix, the behaviour is to do something else.

What I’ve done is configure labwc to know how to interpret the ACPI signal XF86PowerOff. Specifically, it will run the command lxqt-leave --shutdown which should shutdown the guest machine immediately.

This is dependent on several things. First is that the “ask for confirmation before leaving” option is disabled. Second is that there isn’t any other bindings for the ACPI signal. Third is that the command lxqt-leave --shutdown is actually run, properly. If your Whonix is stock, you just need to worry about turning the “ask for confirmation before leaving” option.

A post was split to a new topic: How to add a widget to the panel that will display the current language layout?

I just had exact same issue. For Whonix Gateway I have CLI version, so it shutsdown from virt-manager window properly. But because my Whonix Workstation is LXQt version, when I click in virt manager window shutdown button inside workstation it opens shutdown options window where I manually have to click the right option.

Its a bid deal as my host has shutdown hotkey & shutdown on lid close. When one of these shutdown mechanisms were triggered but Whonix Workstation LXQt was active, in the process of shutting down I had repeating every 5 seconds “waiting for whonix workstation to shutdown” message instead of immediate shutdown. As I understand, its because graceful shutdown was attempted, but instead of shutting down the workstation just shows the shutdown options window.

So what I did & it worked for me personally:

sudo nano /etc/systemd/logind.conf

Set (remove ‘# ’):

HandlePowerKey=poweroff

Edit / create directory&file:

sudo nano ~/.config/labwc/rc.xml

Add or modify a binding for the power button:

<?xml version="1.0"?>
<labwc_config>
<keyboard>
    <keybind key="XF86PowerOff">
      <action name="Execute" command="systemctl poweroff" />
    </keybind>
</keyboard>
</labwc_config>

Reload labwc:

labwc -r 

done.