Some tools to make life with qemu more comfortable

User Tools

Site Tools

Config files
Advanced configuration (cfg-file)

Basic configuration

qemu-init uses a config file  <name>-qemu.rc  (further called rc-file) to define the parameters of a virtual machine, where <name> is the unique identifier of the virtual machine. With the default parameters in this file it is quite easy to define a (simple) virtual machine quickly by using qemu-adm. Custom options of a qemu vm could be defined in the file  <name>-user.cfg .

The syntax of the rc-file is  VAR=VALUE . All after a # in a line is a comment and will be ignored. A variable could be disabled by set an empty value  VAR=“”  (recommended) or by commenting it out!

The values of the rc-file could be changed, but don't add custom options here!

The rc-file has 3 sections:

  1. name section
  2. qemu-init section
  3. qemu section

Name section

This section has 2 parameters only:


Required. This is the unique identifier of the VM. It is used by qemu-init as well for the qemu option  -name .


Description, optional. A string which will be appended to the NAME. The initial idea was to show quickly which operation system is used, but any other description will be fine. optional - but recommended!

qemu-init section

This section defines the behavior of the virtual machine.


Machine architecture of the VM. Default:  qemu-system-x86_64 .


Run the VM in daemon mode. Set 1 to enable (default) or 0 to disable daemon mode. This sets the qemu option  -daemonize .


Delay the start of the VM. Takes only effect with the AUTOSTART option (see qemu-adm). Have to be given in full seconds (default: not set).


The timeout to shutdown the VM in full seconds (default: 40). Only required if the regular shutdown of the VM takes longer than 40 seconds.


A command which will be executed before the VM will be started. Example:

PRECMD="cp /usr/local/lib/ovmf-x64/OVMF_VARS-pure-efi.fd /tmp/my_vars.fd"


A command which will be executed after the VM was started. Could be used to tune the VM.


By default qemu-init starts a VM with root privileges and drops the privileges through qemu's  -runas  option, using  $USER . If  $USER  is root it uses the qemu-init user (default:  qemud ). Under some circumstances it is maybe required to not drop privileges. This could be done by set  FORCEROOT=“1”  (default: not set). Takes only effect if “ $USER=root ”!

qemu section

This section defines basic hardware of the VM.


Some basic qemu options. Change it to your needs.


Set the qemu option  -display . Valid values are “vnc” (default), “none” or nothing (empty value). With an empty value QEMU_DISPLAY will be ignored.


Together with display “vnc” it is perhaps a good idea to have a mouse available. Optional.


Define one ore more harddisks, CD drives and network interfaces. All of them have to have a consecutively number as suffix, starting with 1 (one). As long the series isn't interrupted devices will be added. An empty value interrupts the series too.

All DSK's will be handled the same way (the parameter have to be an image file):

-drive file=image_sda.img,snapshot=off

All CDR's will be handled like (parameter have to be an iso image):

-cdrom /the/path/to/<image-name>.iso

All NIC's will be handled as tap devices (bridged networking). The mac address is calculated and unique for every qemu-init NIC interface. The parameter have to be the device name:

-device virtio-net-pci,netdev=net0,mac=DE:AD:BE:EF:37:36
-netdev tap,id=net0,script=/usr/local/lib/qemu-brup,downscript=/usr/local/lib/qemu-brdown

If the standard option above doesn't fit your need, more options could be defined in the file <name>-usr.cfg.

Last modified: 2020/03/30 10:59

Page Tools