How do I issue a sysrq on a libvirt/kvm guest using "virsh send-key"?
Environment
- Red Hat Enterprise Linux
- libvirt/kvm
Issue
- I would like to issue a sysrq to a libvirt/kvm guest without logging in via the serial console, ssh, etc.
Resolution
Issue the following from the host:
# virsh send-key <guest_domain_name> KEY_LEFTALT KEY_SYSRQ KEY_<SYSRQ>
Where:
- <SYSRQ> is the capitalized sysrq you would like to issue
- <guest_domain_name> is the name of the guest
For example, to collect a thread dump (sysrq-t) from a guest named rhel5vm, run:
# virsh send-key rhel5vm KEY_LEFTALT KEY_SYSRQ KEY_T
For example, to crash the VM thorugh sysrq run
# virsh send-key <VM-NAME> KEY_LEFTALT KEY_SYSRQ KEY_C
Notes:
- sysrq is only effective if it has been enabled. For more information, please refer to What is the SysRq facility and how do I use it?
- If you need to collect a vmcore, it is simpler to use the virsh dump command, which requires no pre-configuration of the guest.
SBR
Product(s)
Category
Tags
This solution is part of Red Hat’s fast-track publication program, providing a huge library of solutions that Red Hat engineers have created while supporting our customers. To give you the knowledge you need the instant it becomes available, these articles may be presented in a raw and unedited form.