qm-sendkey
Send keystrokes to a virtual machine console
TLDR
Send the specified key event to a specific virtual machine
Allow root user to send key event and ignore locks
SYNOPSIS
qm sendkey <vmid> <key> [<key>...]
PARAMETERS
<vmid>
The unique numeric identifier of the target virtual machine (e.g., 100, 101).
<key>
One or more key names to send sequentially to the VM. Keys can be simple characters (e.g., 'a', '1', '!'), common keys (e.g., 'enter', 'tab', 'esc', 'delete', 'backspace', 'up', 'down', 'left', 'right'), function keys (f1-f12), or combinations using hyphens (e.g., 'ctrl-alt-del', 'shift-tab', 'left-super'). Common modifier keys include 'ctrl', 'alt', 'shift', 'super'.
DESCRIPTION
The qm-sendkey command is a powerful utility within the Proxmox Virtual Environment (PVE) designed to send emulated keyboard input directly to a running QEMU/KVM virtual machine. This capability is crucial for interacting with a VM's console when standard network access (like SSH or RDP) is unavailable or when the guest operating system is not fully booted or is unresponsive.
It enables administrators to perform essential actions such as triggering a hard reboot (e.g., by sending ctrl-alt-del), navigating BIOS/UEFI settings during boot, interacting with bootloaders like GRUB, or providing simple character inputs during an OS installation or recovery process. The command communicates directly with the underlying QEMU monitor of the specified VM, bypassing the guest OS's network stack or internal processes. This makes it effective even if the guest OS is hung or has no network configuration.
It supports a wide range of keys, including individual alphanumeric characters, function keys (F1-F12), arrow keys, special keys (Esc, Tab, Enter, Delete, Backspace), and combinations involving modifier keys (Ctrl, Alt, Shift, Super). Combinations are specified with hyphens, such as ctrl-alt-del or shift-tab.
CAVEATS
Requires the virtual machine to be in a 'running' state for key presses to be effective.
This command operates at the QEMU monitor level and does not require the QEMU Guest Agent to be installed or running within the VM, making it suitable for unbootable or unresponsive guests.
Rapid successive key presses might not be reliably processed by a sluggish guest OS; consider adding a small delay if scripting complex key sequences.
Executing this command requires administrative (root or sudo) privileges on the Proxmox host.
TYPICAL USAGE SCENARIOS
Emergency Reboot: Sending ctrl-alt-del to initiate a controlled or forced reboot on a frozen or unresponsive guest operating system, similar to pressing those keys on a physical machine.
BIOS/UEFI Access: Pressing del, f2, f10, or other vendor-specific keys during the VM's very early boot sequence to enter BIOS/UEFI settings for configuration changes.
Bootloader Interaction: Navigating menus in bootloaders like GRUB, or selecting different boot options in Windows Boot Manager before the operating system fully loads.
Initial OS Setup: Providing simple keyboard inputs during initial text-based OS installation steps, such as selecting a language or accepting a license agreement, when direct console access is preferred or necessary.
HISTORY
The qm-sendkey functionality is an integral part of the Proxmox VE's command-line interface, leveraging the underlying QEMU monitor's capability to inject key events directly into virtual machines. It has been available since early versions of Proxmox VE, reflecting its fundamental role in bare-metal VM management and troubleshooting. Its design is closely tied to the evolution of QEMU/KVM itself, providing a robust, low-level method of interaction with virtual machines that complements higher-level management tools.