Immediate graceful shutdown from dom0 terminal

When powering off through the Qubes Application Menu, the shutdown sequence begins as soon as Shut Down is pressed. Typing shutdown -h now into the dom0 terminal results in a 7-10 second delay before the shutdown sequence starts. What is the correct way to initiate an immediate graceful shutdown from the dom0 terminal?

1 Like

Does xfce4-session-logout --halt work?

4 Likes

That worked for me, shaving ~4s off of the shutdown duration. Thanks!
One note: running the command without “-f” will save the current session, which is not always desirable, at least not for me. So:
xfce4-session-logout --halt -f → if you don’t want to save the current session.

3 Likes

It should be systemctl poweroff but I don’t know if it will give you a faster poweroff sequence.

1 Like

Yeah… this is what I was using (sometimes “systemctl reboot”)… but as “shutdown” is a soft link to systemctl, the result is the same as “shutdown -h now” or “shutdown -r now”, at least time-wise. Also, “poweroff” AND “reboot” are links to systemctl :smile:

[user@dom0 ~]$ ls -la `which shutdown`
lrwxrwxrwx 1 root root 16 Nov 27 2023 /usr/sbin/shutdown -> ../bin/systemctl

[user@dom0 ~]$ ls -la `which poweroff`
lrwxrwxrwx 1 root root 16 Nov 27 2023 /usr/sbin/poweroff -> ../bin/systemctl

This is not because it’s a symlink that it’s necessarily doing the same thing. The code of the binary could achieve different things depending the binary named used to run it, that’s for instance what busybox is doing, there is a single binary with multiple names, depending how you start it it will do the function you want.

I’ve been using the poweroff command since forever in Qubes and I’ve never had any issues, although yes, it does take 5-10 seconds for it to “kick into gear”

1 Like

Thanks! This works well.

Ditto.

On further analysis, I noticed that running xfce4-session-logout --halt [ -f ] does not save the bash history in the dom0 xfce4-terminal where the command has been typed. This means that the terminal gets killed quite unceremoniously/abruptly and this may extend to a lot of the xfce4 subsystem running at that time, explaining the 4…7 seconds faster reboot/poweroff. :bulb:

2 Likes