KVM使用virsh console無法連接的解決辦法(轉)
阿新 • • 發佈:2018-01-27
AMF nbsp sca roo etc ive pat clas efault
一、問題描述:
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(以上內容轉自此篇文章)
KVM使用virsh console無法連接的解決辦法(轉)