Return to Level1Techs.com

KVM: graceful shutdown of VMs using Arch / Manjaro?


#1

Can’t have KVM/QEMU gracefully shutdown VMs when initiating a host reboot with Arch Linux or Manjaro. No problem with Debian based distros!!
Any ideas why?


#2

Welp… It is Arch so you probably have to do an DIY solution… :wink:
Look at virsh command line tools.
You could make an systemd service unit that will ensure guests are shutdown with following:
~# virsh destroy --graceful <guest-domain>

And in the .service unit file:

[Service]
Type=oneshot
RemainAfterExit=yes
ExecStart=/bin/true
ExecStop=/bin/bash -c "virsh destroy --graceful "
[Install]
WantedBy=multi-user.target`

Above systemd unit does nothing at start but via implicit Conflicts=shutdown.target the ExecStop= command is ran thus soft poweroff:ing the guest. (on host shutdown that is)
I’m not sure if does arch provide similar or better solution already…