virsh console连接虚拟机遇到的问题

系统:CentOS 7.6

1、在使用 virsh console 命令连接虚拟机的时候,发现无法连接而报以下错误

 

经过测试以后发现,用xml文件创建的虚拟机,均会存在此问题

解决方案:

 

 https://access.redhat.com/documentation/en-us/red_hat_enterprise_linux/6/html/virtualization_host_configuration_and_guest_installation_guide/app_domain_console

 

2、使用virsh console连接到非使用xml文件创建的虚拟机时,会卡在这里(使用ctrl + ] 退出)

[root@zhimao ~]# virsh console centos7-3 
连接到域 centos7-3
换码符为 ^]

需要在客户机上执行以下操作(让ttyS0允许登录系统)

[root@centos7-3 ~]# echo "ttyS0" >> /etc/securetty 
[root@centos7-3 ~]# grubby --update-kernel=ALL --args="console=ttyS0" # 更新内核参数
[root@centos7-3 ~]# reboot

重新连接

[root@zhimao ~]# virsh console centos7-3 
连接到域 centos7-3
换码符为 ^]          //回车一下

[root@centos7-3 ~]#         //成功连接

 

posted @ 2020-09-28 13:24  只猫  阅读(2481)  评论(0编辑  收藏  举报