Howto virt-builder debian-9 using serial console

I am using the Virtual Machine Manager (virt-manager) on the Ubuntu distro. The documentation is sparse regarding the setup with debian-9 guest systems (systemd based) using the virt-builder but with ‘none’ graphics support. Most blogs refer to ‘adding kernel parameters to /etc/inittab’ but this SYSV-config-file does not exist any longer since transition to systemd. It is required to set kernel parameter  that redirect  console IO  to  ttyS0.  With systemd this can be  achieved defining grub-default-parameters in file /etc/default/grub and re-creating the grub-menu-config.

Building the image:

sudo virt-builder debian-9 -v -x -o my-image.qcow2 --hostname dnssv.intern --root-password password:root --install "bind9,bind9-doc,dnsutils" --edit '/etc/default/keyboard: s/^XKBLAYOUT=.*/XKBLAYOUT="de"/' --edit '/etc/default/grub: s/^GRUB_CMDLINE_LINUX_DEFAULT=.*/GRUB_CMDLINE_LINUX_DEFAULT="console=ttyS0"/' --run-command '/usr/sbin/update-grub2'

Installing into virtual machine manager:

virt-install --name dnssrv --ram 256 --disk path=my-image.qcow2,format=qcow2 --import --graphics none

Instead of graphical windows with scaled fonts, on startup you should see a simple text console.

The tooling is available installing the following debian packages
sudo apt-get install libguestfs-tools
sudo apt-get install virt-manager