当前位置:   article > 正文

kvm故障汇总_error: failed to connect to the hypervisor

error: failed to connect to the hypervisor

error: failed to connect to the hypervisor

[root@localhost /root]# virsh create demo.xml
error: failed to connect to the hypervisor
error: no valid connection
error: Failed to connect socket to '/var/run/libvirt/libvirt-sock': No such file or directory
  • 1
  • 2
  • 3
  • 4

解决办法:

1)查看libvirt进程是否启动? ps -le | grep libvirt*
2)如果没有启动:启动libvirt进程 libvirtd -d
3)查是否安装成功 virsh version ,出现版本就ok了

error: Failed to create domain from demo.xml

[root@loalhost /root]# virsh create demo.xml
error: Failed to create domain from demo.xml
error: Network not found: no network with matching name 'br0'
  • 1
  • 2
  • 3

custom memory allocation vtable not supported

[root@localhost /root]# virsh create demo.xml
error: Failed to create domain from demo.xml
error: internal error: process exited while connecting to monitor:
(process:115194): GLib-WARNING **: 02:32:03.330: gmem.c:489: custom memory allocation vtable not supported

  • 1
  • 2
  • 3
  • 4
  • 5
[root@localhost /root]# virsh create demo.xml
error: Failed to create domain from demo.xml
error: Network not found: no network with matching name 'br0'

或者报错:
[root@localhost /root]# virsh create demo.xml
setlocale: No such file or directory
error: Failed to create domain from demo.xml
error: internal error: No <source> 'network' attribute specified with <interface type='network'/>
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9

br0配置如下:

br0配置如下:
[root@localhost /root]#
#cat /etc/sysconfig/network-scripts/ifcfg-br0
DEVICE=br0
TYPE="Bridge"
BOOTPROTO=static
ONBOOT=yes
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7

定位:

1)首先:ifconfig看到有br0网卡信息
2)第二:查看br0网卡信息:

cat /etc/sysconfig/network-scripts/ifcfg-br0

3)第三:找xml中定义br0网卡信息的位置:

#这里应该是bridge模式
<interface type="network">  
   <source bridge="br0"/>
   <model type="virtio"/>
</interface>
  • 1
  • 2
  • 3
  • 4
  • 5

Unsupported machine type

Use -machine help to list supported machines!

[root@localhost /root] #virsh create anolis.xml
qemu-kvm: -machine pc-i440fx-2.1,accel=kvm,usb=off: Unsupported machine type
Use -machine help to list supported machines!

  • 1
  • 2
  • 3
  • 4

定位:

1)首先:查看本地kvm支持的类型:

/usr/libexec/qemu-kvm -machine help

在这里插入图片描述

2)第二:修改xml文件:

<type arch='x86_64' machine='pc'>hvm</type>
  • 1

libvirtd: initialization failed

#libvirtd  --version
libvirtd: initialization failed
  • 1
  • 2

解决:

1,打开/etc/profile
export LC_ALL=POSIX #加入这一行保存,这里好像要root权限
保存退出
2,然后source /etc/profile
3,sudo /etc/init.d/libvirt-bin restart
完成,用“libvirtd --version”查看,返回:libvirtd (libvirt) 0.9.13

libvirtd进程异常导致virsh create失败

[root@localhost /root]# virsh create demo.xml
error: failed to connect to the hypervisor
error: no valid connection
error: Failed to connect socket to '/var/run/libvirt/libvirt-sock': Connection refused


[root@localhost /root] #libvirtd --daemon
libvirtd: error: Unable to obtain pidfile. Check /var/log/messages or run without --daemon for more info.

  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9

解决办法:

1)杀掉libvirtd进程: kill -9 ps -ef|grep ‘libvirtd --daemon’|grep -v grep |awk ‘{print $2}’
2)删除var/run/libvirtd.pid: rm -rf var/run/libvirtd.pid
3) 启动 libvirtd --daemon

virt-install创建虚拟机时,–os-variant参数这样填写

–os-variant参数支持的os可以通过如下命令查看: [root@KVM ~]# osinfo-query os

KVM实战系列之VNC配置

修改宿主机配置

vim /etc/libvirt/qemu.conf 
vnc_listen = "0.0.0.0"
  • 1
  • 2

在虚拟机当中添加如下配置

<graphics type='vnc' port='5910' autoport='no' listen='0.0.0.0'>       
  <listen type='address' address='0.0.0.0'/>        
</graphics>

--------》或者《--------------------:
<graphics type='vnc' port='5966'  sharePolicy='allow-exclusive' >
     <listen type='address' address='0.0.0.0'/>
</graphics>

  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9

-bash: --graphics: command not found

virsh-install配置:

virt-install \
--name=kvm-test \
--memory=1024 \
--vcpus=1 \
--cdrom=/root/CentOS-7-x86_64-Everything-2009.iso \
--disk path=/home/test-01.qcow2,size=30,format=qcow2 \
--network default \
--virt-type=kvm \
--os-variant=centos7.0  \
--graphics vnc,listen=0.0.0.0,port=5901 \
--noautoconsole
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11

执行创建虚拟机是报错,原因是:

修改: /etc/libvirt/qemu.conf 
vnc_listen = "0.0.0.0"
  • 1
  • 2

ERROR Host does not support any virtualization options

使用virt-install进行CentOS 7的安装时报错:
[root@kvm ~]# virt-install --name=test --memory=512,maxmemory=1024 --vcpus=1,maxvcpus=2 --os-type=linux --os-variant=rhel7 --location=/tmp/CentOS-7-x86_64-DVD-1511.iso --disk path=/kvm_data/test.img,size=10 --bridge=br0 --graphics=none --console=pty,target_type=serial  --extra-args="console=tty0 console=ttyS0"
ERROR    Host does not support any virtualization options 
报错原因:主机不支持任何虚拟化选项
  • 1
  • 2
  • 3
  • 4

报错原因:主机不支持任何虚拟化选项

解决方法: 安装openssl软件 yum install -y openssl

声明:本文内容由网友自发贡献,不代表【wpsshop博客】立场,版权归原作者所有,本站不承担相应法律责任。如您发现有侵权的内容,请联系我们。转载请注明出处:https://www.wpsshop.cn/w/小桥流水78/article/detail/783749
推荐阅读
相关标签
  

闽ICP备14008679号