[CentOS] CentOS 7 kernel console under KVM?

Chris Adams
Wed, 08 Oct 2014 16:06:03 -0000

Is there a way to get GRUB2 and the kernel to run a "serial" console
under KVM?

I'm running a Fedora 20 desktop, with libvirt-managed VMs.  When I run a
CentOS 6 VM, I can set both the boot loader and kernel up to use ttyS0
and get a console compatible with "virsh console".

When I try the same with a CentOS 7 VM, it doesn't work.  If I set it to
ttyS0, I just don't get anything.  I read that I should use hvc0
instead (no idea how to set the boot loader to use that); when I set
that on the kernel command line, the kernel crashes during boot with:

kernel tried to execute NX-protected page - exploit attempt? (uid: 0)
BUG: unable to handle kernel paging request at ffffffff81a4cfec
IP: [<ffffffff81a4cfec>] vty_init+0x174/0x174
PGD 18d3067 PUD 18d4063 PMD 3d9e1063 PTE 8000000001a4c163

If I don't do either, I can add a getty on hvc0 with "systemctl enable
serial-getty at hvc0.service", but that doesn't get me the boot loader
or
kernel messages.
--
Chris Adams <linux at cmadams.net>