By default RHEL / CentOS sets your virtual guests up for graphical VNC / Spice console which is a definate must in many situations but old covenant guys like me prefer the text console access so here is my notes for setting it up especially for RHEL7 / CentOS7 but also applies to other distros with systemd.

First start your guest and access it with virt-manager or equivalent.

See that the guest /etc/securetty contains entry ttyS0.

On the guest edit /etc/default/grub to include the following information:

GRUB_CMDLINE_LINUX="crashkernel=auto rhgb console=ttyS0"

If you wish to include the grub boot menu as well then also add the following:

GRUB_SERIAL_COMMAND="serial --speed=38400 --unit=0 --word=8 --parity=no --stop=1"

and update grub with command

grub2-mkconfig -o /boot/grub2/grub.cfg

This will update grub with kernel arguments to enable text console to the serial port which should be enabled by default in your virtual guest.

Now reboot the guest and try accessing the console with

virsh console <guest name>

If the console is not working then check your guest configuration in your host (not guest!) with command

virsh dumpxml <guest name>

And look for entry such as this (replace NN with a random number between 0 and 12)

<console type='pty' tty='/dev/pts/NN'>
    <source path='/dev/pts/NN'/>
    <target type='serial' port='0'/>
    <alias name='serial0'/>

If not then add it by editing configuration with

virsh edit <guest name>

Reboot guest and try.

~~DISCUSSION|Leave a comment~~ ~~QUICKSTATS:@virshconsolecentos7&basics~~ ~~QUICKSTATS:@virshconsolecentos7&ip~~

  • tips_and_howtos/virsh_console_centos7.txt
  • Last modified: 2021/10/24 13:51
  • (external edit)