I have a virtual appliance(qcow2 image) which requires serial console on a VM. In other words, I do not need to install anything. I simply need to boot up the VM from this qcow2 disk and access the virtual appliance via serial interface. Is it possible to do this with virt-install? When I add the --extra-args="console=ttyS0,115200" to virt-install, then it requires me to specify a --location. Is there a workaround to boot up a virtual machine with serial enabled using virt-install, but not specifying a distribution tree installation source?

1 Answer 1


Yes, this is possible, though there are multiple steps to adding a serial console.

--extra-args can only be used in combination with --location. As you are working from a local qcow2 disk image, --location is not actually the mechanism you are looking for.

Instead you are looking for --console:


  Connect a text console between the guest and host. Certain guest and 
  hypervisor combinations can automatically set up a getty in the guest, so an
  out of the box text login can be provided (target_type=xen for xen paravirt
  guests, and possibly target_type=virtio in the future).

In practice, this is added as follows (on a modern Linux system):

--console pty,target_type=virtio 

Note: You can get more options on available configurations here: https://libvirt.org/formatdomain.html#elementsConsole

Since I already had a QCOW2 based appliance prepared, I was able to test this as follows:

virt-install --name thing --memory 512 \
    --console pty,target_type=virtio --disk appliance.qcow2 --boot hd

Behind the scenes, this is performing a number of additions to the "domain" (an XML file storing the configuration of the host). For example:

<controller type='virtio-serial' index='0'>
  <alias name='virtio-serial0'/>
  <address type='pci' domain='0x0000' bus='0x00' slot='0x06' function='0x0'/>

<console type='pty' tty='/dev/pts/14'>
  <source path='/dev/pts/14'/>
  <target type='virtio' port='0'/>
  <alias name='console0'/>

<channel type='spicevmc'>
  <target type='virtio' name='com.redhat.spice.0' state='disconnected'/>
  <alias name='channel0'/>
  <address type='virtio-serial' controller='0' bus='0' port='1'/>

If this does not work, you can also achieve this by editing the boot options inside the appliance with a tool like guestfish(link) or by specifying the location of the kernel, initrd, and supplying the options manually with --boot. In the case of guestfish, there is even a recipe to achieve what you are looking for: guestfish-recipies: Edit grub configuration in a VM.


  Optionally specify the post-install VM boot configuration. This option
  allows specifying a boot device order, permanently booting off
  kernel/initrd with option kernel arguments, and enabling a BIOS boot menu
  (requires libvirt 0.8.3 or later)

       --boot kernel=KERNEL,initrd=INITRD,kernel_args="console=/dev/ttyS0"
           Have guest permanently boot off a local kernel/initrd pair, with the 
           specified kernel options.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .