What is the proper way to shut down?

So what is the proper way to shut down the system? For the longest time I’ve just closed down all my work in each VM then used the shutdown button in the top right. I assumed this gracefully shut down all the VMs and then switched off, but perhaps I should be shutting down the qubes myself and then using the shutdown button once they are stopped?

Can anyone chime in or point me to code?

Thanks!

close your data and @dom0$ qvm-shutdown --all

Turns out the qvm-shutdown is done automatically:

Actually, the service that calls qvm-shutdown has TimeoutStopSec 180, which is too short in some instances. I’ve had 690GB+ vms take longer than this to stop.

This post solves my long-standing question. With R4.1 and a new machine I have found that it is more stable to manually poweroff every VM before rebooting the system, and if I do not poweroff them, then when machine boots, some VMs behave as if they have not been powered off properly. (When I was using R4.0 on my old machine I have never had such problem though)

And I am glad to learn now a useful command qvm-shutdown --all --wait thanks to this post.

About shutdown time, I suspect that VM having long shutdown time is mostly because it have written too much data onto its storage - the “flush” work, or say the LVM (private storage is a LVM volume) merge work is done when it shutdowns. Especially when you are using hdd rather than ssd.

My suggestion is that, if you have a large private storage in VM and each boot you need to touch most of the files on that VM (for example you are running docker on that VM, and /var/lib/docker is on private storage), try doing otherwise and prepare a dedicated volume for that VM to attach at runtime - a dedicated volume created by lvcreate in dom0 will not have snapshot (copy-on-write) penalty and will not take time when shutdown, whatever amount of data you have written there.

If you have booting time issue, put the relevant template VM onto SSD while remain other VM onto hdd.

3 Likes

Glad I could help. Would be great if this was added to the documentation somewhere.