QEMU MonitorQEMU monitorThe QEMU monitor is used to give complex commands to the QEMU
emulator. You can use it to:
− Remove or insert removable media images
(such as CD-ROM or floppies).
− Freeze/unfreeze the Virtual Machine (VM) and save or restore its state
from a disk file.
− Inspect the VM state without an external debugger.
CommandsThe following commands are available:
helpShow the help for all commands or just for command cmd.
commitCommit changes to the disk images (if -snapshot is used) or backing files.
If the backing file is smaller than the snapshot, then the backing file will be
resized to be the same size as the snapshot. If the snapshot is smaller than
the backing file, the backing file will not be truncated. If you want the
backing file to match the size of the smaller snapshot, you can safely truncate
it yourself once the commit operation successfully completes.
quitQuit the emulator.
block_resizeResize a block image while a guest is running. Usually requires guest
action to see the updated size. Resize to a lower size is supported,
but should be used with extreme caution. Note that this command only
resizes image files, it can not resize block devices like LVM volumes.
block_streamCopy data from a backing file into a block device.
block_job_set_speedSet maximum speed for a background block operation.
block_job_cancelStop an active background block operation (streaming, mirroring).
block_job_completeManually trigger completion of an active background block operation.
For mirroring, this will switch the device to the destination path.
block_job_pausePause an active block streaming operation.
block_job_resumeResume a paused block streaming operation.
ejectEject a removable medium (use -f to force it).
drive_delRemove host block device. The result is that guest generated IO is no longer
submitted against the host device underlying the disk. Once a drive has
been deleted, the QEMU Block layer returns -EIO which results in IO
errors in the guest for applications that are reading/writing to the device.
These errors are always reported to the guest, regardless of the drive’s error
actions (drive options rerror, werror).
changeChange the configuration of a device.
Change the medium for a removable disk device to point to filename. eg
(qemu) change ide1-cd0 /path/to/some.iso
format is optional.
read-only-mode may be used to change the read-only status of the device.
It accepts the following values:
retainRetains the current status; this is the default.
read-onlyMakes the device read-only.
read-writeMakes the device writable.
Change the configuration of the VNC server. The valid syntax for display
and options are described at sec_invocation. eg
(qemu) change vnc localhost:1
Change the password associated with the VNC server. If the new password is not
supplied, the monitor will prompt for it to be entered. VNC passwords are only
significant up to 8 letters. eg
(qemu) change vnc password
Password: ********
screendumpSave screen into PPM image filename.
logfileOutput logs to filename.
trace-eventchanges status of a trace event
trace-fileOpen, close, or flush the trace file. If no argument is given, the status of the trace file is displayed.
logActivate logging of the specified items.
savevmCreate a snapshot of the whole virtual machine. If tag is
provided, it is used as human readable identifier. If there is already
a snapshot with the same tag or ID, it is replaced. More info at
vm_snapshots.
loadvmSet the whole virtual machine to the snapshot identified by the tag
tag or the unique snapshot ID id.
delvmDelete the snapshot identified by tag or id.
singlestepRun the emulation in single step mode.
If called with option off, the emulation returns to normal mode.
stopStop emulation.
contResume emulation.
system_wakeupWakeup guest from suspend.
gdbserverStart gdbserver session (default port=1234)
xVirtual memory dump starting at addr.
xpPhysical memory dump starting at addr.
fmt is a format which tells the command how to format the
data. Its syntax is:
countis the number of items to be dumped.
formatcan be x (hex), d (signed decimal), u (unsigned decimal), o (octal),
c (char) or i (asm instruction).
sizecan be b (8 bits), h (16 bits), w (32 bits) or g (64 bits). On x86,
h or w can be specified with the i format to
respectively select 16 or 32 bit code instruction size.
Examples:
Dump 10 instructions at the current instruction pointer:
(qemu) x/10i $eip
0x90107063: ret
0x90107064: sti
0x90107065: lea 0x0(%esi,1),%esi
0x90107069: lea 0x0(%edi,1),%edi
0x90107070: ret
0x90107071: jmp 0x90107080
0x90107073: nop
0x90107074: nop
0x90107075: nop
0x90107076: nop
Dump 80 16 bit values at the start of the video memory.
(qemu) xp/80hx 0xb8000
0x000b8000: 0x0b50 0x0b6c 0x0b65 0x0b78 0x0b38 0x0b36 0x0b2f 0x0b42
0x000b8010: 0x0b6f 0x0b63 0x0b68 0x0b73 0x0b20 0x0b56 0x0b47 0x0b41
0x000b8020: 0x0b42 0x0b69 0x0b6f 0x0b73 0x0b20 0x0b63 0x0b75 0x0b72
0x000b8030: 0x0b72 0x0b65 0x0b6e 0x0b74 0x0b2d 0x0b63 0x0b76 0x0b73
0x000b8040: 0x0b20 0x0b30 0x0b35 0x0b20 0x0b4e 0x0b6f 0x0b76 0x0b20
0x000b8050: 0x0b32 0x0b30 0x0b30 0x0b33 0x0720 0x0720 0x0720 0x0720
0x000b8060: 0x0720 0x0720 0x0720 0x0720 0x0720 0x0720 0x0720 0x0720
0x000b8070: 0x0720 0x0720 0x0720 0x0720 0x0720 0x0720 0x0720 0x0720
0x000b8080: 0x0720 0x0720 0x0720 0x0720 0x0720 0x0720 0x0720 0x0720
0x000b8090: 0x0720 0x0720 0x0720 0x0720 0x0720 0x0720 0x0720 0x0720
printPrint expression value. Only the format part of fmt is
used.
iRead I/O port.
oWrite to I/O port.
sendkeySend keys to the guest. keys could be the name of the
key or the raw value in hexadecimal format. Use - to press
several keys simultaneously. Example:
sendkey ctrl-alt-f1
This command is useful to send keys that your graphical user interface
intercepts at low level, such as ctrl-alt-f1 in X Window.
system_resetReset the system.
system_powerdownPower down the system (if supported).
sumCompute the checksum of a memory region.
usb_addAdd the USB device devname. For details of available devices see
usb_devices
usb_delRemove the USB device devname from the QEMU virtual USB
hub. devname has the syntax bus.addr. Use the monitor
command info usb to see the devices you can remove.
device_addAdd device.
device_delRemove device id. id may be a short ID
or a QOM object path.
cpuSet the default CPU.
mouse_moveMove the active mouse to the specified coordinates dxdy
with optional scroll axis dz.
mouse_buttonChange the active mouse button state val (1=L, 2=M, 4=R).
mouse_setSet which mouse device receives events at given index, index
can be obtained with
info mice
wavcaptureCapture audio into filename. Using sample rate frequency
bits per sample bits and number of channels channels.
Defaults:
− Sample rate = 44100 Hz - CD quality
− Bits = 16
− Number of channels = 2 - Stereo
stopcaptureStop capture with a given index, index can be obtained with
info capture
memsavesave to disk virtual memory dump starting at addr of size size.
pmemsavesave to disk physical memory dump starting at addr of size size.
boot_setDefine new values for the boot device list. Those values will override
the values specified on the command line through the -boot option.
The values that can be specified here depend on the machine type, but are
the same that can be specified in the -boot command line option.
nmiInject an NMI on the default CPU (x86/s390) or all CPUs (ppc64).
ringbuf_writeWrite data to ring buffer character device device.
data must be a UTF-8 string.
ringbuf_readRead and print up to size bytes from ring buffer character
device device.
Certain non-printable characters are printed \uXXXX, where XXXX is the
character code in hexadecimal. Character \ is printed \\.
Bug: can screw up when the buffer contains invalid UTF-8 sequences,
NUL characters, after the ring buffer lost data, and when reading
stops because the size limit is reached.
migrateMigrate to uri (using -d to not wait for completion).
-b for migration with full copy of disk
-i for migration with incremental copy of disk (base image is shared)
migrate_cancelCancel the current VM migration.
migrate_incomingContinue an incoming migration using the uri (that has the same syntax
as the -incoming option).
migrate_set_cache_sizeSet cache size to value (in bytes) for xbzrle migrations.
migrate_set_speedSet maximum speed to value (in bytes) for migrations.
migrate_set_downtimeSet maximum tolerated downtime (in seconds) for migration.
migrate_set_capabilityEnable/Disable the usage of a capability capability for migration.
migrate_set_parameterSet the parameter parameter for migration.
migrate_start_postcopySwitch in-progress migration to postcopy mode. Ignored after the end of
migration (or once already in postcopy).
x_colo_lost_heartbeatTell COLO that heartbeat is lost, a failover or takeover is needed.
client_migrate_infoSet migration information for remote display. This makes the server
ask the client to automatically reconnect using the new parameters
once migration finished successfully. Only implemented for SPICE.
dump-guest-memoryDump guest memory to protocol. The file can be processed with crash or
gdb. Without -z|-l|-s, the dump format is ELF.
-p: do paging to get guest’s memory mapping.
-z: dump in kdump-compressed format, with zlib compression.
-l: dump in kdump-compressed format, with lzo compression.
-s: dump in kdump-compressed format, with snappy compression.
filename: dump file name.
begin: the starting physical address. It’s optional, and should be
specified together with length.
length: the memory size, in bytes. It’s optional, and should be specified
together with begin.
dump-skeysSave guest storage keys to a file.
snapshot_blkdevSnapshot device, using snapshot file as target if provided
snapshot_blkdev_internalTake an internal snapshot on device if it support
snapshot_delete_blkdev_internalDelete an internal snapshot on device if it support
drive_mirrorStart mirroring a block device’s writes to a new destination,
using the specified target.
drive_backupStart a point-in-time copy of a block device to a specificed target.
drive_addAdd drive to PCI storage controller.
pcie_aer_inject_errorInject PCIe AER error
host_net_addAdd host VLAN client.
host_net_removeRemove host VLAN client.
netdev_addAdd host network device.
netdev_delRemove host network device.
object_addCreate QOM object.
object_delDestroy QOM object.
hostfwd_addRedirect TCP or UDP connections from host to guest (requires -net user).
hostfwd_removeRemove host-to-guest TCP or UDP redirection.
balloonRequest VM to change its memory allocation to value (in MB).
set_linkSwitch link name on (i.e. up) or off (i.e. down).
watchdog_actionChange watchdog action.
acl_showList all the matching rules in the access control list, and the default
policy. There are currently two named access control lists,
vnc.x509dname and vnc.username matching on the x509 client
certificate distinguished name, and SASL username respectively.
acl_policySet the default access control list policy, used in the event that
none of the explicit rules match. The default policy at startup is
always deny.
acl_addAdd a match rule to the access control list, allowing or denying access.
The match will normally be an exact username or x509 distinguished name,
but can optionally include wildcard globs. eg *@EXAMPLE.COM to
allow all users in the EXAMPLE.COM kerberos realm. The match will
normally be appended to the end of the ACL, but can be inserted
earlier in the list if the optional index parameter is supplied.
acl_removeRemove the specified match rule from the access control list.
acl_resetRemove all matches from the access control list, and set the default
policy back to deny.
nbd_server_startStart an NBD server on the given host and/or port. If the
option is included, all of the virtual machine’s block devices that
have an inserted media on them are automatically exported; in this case,
the option makes the devices writable too.
nbd_server_addExport a block device through QEMU’s NBD server, which must be started
beforehand with nbd_server_start. The option makes the
exported device writable too.
nbd_server_stopStop the QEMU embedded NBD server.
mce (x86)Inject an MCE on the given CPU (x86 only).
getfdIf a file descriptor is passed alongside this command using the SCM_RIGHTS
mechanism on unix sockets, it is stored using the name fdname for
later use by other monitor commands.
closefdClose the file descriptor previously assigned to fdname using the
getfd command. This is only needed if the file descriptor was never
used by another monitor command.
block_passwdSet the encrypted device device password to passwordblock_set_io_throttleChange I/O throttle limits for a block drive to bpsbps_rdbps_wriopsiops_rdiops_wrset_passwordChange spice/vnc password. Use zero to make the password stay valid
forever. action-if-connected specifies what should happen in
case a connection is established: fail makes the password change
fail. disconnect changes the password and disconnects the
client. keep changes the password and keeps the connection up.
keep is the default.
expire_passwordSpecify when a password for spice/vnc becomes
invalid. expire-time accepts:
nowInvalidate password instantly.
neverPassword stays valid forever.
+nsecPassword stays valid for nsec seconds starting now.
nsecPassword is invalidated at the given time. nsec are the seconds
passed since 1970, i.e. unix epoch.
chardev-addchardev_add accepts the same parameters as the -chardev command line switch.
chardev-removeRemoves the chardev id.
qemu-ioExecutes a qemu-io command on the given block device.
cpu-addAdd CPU with id idPrint QOM properties of object at location pathSet QOM property property of object at location path to value valueinfoShow various information about the system state.
versionShow the version of QEMU.
networkShow the network state.
chardevShow the character devices.
blockShow info of one block device or all block devices.
blockstatsShow block device statistics.
block-jobsShow progress of ongoing block device operations.
registersShow the cpu registers.
lapicShow local APIC state
ioapicShow io APIC state
cpusShow infos for each CPU.
historyShow the command line history.
irqShow the interrupts statistics (if available).
picShow i8259 (PIC) state.
pciShow PCI information.
tlbShow virtual to physical memory mappings.
memShow the active virtual memory mappings.
mtreeShow memory tree.
jitShow dynamic compiler info.
opcountShow dynamic compiler opcode counters
kvmShow KVM information.
numaShow NUMA information.
usbShow guest USB devices.
usbhostShow host USB devices.
profileShow profiling information.
captureShow capture information.
snapshotsShow the currently saved VM snapshots.
statusShow the current VM status (running|paused).
miceShow which guest mouse is receiving events.
vncShow the vnc server status.
spiceShow the spice server status.
nameShow the current VM name.
uuidShow the current VM UUID.
cpustatsShow CPU statistics.
usernetShow user network stack connection states.
migrateShow migration status.
migrate_capabilitiesShow current migration capabilities.
migrate_parametersShow current migration parameters.
migrate_cache_sizeShow current migration xbzrle cache size.
balloonShow balloon information.
qtreeShow device tree.
qdmShow qdev device model list.
qom-treeShow QOM composition tree.
romsShow roms.
trace-eventsShow available trace-events & their state.
tpmShow the TPM device.
memdevShow memory backends
memory-devicesShow memory devices.
iothreadsShow iothread’s identifiers.
rockerShow rocker switch.
ocker-portsShow rocker ports.
rocker-of-dpa-flowsShow rocker OF-DPA flow tables.
rocker-of-dpa-groupsShow rocker OF-DPA groups.
skeysDisplay the value of a storage key (s390 only)
dumpDisplay the latest dump status.
hotpluggable-cpusShow information about hotpluggable CPUs
Integer expressionsThe monitor understands integers expressions for every integer
argument. You can use register names to get the value of specifics
CPU registers by prefixing them with $.