lost and found ( for me ? )

KVM : CentOS6 : set up a serial console when using upstart ( virsh console )


KVM host : CentOS6

Guest : CentOS6

KVM host
# /usr/libexec/qemu-kvm –version
QEMU PC emulator version 0.12.1 (qemu-kvm-0.12.1.2), Copyright (c) 2003-2008 Fabrice Bellard

# libvirtd --version
libvirtd (libvirt) 0.9.10

# uname -ri
2.6.32-279.2.1.el6.x86_64 x86_64

# cat /etc/centos-release
CentOS release 6.3 (Final)


Guest
# uname -ri
2.6.32-279.2.1.el6.x86_64 x86_64

# cat /etc/redhat-release
CentOS release 6.3 (Final)


CentOS6 is using upstart and the configuration for serial ports settings is different from previous ver.

install upstart on your VM if you have not installed it
VM # yum install upstart –y

VM # rpm -qa | grep upstart
upstart-0.6.5-12.el6.x86_64


upstart configuration files are under /etc/init directory.
VM # ls /etc/init/
control-alt-delete.conf  quit-plymouth.conf       serial.conf
init-system-dbus.conf    rc.conf                  splash-manager.conf
kexec-disable.conf       rcS-emergency.conf       start-ttys.conf
plymouth-shutdown.conf   rcS-sulogin.conf         tty.conf
prefdm.conf              rcS.conf


edit /etc/securetty
VM # echo "ttyS0" >> /etc/securetty


create a serial-ttyS0.conf file under /etc/init directory.
VM# vi /etc/init/serial-ttyS0.conf


add the following lines.
VM# cat /etc/init/serial-ttyS0.conf
stop on runlevel [016]
start on runlevel [345]

respawn
instance /dev/ttyS0
exec /sbin/mingetty /dev/ttyS0

VM# initctl start serial-ttyS0
serial-ttyS0 (/dev/ttyS0) start/running, process 1418


“initctl list” output the lists which are controlled by upstart.
VM # initctl list
rc stop/waiting
tty (/dev/tty3) start/running, process 1321
tty (/dev/tty2) start/running, process 1319
tty (/dev/tty1) start/running, process 1317
tty (/dev/tty6) start/running, process 1331
tty (/dev/tty5) start/running, process 1325
tty (/dev/tty4) start/running, process 1323
plymouth-shutdown stop/waiting
control-alt-delete stop/waiting
rcS-emergency stop/waiting
kexec-disable stop/waiting
quit-plymouth stop/waiting
rcS stop/waiting
prefdm stop/waiting
init-system-dbus stop/waiting
serial-ttyS0 (/dev/ttyS0) start/running, process 1418
splash-manager stop/waiting
start-ttys stop/waiting
rcS-sulogin stop/waiting
serial stop/waiting


connect to the VM from the KVM host with virsh console
virsh # console centos6-64-1
Connected to domain centos6-64-1
Escape character is ^]


CentOS release 6.3 (Final)
Kernel 2.6.32-279.2.1.el6.x86_64 on an x86_64

centos6-64-1 login:

1 comment:

  1. How about configuring grub to use the serial port too?

    ReplyDelete

Note: Only a member of this blog may post a comment.