QEMU/Monitor
From Wikibooks, the open-content textbooks collection
When QEMU is running, it provides a monitor console for interacting with QEMU. Through various commands, the monitor allows you to inspect the running guest OS, change removable media and USB devices, take screenshots and audio grabs, and control various aspects of the virtual machine.
The monitor is accessed from within QEMU by holding down the Control and Alt keys, and pressing 2 – CTRL-ALT-2. Once in the monitor, CTRL-ALT-1 switches back to the guest OS. Typing help or ? in the monitor brings up a list of all commands.
Contents |
[edit] Help and information
[edit] help
- help [command] or ? [command]
With no arguments, the help command lists all commands available. For more detail about another command, type help command, e.g.
(qemu) help info
On a small screen / VM window, the list of commands will scroll off the screen too quickly to let you read them. To scroll back and forth so that you can read the whole list, hold down the control key and press Page Up and Page Down.
[edit] info
- info option
Show information on some aspect of the guest OS. Available options are:
- block – block devices such as hard drives, floppy drives, cdrom
- blockstats – read and write statistics on block devices
- capture – active capturing (audio grabs)
- history – console command history
- irq – statistics on interrupts (if compiled into QEMU)
- jit – statistics on QEMU's Just In Time compiler
- kqemu – whether the kqemu kernel module is being utilised
- mem – list the active virtual memory mappings
- mice – mouse on the guest that is receiving events
- network – network devices and VLANs
- pci – PCI devices being emulated
- pcmcia – PCMCIA card devices
- pic – state of i8259 (PIC)
- profile – info on the internal profiler, if compiled into QEMU
- registers – the CPU registers
- snapshots – list the VM snapshots
- tlb – list the TLB (Translation Lookaside Buffer), i.e. mappings between physical memory and virtual memory
- usb – USB devices on the virtual USB hub
- usbhost – USB devices on the host OS
- version – QEMU version number
- vnc – VNC information
[edit] Devices
[edit] change
- change device setting
The change command allows you to change removable media (like CD-ROMs), change the display options for a VNC, and change the password used on a VNC.
When you need to change the disc in a CD or DVD drive, or switch between different .iso files, find the name of the CD or DVD drive using info and use change to make the change.
(qemu) info block ide0-hd0: type=hd removable=0 file=/path/to/winxp.img ide0-hd1: type=hd removable=0 file=/path/to/pagefile.raw ide1-hd1: type=hd removable=0 file=/path/to/testing_data.img ide1-cd0: type=cdrom removable=1 locked=0 file=/dev/sr0 ro=1 drv=host_device floppy0: type=floppy removable=1 locked=0 [not inserted] sd0: type=floppy removable=1 locked=0 [not inserted] (qemu) change ide1-cd0 /path/to/my.iso (qemu) change ide1-cd0 /dev/sr0 host_device
[edit] eject
- eject [-f] device
Use the eject command to release the device or file connected to the removable media device specified. The -f parameter can be used to force it if it initially refuses!
[edit] usb_add
[edit] usb_del
[edit] mouse_move
[edit] mouse_button
[edit] mouse_set index
[edit] sendkey keys
You can emulate keyboard events through sendkey command. The syntax is: sendkey keys. To get a list of keys, type sendkey [tab]. Example: sendkey ctrl-alt-f1
[edit] Screen and audio grabs
[edit] screendump
- screendump filename
Capture a screendump and save into a PPM image file.
[edit] wavcapture
[edit] stopcapture
[edit] Virtual machine
[edit] commit
- commit device or commit all
When running QEMU with the -snapshot option, commit changes to the device, or all devices.
[edit] quit
- quit or q
Quit QEMU immediately.
[edit] savevm
- savevm name
Save the virtual machine as the tag 'name'. Not all filesystems support this. raw does not, but qcow2 does.
[edit] loadvm
- loadvm name
Load the virtual machine tagged 'name'. This can also be done on the command line: -loadvm name
[edit] delvm
[edit] stop
Suspend execution of VM
[edit] cont
Reverse a previous stop command - resume execution of VM.
[edit] system_reset
This has an effect similar to the physical reset button on a PC. Warning: Filesystems may be left in an unclean state.
[edit] system_powerdown
This has an effect similar to the physical power button on a modern PC. The VM will get an ACPI shutdown request and usually shutdown cleanly.
[edit] log
- log option
[edit] logfile
- logfile filename
Write logs to specified file instead of the default path, /tmp/qemu.log .