220px-Libvirt_logo.svg

To use the #virsh console command on a RHEL6 Virtual Server you need to configure the guests. If you do not configure them, this

Escape character is ^] Is all you get.

For RHEL6  virtual server you have to configure following files:

#virt-edit  vm   /boot/grub/grub.conf

 or

enter into the virtual machine through  SSH

 

#vi  /boot/grub/menu.lst

add the modification in bold:
default=0
timeout=5
splashimage=(hd0,0)/grub/splash.xpm.gz
serial –unit=0 –speed=115200
terminal –timeout=10 console serial

hiddenmenu
title Red Hat Enterprise Linux (2.6.32-220.el6.x86_64)
root (hd0,0)
kernel /vmlinuz-2.6.32-71.el6.x86_64 ro root=/dev/mapper/vg_server1-lg_server1 console=tty0 console=ttyS0,115200n8 rd_LVM_LV=vg_server1/lg_srver1 rd_LVM_LV=vg_server100  /lvswap rd_NO_LUKS rd_NO_MD rd_NO_DM LANG=en_US.UTF-8 SYSFONT=latarcyrheb-sun16 KEYBOARDTYPE=pc KEYTABLE=us crashkernel=auto rhgb quiet
initrd /initramfs-2.6.32-220.el6.x86_64.img

 

 

#vi    /etc/inittab
S0:2345:respawn:/sbin/agetty ttyS0 115200 linux

3

Addi­tion­ally, in order to have shell access, con­nect to your VM using ssh or vnc and cre­ate the fol­low­ing upstart script.

#vi  /etc/init/ttyS0.conf
start on runlevel=[345]
stop on run­level [016]
respawn
instance   /dev/ttyS0
exec /sbin/mingetty   /dev/ttyS0

and then add ttyS0 in securetty conf file

#vi  /etc/securetty
ttyS0

2

You can reboot the guest VM or you can do a initctl start ttyS0 to start the ttyS0 service.

#initctl start  ttyS0
#virsh  shutdown   vm
#virsh   start    vm
#virsh   console   vm

4