用virsh console vhosts 卡住

[root@666 ok]# virsh list --all
 Id    Name                           State
----------------------------------------------------
 1     c01                            running
 -     c02                            shut off
 -     c03                            shut off
 -     c70                            shut off
 -     w7                             shut off
 -     win7                           shut off

[root@666 ok]# virsh console c01
Connected to domain c01
Escape character is ^]

 解决问题以下几步:

# cat /etc/securetty 
console
vc/1
vc/2
vc/3
vc/4
vc/5
vc/6
vc/7
vc/8
vc/9
vc/10
vc/11
tty1
tty2
tty3
tty4
tty5
tty6
tty7
tty8
tty9
tty10
tty11
# echo "ttyS0">>/etc/securetty
[root@DB ~]# cat /etc/securetty 
console
vc/1
vc/2
vc/3
vc/4
vc/5
vc/6
vc/7
vc/8
vc/9
vc/10
vc/11
tty1
tty2
tty3
tty4
tty5
tty6
tty7
tty8
tty9
tty10
tty11
ttyS0
#追加了ttyS0

在/etc/grub.conf文件中为内核添加参数:

console=ttyS0

[root@DB ~]# cat /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 CentOS 6 (2.6.32-642.el6.x86_64)
    root (hd0,0)
    kernel /vmlinuz-2.6.32-642.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-642.el6.x86_64.img

在/etc/inittab中添加agetty:

S0:12345:respawn:/sbin/agetty ttyS0 115200

[root@DB ~]# tail -n 2 /etc/inittab 
id:3:initdefault:
S0:12345:respawn:/sbin/agetty ttyS0 115200 #增加的参数

生启虚机后,再次连接,成功:

[root@666 ok]# virsh start c01
Domain c01 started

[root@666 ok]# virsh console c01
Connected to domain c01
Escape character is ^]
emon: [  OK  ]

CentOS release 6.8 (Final)
Kernel 2.6.32-642.el6.x86_64 on an x86_64

DB login: root
Password: 
Last login: Wed Dec  6 13:04:19 from 10.100.0.5

 

转载于:https://www.cnblogs.com/bass6/p/7992187.html

你可能感兴趣的:(python)