Shutdown VM

taich

Active Member
Aug 15, 2020
117
20
38
65
After fresh installation of a VM where it does not have installed qemu-guest-agent it is mostly not possible to shutdown or stop the vm from outside the VM. What is the recommended action for this situation?

Thanks
 
Last edited:
Did you enable the guest agent in the VM creation wizard, or in the options before starting the VM?
 
I'm referring again to ticket 2534, just checking if there are any plans to include the already written code to handle this and similar scenarios?
 
In the meantime I created a little bash script <kill-vm>

Bash:
#!/bin/bash
#

if [ $# -lt 1 ] ; then
   echo "Usage: kill-vm <vmid>"
   exit
fi

VMID=${1}

EXIST=`qm list | awk '{print $1}' | grep -c ${VMID}$`
if [ ${EXIST} -eq 1 ]; then
   PID=`ps waux | grep "/usr/bin/kvm" | grep "id ${VMID}" | awk '{print $2}'`
   echo "Kill VMID ${VMID} PID ${PID}"
   kill -9 ${PID}
else
   echo "VMID ${VMID} does not exist or is not runnnig!"
fi
 
Last edited: