代码改变世界

KVM环境:Active console session exists for this domain

2023-05-13 08:28  AlfredZhao  阅读(531)  评论(0编辑  收藏  举报

做测试过程中被迫换电脑,但没有关掉原电脑的连接,所以用其他电脑连接测试环境时,发现之前的kvm测试环境因没有断开,无法连接:
error: operation failed: Active console session exists for this domain

[root@bogon ~]# virsh console db11g
Connected to domain db11g
Escape character is ^]
error: operation failed: Active console session exists for this domain

直接查询console相关进程并杀掉,
直接kill不成功,需要使用kill -9的方式:

[root@bogon ~]# ps -ef|grep console
root     11001 10035  0 08:11 pts/13   00:00:00 grep --color=auto console
root     28536 28270  0 07:52 pts/7    00:00:00 virsh console db11g
root     28643 28332  0 07:53 pts/11   00:00:00 virsh console db11gadg
root     28741 28383  0 07:53 pts/12   00:00:00 virsh console db11gcas
[root@bogon ~]# kill 28536
[root@bogon ~]# ps -ef|grep console
root     11300 10035  0 08:12 pts/13   00:00:00 grep --color=auto console
root     28536 28270  0 07:52 pts/7    00:00:00 virsh console db11g
root     28643 28332  0 07:53 pts/11   00:00:00 virsh console db11gadg
root     28741 28383  0 07:53 pts/12   00:00:00 virsh console db11gcas
[root@bogon ~]# kill -9 28536
[root@bogon ~]# ps -ef|grep console
root     11454 10035  0 08:12 pts/13   00:00:00 grep --color=auto console
root     28643 28332  0 07:53 pts/11   00:00:00 virsh console db11gadg
root     28741 28383  0 07:53 pts/12   00:00:00 virsh console db11gcas

再次尝试连接OK:

[root@bogon ~]# virsh console db11g
Connected to domain db11g
Escape character is ^]

[root@db11g ~]#

若要连接其他console也一样的操作方法。