neulab/tldr huggingface dataset:
tftp=dir When using the user mode network stack, activate a built-in TFTP server. The files in dir will be exposed as the root of a TFTP server. The TFTP client on the guest must be configured in binary mode (use the command bin of the Unix TFTP client).
tftp-server-name=name In BOOTP reply, broadcast name as the "TFTP server name" (RFC2132 option 66). This can be used to advise the guest to load boot files or configurations from a different server than the host address.
bootfile=file When using the user mode network stack, broadcast file as the BOOTP filename. In conjunction with tftp, this can be used to network boot a guest from a local directory.
Example (using pxelinux):
qemu-system-x86_64 -hda linux.img -boot n -device e1000,netdev=n1 \ -netdev user,id=n1,tftp=/path/to/tftp/files,bootfile=/pxelinux.0
smb=dir[,smbserver=addr] When using the user mode network stack, activate a built-in SMB server so that Windows OSes can access to the host files in dir transparently. The IP address of the SMB server can be set to addr. By default the 4th IP in the guest network is used, i.e. x.x.x.4.
In the guest Windows OS, the line:
10.0.2.4 smbserver
must be added in the file C:\WINDOWS\LMHOSTS (for windows 9x/Me) or C:\WINNT\SYSTEM32\DRIVERS\ETC\LMHOSTS (Windows NT/2000).
Then dir can be accessed in \\smbserver\qemu.
Note that a SAMBA server must be installed on the host OS.
hostfwd=[tcp|udp]:[hostaddr]:hostport-[guestaddr]:guestport Redirect incoming TCP or UDP connections to the host port hostport to the guest IP address guestaddr on guest port guestport. If guestaddr is not specified, its value is x.x.x.15 (default first address given by the built-in DHCP server). By specifying hostaddr, the rule can be bound to a specific host interface. If no connection type is set, TCP is used. This option can be given multiple times.
For example, to redirect host X11 connection from screen 1 to guest screen 0, use the following:
# on the host qemu-system-x86_64 -nic user,hostfwd=tcp:127.0.0.1:6001-:6000 # this host xterm should open in the guest X11 server xterm -display :1
To redirect telnet connections from host port 5555 to telnet port on the guest, use the following:
# on the host qemu-system-x86_64 -nic user,hostfwd=tcp::5555-:23 telnet localhost 5555
Then when you use on the host telnet localhost 5555, you connect to the guest telnet server.
guestfwd=[tcp]:server:port-dev; guestfwd=[tcp]:server:port-cmd:command Forward guest TCP connections to the IP address server on port port to the character device dev or to a program executed by cmd:command which gets spawned for each connection. This option can be given multiple times.
You can either use a chardev directly and have that one used throughout QEMU's lifetime, like in the following example:
# open 10.10.1.1:4321 on bootup, connect 10.0.2.100:1234 to it whenever # the guest accesses it qemu-system-x86_64 -nic user,guestfwd=tcp:10.0.2.100:1234-tcp:10.10.1.1:4321
Or you can execute a command on every TCP connection established by the guest, so that QEMU behaves similar to an inetd process for that virtual server:
# call "netcat 10.10.1.1 4321" on every TCP connection to 10.0.2.100:1234 # and connect the TCP stream to its stdin/stdout qemu-system-x86_64 -nic  'user,id=n1,guestfwd=tcp:10.0.2.100:1234-cmd:netcat 10.10.1.1 4321'
-netdev tap,id=id[,fd=h][,ifname=name][,script=file][,downscript=dfile][,br=bridge][,helper=helper] Configure a host TAP network backend with ID id.
Use the network script file to configure it and the network script dfile to deconfigure it. If name is not provided, the OS automatically provides one. The default network configure script is /etc/qemu-ifup and the default network deconfigure script is /etc/qemu-ifdown. Use script=no or downscript=no to disable script execution.
If running QEMU as an unprivileged user, use the network helper to configure the TAP interface and attach it to the bridge.  The default network helper executable is /path/to/qemu-bridge-helper and the default bridge device is br0.
fd=h can be used to specify the handle of an already opened host TAP interface.
#launch a QEMU instance with the default network script qemu-system-x86_64 linux.img -nic tap
#launch a QEMU instance with two NICs, each one connected #to a TAP device qemu-system-x86_64 linux.img \ -netdev tap,id=nd0,ifname=tap0 -device e1000,netdev=nd0 \ -netdev tap,id=nd1,ifname=tap1 -device rtl8139,netdev=nd1
#launch a QEMU instance with the default network helper to #connect a TAP device to bridge br0 qemu-system-x86_64 linux.img -device virtio-net-pci,netdev=n1 \ -netdev tap,id=n1,"helper=/path/to/qemu-bridge-helper"
-netdev bridge,id=id[,br=bridge][,helper=helper] Connect a host TAP network interface to a host bridge device.
Use the network helper helper to configure the TAP interface and attach it to the bridge. The default network helper executable is /path/to/qemu-bridge-helper and the default bridge device is br0.
#launch a QEMU instance with the default network helper to #connect a TAP device to bridge br0 qemu-system-x86_64 linux.img -netdev bridge,id=n1 -device virtio-net,netdev=n1
#launch a QEMU instance with the default network helper to #connect a TAP device to bridge qemubr0 qemu-system-x86_64 linux.img -netdev bridge,br=qemubr0,id=n1 -device virtio-net,netdev=n1
-netdev socket,id=id[,fd=h][,listen=[host]:port][,connect=host:port] This host network backend can be used to connect the guest's network to another QEMU virtual machine using a TCP socket connection. If listen is specified, QEMU waits for incoming connections on port (host is optional). connect is used to connect to another QEMU instance using the listen option. fd=h specifies an already opened TCP socket.
# launch a first QEMU instance qemu-system-x86_64 linux.img \ -device e1000,netdev=n1,mac=52:54:00:12:34:56 \ -netdev socket,id=n1,listen=:1234 # connect the network of this instance to the network of the first instance qemu-system-x86_64 linux.img \ -device e1000,netdev=n2,mac=52:54:00:12:34:57 \ -netdev socket,id=n2,connect=127.0.0.1:1234
-netdev socket,id=id[,fd=h][,mcast=maddr:port[,localaddr=addr]] Configure a socket host network backend to share the guest's network traffic with another QEMU virtual machines using a UDP multicast socket, effectively making a bus for every QEMU with same multicast address maddr and port. NOTES:
1. Several QEMU can be running on different hosts and share same bus (assuming correct multicast setup for these hosts).
2. mcast support is compatible with User Mode Linux (argument ethN=mcast), see http://user-mode-linux.sf.net.
3. Use fd=h to specify an already opened UDP multicast socket.
# launch one QEMU instance qemu-system-x86_64 linux.img \ -device e1000,netdev=n1,mac=52:54:00:12:34:56 \ -netdev socket,id=n1,mcast=230.0.0.1:1234 # launch another QEMU instance on same "bus" qemu-system-x86_64 linux.img \ -device e1000,netdev=n2,mac=52:54:00:12:34:57 \ -netdev socket,id=n2,mcast=230.0.0.1:1234 # launch yet another QEMU instance on same "bus" qemu-system-x86_64 linux.img \ -device e1000,netdev=n3,mac=52:54:00:12:34:58 \ -netdev socket,id=n3,mcast=230.0.0.1:1234
Example (User Mode Linux compat.):
# launch QEMU instance (note mcast address selected is UML's default) qemu-system-x86_64 linux.img \ -device e1000,netdev=n1,mac=52:54:00:12:34:56 \ -netdev socket,id=n1,mcast=239.192.168.1:1102 # launch UML /path/to/linux ubd0=/path/to/root_fs eth0=mcast
Example (send packets from host's 1.2.3.4):
qemu-system-x86_64 linux.img \ -device e1000,netdev=n1,mac=52:54:00:12:34:56 \ -netdev socket,id=n1,mcast=239.192.168.1:1102,localaddr=1.2.3.4
-netdev l2tpv3,id=id,src=srcaddr,dst=dstaddr[,srcport=srcport][,dstport=dstport],txsession=txsession[,rxsession=rxsession][,ipv6=on|off][,udp=on|off][,cookie64][,counter][,pincounter][,txcookie=txcookie][,rxcookie=rxcookie][,offset=offset] Configure a L2TPv3 pseudowire host network backend. L2TPv3 (RFC3931) is a popular protocol to transport Ethernet (and other Layer 2) data frames between two systems. It is present in routers, firewalls and the Linux kernel (from version 3.3 onwards).
This transport allows a VM to communicate to another VM, router or firewall directly.
src=srcaddr source address (mandatory)
dst=dstaddr destination address (mandatory)
udp    select udp encapsulation (default is ip).
srcport=srcport source udp port.
dstport=dstport destination udp port.
ipv6   force v6, otherwise defaults to v4.
rxcookie=rxcookie; txcookie=txcookie Cookies are a weak form of security in the l2tpv3 specification.  Their function is mostly to prevent misconfiguration. By default they are 32 bit.
cookie64 Set cookie size to 64 bit instead of the default 32
counter=off Force a 'cut-down' L2TPv3 with no counter as in draft-mkonstan-l2tpext-keyed-ipv6-tunnel-00
pincounter=on Work around broken counter handling in peer. This may also help on networks which have packet reorder.
offset=offset Add an extra offset between header and data
For example, to attach a VM running on host 4.3.2.1 via L2TPv3 to the bridge br-lan on the remote Linux host 1.2.3.4:
# Setup tunnel on linux host using raw ip as encapsulation # on 1.2.3.4 ip l2tp add tunnel remote 4.3.2.1 local 1.2.3.4 tunnel_id 1 peer_tunnel_id 1 \ encap udp udp_sport 16384 udp_dport 16384 ip l2tp add session tunnel_id 1 name vmtunnel0 session_id \ 0xFFFFFFFF peer_session_id 0xFFFFFFFF ifconfig vmtunnel0 mtu 1500 ifconfig vmtunnel0 up brctl addif br-lan vmtunnel0
# on 4.3.2.1 # launch QEMU instance - if your network has reorder or is very lossy add ,pincounter
qemu-system-x86_64 linux.img -device e1000,netdev=n1 \ -netdev l2tpv3,id=n1,src=4.2.3.1,dst=1.2.3.4,udp,srcport=16384,dstport=16384,rxsession=0xffffffff,txsession=0xffffffff,counter
-netdev vde,id=id[,sock=socketpath][,port=n][,group=groupname][,mode=octalmode] Configure VDE backend to connect to PORT n of a vde switch running on host and listening for incoming connections on socketpath. Use GROUP groupname and MODE octalmode to change default ownership and permissions for communication port. This option is only available if QEMU has been compiled with vde support enabled.
# launch vde switch vde_switch -F -sock /tmp/myswitch # launch QEMU instance qemu-system-x86_64 linux.img -nic vde,sock=/tmp/myswitch
-netdev vhost-user,chardev=id[,vhostforce=on|off][,queues=n] Establish a vhost-user netdev, backed by a chardev id. The chardev should be a unix domain socket backed one. The vhost-user uses a specifically defined protocol to pass vhost ioctl replacement messages to an application on the other end of the socket. On non-MSIX guests, the feature can be forced with vhostforce. Use 'queues=n' to specify the number of queues to be created for multiqueue vhost-user.
qemu -m 512 -object memory-backend-file,id=mem,size=512M,mem-path=/hugetlbfs,share=on \ -numa node,memdev=mem \ -chardev socket,id=chr0,path=/path/to/socket \ -netdev type=vhost-user,id=net0,chardev=chr0 \ -device virtio-net-pci,netdev=net0
-netdev vhost-vdpa,vhostdev=/path/to/dev Establish a vhost-vdpa netdev.
vDPA device is a device that uses a datapath which complies with the virtio specifications with a vendor specific control path. vDPA devices can be both physically located on the hardware or emulated by software.
-netdev hubport,id=id,hubid=hubid[,netdev=nd] Create a hub port on the emulated hub with ID hubid.
The hubport netdev lets you connect a NIC to a QEMU emulated hub instead of a single netdev. Alternatively, you can also connect the hubport to another netdev with ID nd by using the netdev=nd option.
-net nic[,netdev=nd][,macaddr=mac][,model=type] [,name=name][,addr=addr][,vectors=v] Legacy option to configure or create an on-board (or machine default) Network Interface Card(NIC) and connect it either to the emulated hub with ID 0 (i.e. the default hub), or to the netdev nd.  If model is omitted, then the default NIC model associated with the machine type is used. Note that the default NIC model may change in future QEMU releases, so it is highly recommended to always specify a model. Optionally, the MAC address can be changed to mac, the device address set to addr (PCI cards only), and a name can be assigned for use in monitor commands. Optionally, for PCI cards, you can specify the number v of MSI-X vectors that the card should have; this option currently only affects virtio cards; set v = 0 to disable MSI-X. If no -net option is specified, a single NIC is created. QEMU can emulate several different models of network card.  Use -net nic,model=help for a list of available devices for your target.
-net user|tap|bridge|socket|l2tpv3|vde[,...][,name=name] Configure a host network backend (with the options corresponding to the same -netdev option) and connect it to the emulated hub 0 (the default hub). Use name to specify the name of the hub port.
Character device options The general form of a character device option is:
-chardev backend,id=id[,mux=on|off][,options] Backend is one of: null, socket, udp, msmouse, vc, ringbuf, file, pipe, console, serial, pty, stdio, braille, tty, parallel, parport, spicevmc, spiceport. The specific backend will determine the applicable options.
Use -chardev help to print all available chardev backend types.
All devices must have an id, which can be any string up to 127 characters long. It is used to uniquely identify this device in other command line directives.
A character device may be used in multiplexing mode by multiple front-ends. Specify mux=on to enable this mode. A multiplexer is a "1:N" device, and here the "1" end is your specified chardev backend, and the "N" end is the various parts of QEMU that can talk to a chardev. If you create a chardev with id=myid and mux=on, QEMU will create a multiplexer with your specified ID, and you can then configure multiple front ends to use that chardev ID for their input/output. Up to four different front ends can be connected to a single multiplexed chardev. (Without multiplexing enabled, a chardev can only be used by a single front end.) For instance you could use this to allow a single stdio chardev to be used by two serial ports and the QEMU monitor:
-chardev stdio,mux=on,id=char0 \ -mon chardev=char0,mode=readline \ -serial chardev:char0 \ -serial chardev:char0
You can have more than one multiplexer in a system configuration; for instance you could have a TCP port multiplexed between UART 0 and UART 1, and stdio multiplexed between the QEMU monitor and a parallel port:
-chardev stdio,mux=on,id=char0 \ -mon chardev=char0,mode=readline \ -parallel chardev:char0 \ -chardev tcp,...,mux=on,id=char1 \ -serial chardev:char1 \ -serial chardev:char1
When you're using a multiplexed character device, some escape sequences are interpreted in the input. See the chapter about keys in the character backend multiplexer in the System Emulation Users Guide for more details.
Note that some other command line options may implicitly create multiplexed character backends; for instance -serial mon:stdio creates a multiplexed stdio backend connected to the serial port and the QEMU monitor, and -nographic also multiplexes the console and the monitor to stdio.
There is currently no support for multiplexing in the other direction (where a single QEMU front end takes input and output from multiple chardevs).
Every backend supports the logfile option, which supplies the path to a file to record all data transmitted via the backend. The logappend option controls whether the log file will be truncated or appended to when opened.
The available backends are:
-chardev null,id=id A void device. This device will not emit any data, and will drop any data it receives. The null backend does not take any options.
-chardev socket,id=id[,TCP options or unix options][,server=on|off][,wait=on|off][,telnet=on|off][,websocket=on|off][,reconnect=seconds][,tls-creds=id][,tls-authz=id] Create a two-way stream socket, which can be either a TCP or a unix socket. A unix socket will be created if path is specified. Behaviour is undefined if TCP options are specified for a unix socket.
server=on|off specifies that the socket shall be a listening socket.
wait=on|off specifies that QEMU should not block waiting for a client to connect to a listening socket.
telnet=on|off specifies that traffic on the socket should interpret telnet escape sequences.
websocket=on|off specifies that the socket uses WebSocket protocol for communication.
reconnect sets the timeout for reconnecting on non-server sockets when the remote end goes away. qemu will delay this many seconds and then attempt to reconnect. Zero disables reconnecting, and is the default.
tls-creds requests enablement of the TLS protocol for encryption, and specifies the id of the TLS credentials to use for the handshake. The credentials must be previously created with the -object tls-creds argument.
tls-auth provides the ID of the QAuthZ authorization object against which the client's x509 distinguished name will be validated. This object is only resolved at time of use, so can be deleted and recreated on the fly while the chardev server is active.  If missing, it will default to denying access.
TCP and unix socket options are given below:
TCP options: port=port[,host=host][,to=to][,ipv4=on|off][,ipv6=on|off][,nodelay=on|off] host for a listening socket specifies the local address to be bound. For a connecting socket species the remote host to connect to. host is optional for listening sockets. If not specified it defaults to 0.0.0.0.
port for a listening socket specifies the local port to be bound. For a connecting socket specifies the port on the remote host to connect to. port can be given as either a port number or a service name. port is required.
to is only relevant to listening sockets. If it is specified, and port cannot be bound, QEMU will attempt to bind to subsequent ports up to and including to until it succeeds. to must be specified as a port number.
ipv4=on|off and ipv6=on|off specify that either IPv4 or IPv6 must be used. If neither is specified the socket may use either protocol.
nodelay=on|off disables the Nagle algorithm.
unix options: path=path[,abstract=on|off][,tight=on|off] path specifies the local path of the unix socket. path is required.  abstract=on|off specifies the use of the abstract socket namespace, rather than the filesystem. Optional, defaults to false.  tight=on|off sets the socket length of abstract sockets to their minimum, rather than the full sun_path length.  Optional, defaults to true.
-chardev udp,id=id[,host=host],port=port[,localaddr=localaddr][,localport=localport][,ipv4=on|off][,ipv6=on|off] Sends all traffic from the guest to a remote host over UDP.
host specifies the remote host to connect to. If not specified it defaults to localhost.
port specifies the port on the remote host to connect to.  port is required.
localaddr specifies the local address to bind to. If not specified it defaults to 0.0.0.0.
localport specifies the local port to bind to. If not specified any available local port will be used.
ipv4=on|off and ipv6=on|off specify that either IPv4 or IPv6 must be used.  If neither is specified the device may use either protocol.
-chardev msmouse,id=id Forward QEMU's emulated msmouse events to the guest. msmouse does not take any options.
-chardev vc,id=id[[,width=width][,height=height]][[,cols=cols][,rows=rows]] Connect to a QEMU text console. vc may optionally be given a specific size.
width and height specify the width and height respectively of the console, in pixels.
cols and rows specify that the console be sized to fit a text console with the given dimensions.
-chardev ringbuf,id=id[,size=size] Create a ring buffer with fixed size size. size must be a power of two and defaults to 64K.
-chardev file,id=id,path=path Log all traffic received from the guest to a file.
path specifies the path of the file to be opened. This file will be created if it does not already exist, and overwritten if it does.  path is required.
-chardev pipe,id=id,path=path Create a two-way connection to the guest. The behaviour differs slightly between Windows hosts and other hosts:
On Windows, a single duplex pipe will be created at \\.pipe\path.
On other hosts, 2 pipes will be created called path.in and path.out. Data written to path.in will be received by the guest. Data written by the guest can be read from path.out. QEMU will not create these fifos, and requires them to be present.
path forms part of the pipe path as described above. path is required.
-chardev console,id=id Send traffic from the guest to QEMU's standard output. console does not take any options.
console is only available on Windows hosts.
-chardev serial,id=id,path=path Send traffic from the guest to a serial device on the host.
On Unix hosts serial will actually accept any tty device, not only serial lines.
path specifies the name of the serial device to open.
-chardev pty,id=id Create a new pseudo-terminal on the host and connect to it. pty does not take any options.
pty is not available on Windows hosts.
-chardev stdio,id=id[,signal=on|off] Connect to standard input and standard output of the QEMU process.
signal controls if signals are enabled on the terminal, that includes exiting QEMU with the key sequence Control-c. This option is enabled by default, use signal=off to disable it.
-chardev braille,id=id Connect to a local BrlAPI server. braille does not take any options.
-chardev tty,id=id,path=path tty is only available on Linux, Sun, FreeBSD, NetBSD, OpenBSD and DragonFlyBSD hosts. It is an alias for serial.
path specifies the path to the tty. path is required.
-chardev parallel,id=id,path=path
-chardev parport,id=id,path=path parallel is only available on Linux, FreeBSD and DragonFlyBSD hosts.
Connect to a local parallel port.
path specifies the path to the parallel port device. path is required.
-chardev spicevmc,id=id,debug=debug,name=name spicevmc is only available when spice support is built in.
debug debug level for spicevmc
name name of spice channel to connect to
Connect to a spice virtual machine channel, such as vdiport.
-chardev spiceport,id=id,debug=debug,name=name spiceport is only available when spice support is built in.
name name of spice port to connect to
Connect to a spice port, allowing a Spice client to handle the traffic identified by a name (preferably a fqdn).
TPM device options The general form of a TPM device option is:
-tpmdev backend,id=id[,options] The specific backend type will determine the applicable options. The -tpmdev option creates the TPM backend and requires a -device option that specifies the TPM frontend interface model.
Use -tpmdev help to print all available TPM backend types.
-tpmdev passthrough,id=id,path=path,cancel-path=cancel-path (Linux-host only) Enable access to the host's TPM using the passthrough driver.
path specifies the path to the host's TPM device, i.e., on a Linux host this would be /dev/tpm0. path is optional and by default /dev/tpm0 is used.
cancel-path specifies the path to the host TPM device's sysfs entry allowing for cancellation of an ongoing TPM command. cancel-path is optional and by default QEMU will search for the sysfs entry to use.
Some notes about using the host's TPM with the passthrough driver:
The TPM device accessed by the passthrough driver must not be used by any other application on the host.
Since the host's firmware (BIOS/UEFI) has already initialized the TPM, the VM's firmware (BIOS/UEFI) will not be able to initialize the TPM again and may therefore not show a TPM-specific menu that would otherwise allow the user to configure the TPM, e.g., allow the user to enable/disable or activate/deactivate the TPM. Further, if TPM ownership is released from within a VM then the host's TPM will get disabled and deactivated. To enable and activate the TPM again afterwards, the host has to be rebooted and the user is required to enter the firmware's menu to enable and activate the TPM. If the TPM is left disabled and/or deactivated most TPM commands will fail.
To create a passthrough TPM use the following two options:
-tpmdev passthrough,id=tpm0 -device tpm-tis,tpmdev=tpm0
Note that the -tpmdev id is tpm0 and is referenced by tpmdev=tpm0 in the device option.
-tpmdev emulator,id=id,chardev=dev (Linux-host only) Enable access to a TPM emulator using Unix domain socket based chardev backend.
chardev specifies the unique ID of a character device backend that provides connection to the software TPM server.
To create a TPM emulator backend device with chardev socket backend:
-chardev socket,id=chrtpm,path=/tmp/swtpm-sock -tpmdev emulator,id=tpm0,chardev=chrtpm -device tpm-tis,tpmdev=tpm0
Linux/Multiboot boot specific When using these options, you can use a given Linux or Multiboot kernel without installing it in the disk image. It can be useful for easier testing of various kernels.
-kernel bzImage Use bzImage as kernel image. The kernel can be either a Linux kernel or in multiboot format.
-append cmdline Use cmdline as kernel command line
-initrd file Use file as initial ram disk.
-initrd file1 arg=foo,file2 This syntax is only available with multiboot.
Use file1 and file2 as modules and pass arg=foo as parameter to the first module.
-dtb file Use file as a device tree binary (dtb) image and pass it to the kernel on boot.
Debug/Expert options -compat [deprecated-input=@var{input-policy}][,deprecated-output=@var{output-policy}] Set policy for handling deprecated management interfaces (experimental):
deprecated-input=accept (default) Accept deprecated commands and arguments
deprecated-input=reject Reject deprecated commands and arguments
deprecated-input=crash Crash on deprecated commands and arguments
deprecated-output=accept (default) Emit deprecated command results and events
deprecated-output=hide Suppress deprecated command results and events
Limitation: covers only syntactic aspects of QMP.
-fw_cfg [name=]name,file=file Add named fw_cfg entry with contents from file file.
-fw_cfg [name=]name,string=str Add named fw_cfg entry with contents from string str.
The terminating NUL character of the contents of str will not be included as part of the fw_cfg item data. To insert contents with embedded NUL characters, you have to use the file parameter.
The fw_cfg entries are passed by QEMU through to the guest.
-fw_cfg name=opt/com.mycompany/blob,file=./my_blob.bin
creates an fw_cfg entry named opt/com.mycompany/blob with contents from ./my_blob.bin.
-serial dev Redirect the virtual serial port to host character device dev. The default device is vc in graphical mode and stdio in non graphical mode.
This option can be used several times to simulate up to 4 serial ports.
Use -serial none to disable all serial ports.
Available character devices are:
vc[:WxH] Virtual console. Optionally, a width and height can be given in pixel with
vc:800x600
It is also possible to specify width or height in characters:
vc:80Cx24C
pty    [Linux only] Pseudo TTY (a new PTY is automatically allocated)
none   No device is allocated.
null   void device
chardev:id Use a named character device defined with the -chardev option.
/dev/XXX [Linux only] Use host tty, e.g. /dev/ttyS0. The host serial port parameters are set according to the emulated ones.
/dev/parportN [Linux only, parallel port only] Use host parallel port N. Currently SPP and EPP parallel port features can be used.
file:filename Write output to filename. No character can be read.
stdio  [Unix only] standard input/output
pipe:filename name pipe filename
COMn   [Windows only] Use host serial port n
udp:[remote_host]:remote_port[@[src_ip]:src_port] This implements UDP Net Console. When remote_host or src_ip are not specified they default to 0.0.0.0. When not using a specified src_port a random port is automatically chosen.
If you just want a simple readonly console you can use netcat or nc, by starting QEMU with: -serial udp::4555 and nc as: nc -u -l -p 4555. Any time QEMU writes something to that port it will appear in the netconsole session.
If you plan to send characters back via netconsole or you want to stop and start QEMU a lot of times, you should have QEMU use the same source port each time by using something like -serial udp::4555@:4556 to QEMU. Another approach is to use a patched version of netcat which can listen to a TCP port and send and receive characters via udp. If you have a patched version of netcat which activates telnet remote echo and single char transfer, then you can use the following options to set up a netcat redirector to allow telnet on port 5555 to access the QEMU port.
QEMU Options: -serial udp::4555@:4556
netcat options: -u -P 4555 -L 0.0.0.0:4556 -t -p 5555 -I -T
telnet options: localhost 5555
tcp:[host]:port[,server=on|off][,wait=on|off][,nodelay=on|off][,reconnect=seconds] The TCP Net Console has two modes of operation. It can send the serial I/O to a location or wait for a connection from a location. By default the TCP Net Console is sent to host at the port. If you use the server=on option QEMU will wait for a client socket application to connect to the port before continuing, unless the wait=on|off option was specified. The nodelay=on|off option disables the Nagle buffering algorithm. The reconnect=on option only applies if server=no is set, if the connection goes down it will attempt to reconnect at the given interval. If host is omitted, 0.0.0.0 is assumed. Only one TCP connection at a time is accepted. You can use telnet=on to connect to the corresponding character device.
Example to send tcp console to 192.168.0.2 port 4444 -serial tcp:192.168.0.2:4444
Example to listen and wait on port 4444 for connection -serial tcp::4444,server=on
Example to not wait and listen on ip 192.168.0.100 port 4444 -serial tcp:192.168.0.100:4444,server=on,wait=off
telnet:host:port[,server=on|off][,wait=on|off][,nodelay=on|off] The telnet protocol is used instead of raw tcp sockets. The options work the same as if you had specified -serial tcp. The difference is that the port acts like a telnet server or client using telnet option negotiation. This will also allow you to send the MAGIC_SYSRQ sequence if you use a telnet that supports sending the break sequence. Typically in unix telnet you do it with Control-] and then type "send break" followed by pressing the enter key.
websocket:host:port,server=on[,wait=on|off][,nodelay=on|off] The WebSocket protocol is used instead of raw tcp socket. The port acts as a WebSocket server. Client mode is not supported.
unix:path[,server=on|off][,wait=on|off][,reconnect=seconds] A unix domain socket is used instead of a tcp socket. The option works the same as if you had specified -serial tcp except the unix domain socket path is used for connections.
mon:dev_string This is a special option to allow the monitor to be multiplexed onto another serial port. The monitor is accessed with key sequence of Control-a and then pressing c. dev_string should be any one of the serial devices specified above. An example to multiplex the monitor onto a telnet server listening on port 4444 would be:
-serial mon:telnet::4444,server=on,wait=off
When the monitor is multiplexed to stdio in this way, Ctrl+C will not terminate QEMU any more but will be passed to the guest instead.
braille Braille device. This will use BrlAPI to display the braille output on a real or fake device.
msmouse Three button serial mouse. Configure the guest to use Microsoft protocol.
-parallel dev Redirect the virtual parallel port to host device dev (same devices as the serial port). On Linux hosts, /dev/parportN can be used to use hardware devices connected on the corresponding host parallel port.
This option can be used several times to simulate up to 3 parallel ports.
Use -parallel none to disable all parallel ports.
-monitor dev Redirect the monitor to host device dev (same devices as the serial port). The default device is vc in graphical mode and stdio in non graphical mode. Use -monitor none to disable the default monitor.
-qmp dev Like -monitor but opens in 'control' mode.
-qmp-pretty dev Like -qmp but uses pretty JSON formatting.
-mon [chardev=]name[,mode=readline|control][,pretty[=on|off]] Setup monitor on chardev name. mode=control configures a QMP monitor (a JSON RPC-style protocol) and it is not the same as HMP, the human monitor that has a "(qemu)" prompt.  pretty is only valid when mode=control, turning on JSON pretty printing to ease human reading and debugging.
-debugcon dev Redirect the debug console to host device dev (same devices as the serial port). The debug console is an I/O port which is typically port 0xe9; writing to that I/O port sends output to this device. The default device is vc in graphical mode and stdio in non graphical mode.
-pidfile file Store the QEMU process PID in file. It is useful if you launch QEMU from a script.
-singlestep Run the emulation in single step mode.
--preconfig Pause QEMU for interactive configuration before the machine is created, which allows querying and configuring properties that will affect machine initialization. Use QMP command 'x-exit-preconfig' to exit the preconfig state and move to the next state (i.e. run guest if -S isn't used or pause the second time if -S is used). This option is experimental.
-S     Do not start CPU at startup (you must type 'c' in the monitor).
-overcommit mem-lock=on|off
-overcommit cpu-pm=on|off Run qemu with hints about host resource overcommit. The default is to assume that host overcommits all resources.
Locking qemu and guest memory can be enabled via mem-lock=on (disabled by default). This works when host memory is not overcommitted and reduces the worst-case latency for guest.
Guest ability to manage power state of host cpus (increasing latency for other processes on the same host cpu, but decreasing latency for guest) can be enabled via cpu-pm=on (disabled by default). This works best when host CPU is not overcommitted. When used, host estimates of CPU cycle and power utilization will be incorrect, not taking into account guest idle time.
-gdb dev Accept a gdb connection on device dev (see the GDB usage chapter in the System Emulation Users Guide). Note that this option does not pause QEMU execution -- if you want QEMU to not start the guest until you connect with gdb and issue a continue command, you will need to also pass the -S option to QEMU.
The most usual configuration is to listen on a local TCP socket:
-gdb tcp::3117
but you can specify other backends; UDP, pseudo TTY, or even stdio are all reasonable use cases. For example, a stdio connection allows you to start QEMU from within gdb and establish the connection via a pipe:
(gdb) target remote | exec qemu-system-x86_64 -gdb stdio ...
-s     Shorthand for -gdb tcp::1234, i.e. open a gdbserver on TCP port 1234 (see the GDB usage chapter in the System Emulation Users Guide).
-d item1[,...] Enable logging of specified items. Use '-d help' for a list of log items.
-D logfile Output log in logfile instead of to stderr
-dfilter range1[,...] Filter debug output to that relevant to a range of target addresses.  The filter spec can be either start+size, start-size or start..end where start end and size are the addresses and sizes required. For example:
-dfilter 0x8000..0x8fff,0xffffffc000080000+0x200,0xffffffc000060000-0x1000
Will dump output for any code in the 0x1000 sized block starting at 0x8000 and the 0x200 sized block starting at 0xffffffc000080000 and another 0x1000 sized block starting at 0xffffffc00005f000.
-seed number Force the guest to use a deterministic pseudo-random number generator, seeded with number. This does not affect crypto routines within the host.
-L path Set the directory for the BIOS, VGA BIOS and keymaps.
To list all the data directories, use -L help.
-bios file Set the filename for the BIOS.
-enable-kvm Enable KVM full virtualization support. This option is only available if KVM support is enabled when compiling.
-xen-domid id Specify xen guest domain id (XEN only).
-xen-attach Attach to existing xen domain. libxl will use this when starting QEMU (XEN only). Restrict set of available xen operations to specified domain id (XEN only).
-no-reboot Exit instead of rebooting.
-no-shutdown Don't exit QEMU on guest shutdown, but instead only stop the emulation. This allows for instance switching to monitor to commit changes to the disk image.
-action event=action The action parameter serves to modify QEMU's default behavior when certain guest events occur. It provides a generic method for specifying the same behaviors that are modified by the -no-reboot and -no-shutdown parameters.
-action panic=none -action reboot=shutdown,shutdown=pause -watchdog i6300esb -action watchdog=pause
-loadvm file Start right away with a saved state (loadvm in monitor)
-daemonize Daemonize the QEMU process after initialization. QEMU will not detach from standard IO until it is ready to receive connections on any of its devices. This option is a useful way for external programs to launch QEMU without having to cope with initialization race conditions.
-option-rom file Load the contents of file as an option ROM. This option is useful to load things like EtherBoot.
-rtc [base=utc|localtime|datetime][,clock=host|rt|vm][,driftfix=none|slew] Specify base as utc or localtime to let the RTC start at the current UTC or local time, respectively. localtime is required for correct date in MS-DOS or Windows. To start at a specific point in time, provide datetime in the format 2006-06-17T16:01:21 or 2006-06-17. The default base is UTC.
By default the RTC is driven by the host system time. This allows using of the RTC as accurate reference clock inside the guest, specifically if the host time is smoothly following an accurate external reference clock, e.g. via NTP. If you want to isolate the guest time from the host, you can set clock to rt instead, which provides a host monotonic clock if host support it. To even prevent the RTC from progressing during suspension, you can set clock to vm (virtual clock). 'clock=vm' is recommended especially in icount mode in order to preserve determinism; however, note that in icount mode the speed of the virtual clock is variable and can in general differ from the host clock.
Enable driftfix (i386 targets only) if you experience time drift problems, specifically with Windows' ACPI HAL. This option will try to figure out how many timer interrupts were not processed by the Windows guest and will re-inject them.
-icount [shift=N|auto][,align=on|off][,sleep=on|off][,rr=record|replay,rrfile=filename[,rrsnapshot=snapshot]] Enable virtual instruction counter. The virtual cpu will execute one instruction every 2^N ns of virtual time. If auto is specified then the virtual cpu speed will be automatically adjusted to keep virtual time within a few seconds of real time.
Note that while this option can give deterministic behavior, it does not provide cycle accurate emulation. Modern CPUs contain superscalar out of order cores with complex cache hierarchies. The number of instructions executed often has little or no correlation with actual performance.
When the virtual cpu is sleeping, the virtual time will advance at default speed unless sleep=on is specified. With sleep=on, the virtual time will jump to the next timer deadline instantly whenever the virtual cpu goes to sleep mode and will not advance if no timer is enabled. This behavior gives deterministic execution times from the guest point of view.  The default if icount is enabled is sleep=off.  sleep=on cannot be used together with either shift=auto or align=on.
align=on will activate the delay algorithm which will try to synchronise the host clock and the virtual clock. The goal is to have a guest running at the real frequency imposed by the shift option. Whenever the guest clock is behind the host clock and if align=on is specified then we print a message to the user to inform about the delay. Currently this option does not work when shift is auto. Note: The sync algorithm will work for those shift values for which the guest clock runs ahead of the host clock. Typically this happens when the shift value is high (how high depends on the host machine). The default if icount is enabled is align=off.
When the rr option is specified deterministic record/replay is enabled. The rrfile= option must also be provided to specify the path to the replay log. In record mode data is written to this file, and in replay mode it is read back.  If the rrsnapshot option is given then it specifies a VM snapshot name. In record mode, a new VM snapshot with the given name is created at the start of execution recording. In replay mode this option specifies the snapshot name used to load the initial VM state.
-watchdog model Create a virtual hardware watchdog device. Once enabled (by a guest action), the watchdog must be periodically polled by an agent inside the guest or else the guest will be restarted. Choose a model for which your guest has drivers.
The model is the model of hardware watchdog to emulate. Use -watchdog help to list available hardware models. Only one watchdog can be enabled for a guest.
The following models may be available:
ib700  iBASE 700 is a very simple ISA watchdog with a single timer.
i6300esb Intel 6300ESB I/O controller hub is a much more featureful PCI-based dual-timer watchdog.
diag288 A virtual watchdog for s390x backed by the diagnose 288 hypercall (currently KVM only).
-watchdog-action action The action controls what QEMU will do when the watchdog timer expires. The default is reset (forcefully reset the guest).  Other possible actions are: shutdown (attempt to gracefully shutdown the guest), poweroff (forcefully poweroff the guest), inject-nmi (inject a NMI into the guest), pause (pause the guest), debug (print a debug message and continue), or none (do nothing).
Note that the shutdown action requires that the guest responds to ACPI signals, which it may not be able to do in the sort of situations where the watchdog would have expired, and thus -watchdog-action shutdown is not recommended for production use.
-watchdog i6300esb -watchdog-action pause; -watchdog ib700
-echr numeric_ascii_value Change the escape character used for switching to the monitor when using monitor and serial sharing. The default is 0x01 when using the -nographic option. 0x01 is equal to pressing Control-a. You can select a different character from the ascii control keys where 1 through 26 map to Control-a through Control-z.  For instance you could use the either of the following to change the escape character to Control-t.
-echr 0x14; -echr 20
-incoming tcp:[host]:port[,to=maxport][,ipv4=on|off][,ipv6=on|off]
-incoming rdma:host:port[,ipv4=on|off][,ipv6=on|off] Prepare for incoming migration, listen on a given tcp port.
-incoming unix:socketpath Prepare for incoming migration, listen on a given unix socket.
-incoming fd:fd Accept incoming migration from a given filedescriptor.
-incoming exec:cmdline Accept incoming migration as an output from specified external command.
-incoming defer Wait for the URI to be specified via migrate_incoming. The monitor can be used to change settings (such as migration parameters) prior to issuing the migrate_incoming to allow the migration to begin.
-only-migratable Only allow migratable devices. Devices will not be allowed to enter an unmigratable state.
-nodefaults Don't create default devices. Normally, QEMU sets the default devices like serial port, parallel port, virtual console, monitor device, VGA adapter, floppy and CD-ROM drive and others. The -nodefaults option will disable all those default devices.
-chroot dir Immediately before starting guest execution, chroot to the specified directory. Especially useful in combination with -runas.
-runas user Immediately before starting guest execution, drop root privileges, switching to the specified user.
-prom-env variable=value Set OpenBIOS nvram variable to given value (PPC, SPARC only).
qemu-system-sparc -prom-env 'auto-boot?=false' \ -prom-env 'boot-device=sd(0,2,0):d' -prom-env 'boot-args=linux single'
qemu-system-ppc -prom-env 'auto-boot?=false' \ -prom-env 'boot-device=hd:2,\yaboot' \ -prom-env 'boot-args=conf=hd:2,\yaboot.conf'
-semihosting Enable semihosting mode (ARM, M68K, Xtensa, MIPS, Nios II, RISC-V only).
Note that this allows guest direct access to the host filesystem, so should only be used with a trusted guest OS.
See the -semihosting-config option documentation for further information about the facilities this enables.
-semihosting-config [enable=on|off][,target=native|gdb|auto][,chardev=id][,arg=str[,...]] Enable and configure semihosting (ARM, M68K, Xtensa, MIPS, Nios II, RISC-V only).
On Arm this implements the standard semihosting API, version 2.0.
On M68K this implements the "ColdFire GDB" interface used by libgloss.
Xtensa semihosting provides basic file IO calls, such as open/read/write/seek/select. Tensilica baremetal libc for ISS and linux platform "sim" use this interface.
On RISC-V this implements the standard semihosting API, version 0.2.
target=native|gdb|auto Defines where the semihosting calls will be addressed, to QEMU (native) or to GDB (gdb). The default is auto, which means gdb during debug sessions and native otherwise.
chardev=str1 Send the output to a chardev backend output for native or auto output when not in gdb
arg=str1,arg=str2,... Allows the user to pass input arguments, and can be used multiple times to build up a list. The old-style -kernel/-append method of passing a command line is still supported for backward compatibility. If both the --semihosting-config arg and the -kernel/-append are specified, the former is passed to semihosting as it always takes precedence.
-old-param Old param mode (ARM only).
-sandbox arg[,obsolete=string][,elevateprivileges=string][,spawn=string][,resourcecontrol=string] Enable Seccomp mode 2 system call filter. 'on' will enable syscall filtering and 'off' will disable it. The default is 'off'.
obsolete=string Enable Obsolete system calls
elevateprivileges=string Disable set*uid|gid system calls
spawn=string Disable *fork and execve
resourcecontrol=string Disable process affinity and schedular priority
-readconfig file Read device configuration from file. This approach is useful when you want to spawn QEMU process with many command line options but you don't want to exceed the command line character limit.
-no-user-config The -no-user-config option makes QEMU not load any of the user-provided config files on sysconfdir.
-trace [[enable=]pattern][,events=file][,file=file] Specify tracing options.
[enable=]PATTERN Immediately enable events matching PATTERN (either event name or a globbing pattern).  This option is only available if QEMU has been compiled with the simple, log or ftrace tracing backend.  To specify multiple events or patterns, specify the -trace option multiple times.
Use -trace help to print a list of names of trace points.
events=FILE Immediately enable events listed in FILE.  The file must contain one event name (as listed in the trace-events-all file) per line; globbing patterns are accepted too.  This option is only available if QEMU has been compiled with the simple, log or ftrace tracing backend.
file=FILE Log output traces to FILE.  This option is only available if QEMU has been compiled with the simple tracing backend.
-plugin file=file[,arg=string] Load a plugin.
file=file Load the given plugin from a shared library file.
arg=string Argument string passed to the plugin. (Can be given multiple times.)
-enable-fips Enable FIPS 140-2 compliance mode.
-msg [timestamp[=on|off]][,guest-name[=on|off]] Control error message format.
timestamp=on|off Prefix messages with a timestamp. Default is off.
guest-name=on|off Prefix messages with guest name but only if -name guest option is set otherwise the option is ignored. Default is off.
-dump-vmstate file Dump json-encoded vmstate information for current machine type to file in file
-enable-sync-profile Enable synchronization profiling.
Generic object creation -object typename[,prop1=value1,...] Create a new object of type typename setting properties in the order they are specified. Note that the 'id' property must be set. These objects are placed in the '/objects' path.
-object memory-backend-file,id=id,size=size,mem-path=dir,share=on|off,discard-data=on|off,merge=on|off,dump=on|off,prealloc=on|off,host-nodes=host-nodes,policy=default|preferred|bind|interleave,align=align,readonly=on|off Creates a memory file backend object, which can be used to back the guest RAM with huge pages.
The id parameter is a unique ID that will be used to reference this memory region in other parameters, e.g. -numa, -device nvdimm, etc.
The size option provides the size of the memory region, and accepts common suffixes, e.g. 500M.
The mem-path provides the path to either a shared memory or huge page filesystem mount.