QEMU Monitor
The 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.
Commands
The following commands are available:
helpor?[cmd]Show 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.
quitorqQuit the emulator.
exit_preconfigThis command makes QEMU exit the preconfig state and proceed with VM initialization using configuration data provided on the command line and via the QMP monitor during the preconfig state. The command is only available during the preconfig state (i.e. when the –preconfig command line option was in use).
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.
eject [-f]deviceEject a removable medium (use -f to force it).
drive_deldeviceRemove 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).
changedevice settingChange the configuration of a device.
changediskdevice [-f] filename [format [read-only-mode]]Change the medium for a removable disk device to point to filename. eg:
(qemu) change ide1-cd0 /path/to/some.iso
-fforces the operation even if the guest has locked the tray.
format is optional.
read-only-mode may be used to change the read-only status of the device. It accepts the following values:
- retain
Retains the current status; this is the default.
- read-only
Makes the device read-only.
- read-write
Makes the device writable.
change vnc password[password]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: ********
screendumpfilenameSave screen into PPM image filename.
logfilefilenameOutput logs to filename.
trace-eventchanges status of a trace event
trace-file on|off|flushOpen, close, or flush the trace file. If no argument is given, the status of the trace file is displayed.
logitem1[,…]Activate logging of the specified items.
savevmtagCreate 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, it is replaced. More info at VM snapshots.
Since 4.0, savevm stopped allowing the snapshot id to be set, accepting only tag as parameter.
loadvmtagSet the whole virtual machine to the snapshot identified by the tag tag.
Since 4.0, loadvm stopped accepting snapshot id as parameter.
delvmtagDelete the snapshot identified by tag.
Since 4.0, delvm stopped deleting snapshots by snapshot id, accepting only tag as parameter.
singlestep [off]Run the emulation in single step mode. If called with option off, the emulation returns to normal mode.
stoporsStop emulation.
contorcResume emulation.
system_wakeupWakeup guest from suspend.
gdbserver[port]Start gdbserver session (default port=1234)
x/fmt addrVirtual memory dump starting at addr.
xp /fmt addrPhysical memory dump starting at addr.
fmt is a format which tells the command how to format the data. Its syntax is:
/{count}{format}{size}- count
is the number of items to be dumped.
- format
can be x (hex), d (signed decimal), u (unsigned decimal), o (octal), c (char) or i (asm instruction).
- size
can be b (8 bits), h (16 bits), w (32 bits) or g (64 bits). On x86,
horwcan be specified with theiformat 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
gpa2hvaaddrPrint the host virtual address at which the guest’s physical address addr is mapped.
gpa2hpaaddrPrint the host physical address at which the guest’s physical address addr is mapped.
gva2gpaaddrPrint the guest physical address at which the guest’s virtual address addr is mapped based on the mapping for the current CPU.
printorp/fmt exprPrint expression value. Only the format part of fmt is used.
i/fmt addr [.index]Read I/O port.
o/fmt addr valWrite to I/O port.
sendkeykeysSend 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-f1in X Window.sync-profile [on|off|reset]Enable, disable or reset synchronization profiling. With no arguments, prints whether profiling is on or off.
system_resetReset the system.
system_powerdownPower down the system (if supported).
sumaddr sizeCompute the checksum of a memory region.
device_addconfigAdd device.
device_delidRemove device id. id may be a short ID or a QOM object path.
cpuindexSet the default CPU.
mouse_movedx dy [dz]Move the active mouse to the specified coordinates dx dy with optional scroll axis dz.
mouse_buttonvalChange the active mouse button state val (1=L, 2=M, 4=R).
mouse_setindexSet which mouse device receives events at given index, index can be obtained with:
info mice
wavcapturefilename audiodev [frequency [bits [channels]]]Capture audio into filename from audiodev, 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
stopcaptureindexStop capture with a given index, index can be obtained with:
info capture
memsaveaddr size filesave to disk virtual memory dump starting at addr of size size.
pmemsaveaddr size filesave to disk physical memory dump starting at addr of size size.
boot_setbootdevicelistDefine new values for the boot device list. Those values will override the values specified on the command line through the
-bootoption.The values that can be specified here depend on the machine type, but are the same that can be specified in the
-bootcommand line option.nmicpuInject an NMI on the default CPU (x86/s390) or all CPUs (ppc64).
ringbuf_writedevice dataWrite data to ring buffer character device device. data must be a UTF-8 string.
ringbuf_readdeviceRead and print up to size bytes from ring buffer character device device. Certain non-printable characters are printed
\uXXXX, whereXXXXis 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.announce_selfTrigger a round of GARP/RARP broadcasts; this is useful for explicitly updating the network infrastructure after a reconfiguration or some forms of migration. The timings of the round are set by the migration announce parameters. An optional comma separated interfaces list restricts the announce to the named set of interfaces. An optional id can be used to start a separate announce timer and to change the parameters of it later.
migrate [-d] [-b] [-i]uriMigrate to uri (using -d to not wait for completion).
-bfor migration with full copy of disk
-ifor migration with incremental copy of disk (base image is shared)
migrate_cancelCancel the current VM migration.
migrate_continuestateContinue migration from the paused state state
migrate_incominguriContinue an incoming migration using the uri (that has the same syntax as the
-incomingoption).migrate_recoveruriContinue a paused incoming postcopy migration using the uri.
migrate_pausePause an ongoing migration. Currently it only supports postcopy.
migrate_set_capabilitycapability stateEnable/Disable the usage of a capability capability for migration.
migrate_set_parameterparameter valueSet 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_infoprotocol hostname port tls-port cert-subjectSet 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-memory [-p]filename begin lengthdump-guest-memory [-z|-l|-s|-w]filenameDump guest memory to protocol. The file can be processed with crash or gdb. Without
-z|-l|-s|-w, the dump format is ELF.-pdo paging to get guest’s memory mapping.
-zdump in kdump-compressed format, with zlib compression.
-ldump in kdump-compressed format, with lzo compression.
-sdump in kdump-compressed format, with snappy compression.
-wdump in Windows crashdump format (can be used instead of ELF-dump converting), for Windows x64 guests with vmcoreinfo driver only
- 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-skeysfilenameSave guest storage keys to a file.
migration_modemodeEnables or disables migration mode.
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 specified target.
drive_addAdd drive to PCI storage controller.
pcie_aer_inject_errorInject PCIe AER error
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.
balloonvalueRequest VM to change its memory allocation to value (in MB).
set_linkname[on|off]Switch link name on (i.e. up) or off (i.e. down).
watchdog_actionChange watchdog action.
nbd_server_starthost:portStart an NBD server on the given host and/or port. If the
-aoption is included, all of the virtual machine’s block devices that have an inserted media on them are automatically exported; in this case, the-woption makes the devices writable too.nbd_server_adddevice [ name ]Export a block device through QEMU’s NBD server, which must be started beforehand with
nbd_server_start. The-woption makes the exported device writable too. The export name is controlled by name, defaulting to device.nbd_server_remove [-f]nameStop exporting a block device through QEMU’s NBD server, which was previously started with
nbd_server_add. The-foption forces the server to drop the export immediately even if clients are connected; otherwise the command fails unless there are no clients.nbd_server_stopStop the QEMU embedded NBD server.
mcecpu bank status mcgstatus addr miscInject an MCE on the given CPU (x86 only).
getfdfdnameIf 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.
closefdfdnameClose the file descriptor previously assigned to fdname using the
getfdcommand. This is only needed if the file descriptor was never used by another monitor command.block_set_io_throttledevice bps bps_rd bps_wr iops iops_rd iops_wrChange I/O throttle limits for a block drive to bps bps_rd bps_wr iops iops_rd iops_wr. device can be a block device name, a qdev ID or a QOM path.
set_password [ vnc | spice ] password [ -d display ] [ action-if-connected ]Change spice/vnc password. display can be used with ‘vnc’ to specify which display to set the password on. 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_password [ vnc | spice ] expire-time [ -d display ]Specify when a password for spice/vnc becomes invalid. display behaves the same as in
set_password. expire-time accepts:nowInvalidate password instantly.
neverPassword stays valid forever.
+nsecPassword stays valid for nsec seconds starting now.
- nsec
Password is invalidated at the given time. nsec are the seconds passed since 1970, i.e. unix epoch.
chardev-addargschardev-add accepts the same parameters as the -chardev command line switch.
chardev-changeargschardev-change accepts existing chardev id and then the same arguments as the -chardev command line switch (except for “id”).
chardev-removeidRemoves the chardev id.
chardev-send-breakidSend a break on the chardev id.
qemu-iodevice commandExecutes a qemu-io command on the given block device.
qom-list[path]Print QOM properties of object at location path
qom-getpath propertyPrint QOM property property of object at location path
qom-setpath property valueSet QOM property property of object at location path to value value
replay_breakicountSet replay breakpoint at instruction count icount. Execution stops when the specified instruction is reached. There can be at most one breakpoint. When breakpoint is set, any prior one is removed. The breakpoint may be set only in replay mode and only “in the future”, i.e. at instruction counts greater than the current one. The current instruction count can be observed with
info replay.replay_delete_breakRemove replay breakpoint which was previously set with
replay_break. The command is ignored when there are no replay breakpoints.replay_seekicountAutomatically proceed to the instruction count icount, when replaying the execution. The command automatically loads nearest snapshot and replays the execution to find the desired instruction. When there is no preceding snapshot or the execution is not replayed, then the command fails. icount for the reference may be observed with
info replaycommand.calc_dirty_ratesecondStart a round of dirty rate measurement with the period specified in second. The result of the dirty rate measurement may be observed with
info dirty_ratecommand.set_vcpu_dirty_limitSet dirty page rate limit on virtual CPU, the information about all the virtual CPU dirty limit status can be observed with
info vcpu_dirty_limitcommand.cancel_vcpu_dirty_limitCancel dirty page rate limit on virtual CPU, the information about all the virtual CPU dirty limit status can be observed with
info vcpu_dirty_limitcommand.dumpdtbfilenameDump the FDT in dtb format to filename.
xen-event-injectportNotify guest via event channel on port port.
xen-event-listList event channels in the guest
infosubcommandShow various information about the system state.
info versionShow the version of QEMU.
info networkShow the network state.
info chardevShow the character devices.
info blockShow info of one block device or all block devices.
info blockstatsShow block device statistics.
info block-jobsShow progress of ongoing block device operations.
info registersShow the cpu registers.
info lapicShow local APIC state
info cpusShow infos for each CPU.
info historyShow the command line history.
info irqShow the interrupts statistics (if available).
info picShow PIC state.
info rdmaShow RDMA state.
info pciShow PCI information.
info tlbShow virtual to physical memory mappings.
info memShow the active virtual memory mappings.
info mtreeShow memory tree.
info jitShow dynamic compiler info.
info opcountShow dynamic compiler opcode counters
info sync-profile [-m|-n][max]Show synchronization profiling info, up to max entries (default: 10), sorted by total wait time.
-msort by mean wait time
-ndo not coalesce objects with the same call site
When different objects that share the same call site are coalesced, the “Object” field shows—enclosed in brackets—the number of objects being coalesced.
info kvmShow KVM information.
info numaShow NUMA information.
info usbShow guest USB devices.
info usbhostShow host USB devices.
info profileShow profiling information.
info captureShow capture information.
info snapshotsShow the currently saved VM snapshots.
info statusShow the current VM status (running|paused).
info miceShow which guest mouse is receiving events.
info vncShow the vnc server status.
info spiceShow the spice server status.
info nameShow the current VM name.
info uuidShow the current VM UUID.
info usernetShow user network stack connection states.
info migrateShow migration status.
info migrate_capabilitiesShow current migration capabilities.
info migrate_parametersShow current migration parameters.
info balloonShow balloon information.
info qtreeShow device tree.
info qdmShow qdev device model list.
info qom-treeShow QOM composition tree.
info romsShow roms.
info trace-eventsShow available trace-events & their state.
info tpmShow the TPM device.
info memdevShow memory backends
info memory-devicesShow memory devices.
info iothreadsShow iothread’s identifiers.
info rockernameShow rocker switch.
info rocker-portsname-portsShow rocker ports.
info rocker-of-dpa-flowsname [tbl_id]Show rocker OF-DPA flow tables.
info rocker-of-dpa-groupsname [type]Show rocker OF-DPA groups.
info skeysaddressDisplay the value of a storage key (s390 only)
info cmmaaddressDisplay the values of the CMMA storage attributes for a range of pages (s390 only)
info dumpDisplay the latest dump status.
info ramblockDump all the ramblocks of the system.
info hotpluggable-cpusShow information about hotpluggable CPUs
info vm-generation-idShow Virtual Machine Generation ID
info memory_size_summaryDisplay the amount of initially allocated and present hotpluggable (if enabled) memory in bytes.
info sevShow SEV information.
info replayDisplay the record/replay information: mode and the current icount.
info dirty_rateDisplay the vcpu dirty rate information.
info vcpu_dirty_limitDisplay the vcpu dirty page limit information.
info sgxShow intel SGX information.
info viaShow guest mos6522 VIA devices.
statsShow runtime-collected statistics
info virtioList all available virtio devices
info virtio-statuspathDisplay status of a given virtio device
info virtio-queue-statuspath queueDisplay status of a given virtio queue
info virtio-vhost-queue-statuspath queueDisplay status of a given vhost queue
info virtio-queue-elementpath queue [index]Display element of a given virtio queue
info cryptodevShow the crypto devices.
Integer expressions
The 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 $.