前往小程序,Get更优阅读体验!
立即前往
首页
学习
活动
专区
工具
TVP
发布
社区首页 >专栏 >kvm常见故障及解决方案

kvm常见故障及解决方案

作者头像
党志强
发布2020-02-01 17:04:42
3.3K0
发布2020-02-01 17:04:42
举报
文章被收录于专栏:敏而好学敏而好学

一、启动虚拟机Connection reset by peer

# virsh start vmhost1error: Failed to start domain vmhost1error: Unable to read from monitor: Connection reset by peer

在虚拟机运行过程中关闭宿主服务器就有可能导致这种情况出现,由于宿主服务器中的kvm虚拟机控制器与安装在kvm中的虚拟机会话被异常重置,所以我们可以如下解决:

# virsh managedsave-remove vmhost1# virsh start vmhost1

如果启动查看/var/log/libvirt/qemu/vmhost1.log下log还报如下错误:

Cannot set up guest memory 'pc.ram': Cannot allocate memory

这个问题可能是分配给vmhost1分配的内存过大(甚至超过的物理主机的内存大小),或者可能是宿主机没有足够的内存分配给此虚拟机,导致无法启动!

二、重Define虚拟机时无/usr/bin/kvm

error: Failed to define domain from hostname.xmlerror: Cannot find QEMU binary /usr/bin/kvm: No such file or directory

解决方法:

# ln -s /usr/libexec/qemu-kvm /usr/bin/kvm

三、error: internal error process exited while connecting to monitor

# virsh start vmhost1  
error: Failed to start domain vmhost1error: internal error process exited while connecting to monitor: kvm: -drive file=/dev/sp1368155439693/v1368544020461,if=none,id=drive-virtio-disk0,format=qcow2: could not open disk p_w_picpath /dev/sp1368155439693/v1368544020461: Invalid argument

分析:镜像格式错误,用qemu-img info 检查镜像和xml配置文件中指定的type是否一致!

四、Unable to load library 'virt': libvirt.so

Unable to load library 'virt': libvirt.so: cannot open shared object file: No such file or directoryLinux下解决:      ln -s /usr/lib/libvirt.so.0   /usr/lib/libvirt.so

windows下解决:
      将libvirt-0.dll改名为virt.dll

五、error: Refusing to undefine while domain managed save p_w_picpath exists

# virsh undefine vmhost1error: Refusing to undefine while domain managed save p_w_picpath existshttp://www.redhat.com/archives/libvir-list/2011-July/msg01219.html

解决方法:virsh undefine $domain  --managed-save

六、启动libvirtd进程出错

# /usr/local/sbin/libvirtd -d -l --config /usr/local/etc/libvirt/libvirtd.conf (编译安装的启动方式)
error:/usr/local/sbin/libvirtd: initialization failed
try to install libpcap-devel RPM and rebuild libvirt  http://comments.gmane.org/gmane.comp.emulators.libvirt/58218apt-get install libpcap-dev
上面的方法好像都没有效果,但是尝试了http://wiki.libvirt.org/page/The_daemon_cannot_be_started说的,把配置文件里的
listen_tls = 0注释取消(更奇怪的问题,在我的客户端链接不对)

七、启动虚拟机报错

# virsh start vmhost1error: Failed to start domain vmhost1error: internal error process exited while connecting to monitor: Could not access KVM kernel module: No such file or directoryfailed to initialize KVM: No such file or directoryNo accelerator found!

上面的提示信息就是因为QEMU在初始化阶段因为无法找到kvm内核模块。

# modprobe kvm   #载入指定的模块

重启电脑,进入bios界面,设置advance选项里面的virtualization标签为Enabled

通过命令 lsmod | grep kvm    #显示已载入的模块

八、虚拟机迁移

# virsh migrate --live 1 qemu+tcp://192.168.0.121 --p2p --tunnelled --unsafe error: operation failed: Failed to connect to remote libvirt URI qemu+tcp://192.168.0.121(在URI后面加上/system,‘system’相当于root用户的访问权限)

#virsh migrate --live 2 qemu+tcp://192.168.0.121/system --p2p --tunnelled
 error: Unsafe migration: Migration may lead to data corruption if disks use cache != none(加上--unsafe参数)#virsh migrate --live 2 qemu+tcp://192.168.0.121/system --p2p --tunnelled --unsafe error: Timed out during operation: cannot acquire state change lock (启动虚拟机有时也会遇此错误),需要重启libvirtd进程

九、virsh

error: Failed to connect socket to '/var/run/libvirt/libvirt-sock': Connection refused(libvirtd 进程没有启动,libvirtd是一个监听客户端请求的进程)# virsh -c qemu:///system listerror: Failed to connect socket to '/var/run/libvirt/libvirt-sock': Permission denied
error: failed to connect to the hypervisor
(当前用户没有权限,修改/etc/libvirt/libvirtd.conf,unix_sock_rw_perms = 0777,使所有用户都有权限读写)

转:http://openskill.cn/article/146

本文参与 腾讯云自媒体分享计划,分享自作者个人站点/博客。
原始发表:2016-05-25 ,如有侵权请联系 cloudcommunity@tencent.com 删除

本文分享自 作者个人站点/博客 前往查看

如有侵权,请联系 cloudcommunity@tencent.com 删除。

本文参与 腾讯云自媒体分享计划  ,欢迎热爱写作的你一起参与!

评论
登录后参与评论
0 条评论
热度
最新
推荐阅读
相关产品与服务
专用宿主机
专用宿主机(CVM Dedicated Host,CDH)提供用户独享的物理服务器资源,满足您资源独享、资源物理隔离、安全、合规需求。专用宿主机搭载了腾讯云虚拟化系统,购买之后,您可在其上灵活创建、管理多个自定义规格的云服务器实例,自主规划物理资源的使用。
领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档