一、问题描述:
KVM中宿主机通过console无法连接客户机,卡在这里不动。
# virsh console vm01
Connected to domain vm01
Escape character is ^]
二、解决办法:
利用vnc或宿主机的桌面进入客户机vm01中添加参数
1、添加ttyS0的安全许可,允许root登录:
# echo "ttyS0" >> /etc/securetty
2、在/etc/grub.conf文件中为内核添加参数:
console=ttyS0
这步要注意:
console=ttyS0一定要放在kernel这行中(大约在第16行),不能单独一行,即console=ttyS0是kernel的一个参数,不是单独的,如下(往右拉进度条,在最后):
# cat -n /etc/grub.conf # grub.conf generated by anaconda # # Note that you do not have to rerun grub after making changes to this file # NOTICE: You have a /boot partition. This means that # all kernel and initrd paths are relative to /boot/, eg. # root (hd0,0) # kernel /vmlinuz-version ro root=/dev/mapper/VolGroup-lv_root # initrd /initrd-[generic-]version.img #boot=/dev/vda default=0 timeout=5 splashimage=(hd0,0)/grub/splash.xpm.gz hiddenmenu title Red Hat Enterprise Linux (2.6.32-431.el6.x86_64) root (hd0,0) kernel /vmlinuz-2.6.32-431.el6.x86_64 ro root=/dev/mapper/VolGroup-lv_root rd_NO_LUKS LANG=en_US.UTF-8 rd_NO_MD rd_LVM_LV=VolGroup/lv_swap SYSFONT=latarcyrheb-sun16 crashkernel=auto rd_LVM_LV=VolGroup/lv_root KEYBOARDTYPE=pc KEYTABLE=us rd_NO_DM rhgb quiet console=ttyS0 initrd /initramfs-2.6.32-431.el6.x86_64.img
3、在/etc/inittab中添加agetty:
S0:12345:respawn:/sbin/agetty ttyS0 115200
4、重启客户机:
# reboot
问题解决。
参考:
http://www.linuxidc.com/Linux/2014-10/107891.htm(以上内容转自此篇文章)