Good afternoon,

I'm following the instructions here in order to get console access from libvirt

The problem I'm having is the domain.xml does not accept the new changes. I have also done the following:

vi /etc/libvirt/qemu/domain.xml  # made my changes
virsh define /etc/libvirt/qemu/domain.xml

I have already added the "--console=ttyS0" to the end of my /etc/defaults/grub file and run

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

The end result is if I try

virsh console domain

I do not get a login prompt. I just get the typical

"escape character is ^]"
  • Press ENTER on your keyboard. – Michael Hampton Mar 28 at 19:19
  • I wish it were that easy. – Paul Mar 28 at 19:25
  • Maybe it is. You should try it and note the results. – Michael Hampton Mar 28 at 19:27
  • Yep, hit "enter" several times, still at "Escape character is ^]" – Paul Mar 28 at 19:28

Taken from from actual CentOS 7 VM:

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

Also in grub there is:

GRUB_DISTRIBUTOR="$(sed 's, release .*$,,g' /etc/system-release)"
GRUB_SERIAL_COMMAND="serial --speed=115200 --unit=0 --word=8 --parity=no --stop=1"
GRUB_CMDLINE_LINUX=" vconsole.font=latarcyrheb-sun16 crashkernel=auto  vconsole.keymap=us rhgb quiet elevator=deadline audit=1 console=tty0 console=ttyS0,115200n8 transparent_hugepage=never"

Do not copy paste the grub config literally as your vg is probably with different name.
This config enables terminal on both video output and serial console (tty0 and ttyS0)

After edit regenerate the grub.cfg:

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

Save the xml, shutdown the vm and power it on again (virsh no always presents new devices with just a reboot).
If after that there is still no console try to start it manually via SSH/video:

systemctl start serial-getty@ttyS0.service
  • Thanks, that's exactly what I'm doing. The problem I'm having is w/ your CentOS VM domain.xml configurations: I do these and the changes do not stick. I do virsh edit domain and all of my changes are gone. – Paul Mar 28 at 21:44
  • If your xml is wrong virsh usually won't let you save the config, try the following: export EDITOR=nano virsh edit vmname And paste the above XML blocks right after the end of <interface> e.g after line </interface> that is in the <devices></devices> section. *if you prefer other editor replace nano with the name of your favorite – Daniel Mar 29 at 6:32

Your Answer

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Not the answer you're looking for? Browse other questions tagged or ask your own question.