Best way to restart a VM from command line since `qvm-restart` doesn't appear to exist?

Background: I want to restart a VM from a dom0 command line instead of via the Qubes Manager GUI. I was surprised to find that qvm-restart doesn’t exist. But since qvm-shutdown and qvm-start exist, I figured I could just chain those together. But if VM I want to restart is connected to other VMs (e.g. sys-firewall), qvm-shutdown gives an error. I could use qvm-kill or qvm-shutdown --force but those options seem excessive… Since I can restart any VM via the Qubes Manager GUI, I suspect there is a more elegant way.

What is the chain of commands that the Qubes Manager GUI uses to restart a VM?

1 Like

Looks like Qube Manager essentially does the same as qvm-shutdown --force --wait -- vmname followed by qvm-start -- vmname:

4 Likes

Background: I want to restart a VM from a dom0 command line instead of via the Qubes Manager GUI. I was surprised to find that qvm-restart doesn’t exist. But since qvm-shutdown and qvm-start exist, I figured I could just chain those together. But if VM I want to restart is connected to other VMs (e.g. sys-firewall), qvm-shutdown gives an error. I could use qvm-kill or qvm-shutdown --force but those options seem excessive… Since I can restart any VM via the Qubes Manager GUI, I suspect there is a more elegant way.

I’m not particulary elegant, and use qvm-kill liberally, particularly
in restart.

What is the chain of commands that the Qubes Manager GUI uses to restart a VM?
shutdown_vm(vm, force=True, and_restart=True)

I never presume to speak for the Qubes team. When I comment in the Forum I speak for myself.
1 Like

You can add it yourself - pr is not merged (but has problems):

p.s. I picked up the original pr:

2 Likes

Thanks for putting in the pr request! I don’t have a github account… I’m still just learning how to use command line :sweat_smile: