Libvirt错误总结
2015-08-27 10:36
302 查看
此文放在evernote快发霉了,整理一下放出来。
Java代码
virsh start vm1368544020451
error: Failed to start domain vm1368544020451
error: 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 image /dev/sp1368155439693/v1368544020461:
Invalid argument
镜像格式错误,用qemu-img info 检查镜像和xml配置文件中指定的type是否一致。
lzjun@lzjun-ubuntu:/opt/vm$ sudo virsh start vm0
error: Failed to start domain vm0
error: internal error process exited while connecting to monitor: Could not access KVM kernel module: No such file or directory
failed to initialize KVM: No such file or directory
No accelerator found!
上面的提示信息就是因为QEMU在初始化阶段因为无法找到kvm内核模块。
sudo 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进程
error: Failed to connect socket to '/var/run/libvirt/libvirt-sock': Connection refused(libvirtd 进程没有启动,libvirtd是一个监听客户端请求的进程)
$ virsh -c qemu:///system list
error: 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,使所有用户都有权限读写)
error:/usr/local/sbin/libvirtd: initialization failed
try to install libpcap-devel RPM and rebuild libvirt http://comments.gmane.org/gmane.comp.emulators.libvirt/58218
apt-get install libpcap-dev
上面的方法好像都没有效果,但是尝试了http://wiki.libvirt.org/page/The_daemon_cannot_be_started说的,把配置文件里的
listen_tls = 0注释取消(更奇怪的问题,在我的客户端链接不对)
error: Failed to start domain vm1355991767186
error: Unable to read from monitor: Connection reset by peer
还有可能是这样提示:
error: internal error process exited while connecting to monitor: Failed to allocate 16332619776 B: Cannot allocate memory
这个问题可能是因为为VM分配的内存过大(甚至超过的物理主机的内存大小)
linux 环境:
ln -s /usr/lib/libvirt.so.0 /usr/lib/libvirt.so
windows 环境
将libvirt-0.dll改名为virt.dll
# virsh undefine vm1354695894990
error: Refusing to undefine while domain managed save image exists
http://www.redhat.com/archives/libvir-list/2011-July/msg01219.html
managedsave
解决办法:virsh undefine $domain --managed-save
在centos下面Define虚拟机时,确实没有/usr/bin/kvm,加软链接
error: Failed to define domain from xxx.xml
error: Cannot find QEMU binary /usr/bin/kvm: No such file or directory
ln -s /usr/libexec/qemu-kvm /usr/bin/kvm
解决办法:ln -s /usr/libexec/qemu-kvm /usr/bin/kvm
更多参考:
http://wiki.libvirt.org/page/Failed_to_connect_to_the_hypervisor
https://access.redhat.com/knowledge/docs/en-US/Red_Hat_Enterprise_Linux/6/html/6.3_Technical_Notes/libvirt.html
https://access.redhat.com/knowledge/docs/en-US/Red_Hat_Enterprise_Linux/6/html/Virtualization_Host_Configuration_and_Guest_Installation_Guide/App_TCP_Po
Java代码
virsh start vm1368544020451
error: Failed to start domain vm1368544020451
error: 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 image /dev/sp1368155439693/v1368544020461:
Invalid argument
镜像格式错误,用qemu-img info 检查镜像和xml配置文件中指定的type是否一致。
启动虚拟机错误:
lzjun@lzjun-ubuntu:/opt/vm$ sudo virsh start vm0error: Failed to start domain vm0
error: internal error process exited while connecting to monitor: Could not access KVM kernel module: No such file or directory
failed to initialize KVM: No such file or directory
No accelerator found!
上面的提示信息就是因为QEMU在初始化阶段因为无法找到kvm内核模块。
sudo modprobe kvm #载入指定的模块
重启电脑,进入bios界面,设置advance选项里面的virtualization标签为Enabled
通过命令 lsmod | grep kvm #显示已载入的模块
虚拟机迁移:
# virsh migrate --live 1 qemu+tcp://192.168.0.121 --p2p --tunnelled --unsafeerror: 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 list
error: 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,使所有用户都有权限读写)
启动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/58218
apt-get install libpcap-dev
上面的方法好像都没有效果,但是尝试了http://wiki.libvirt.org/page/The_daemon_cannot_be_started说的,把配置文件里的
listen_tls = 0注释取消(更奇怪的问题,在我的客户端链接不对)
启动虚拟机:Connection reset by peer
virsh start vm1355991767186error: Failed to start domain vm1355991767186
error: Unable to read from monitor: Connection reset by peer
还有可能是这样提示:
error: internal error process exited while connecting to monitor: Failed to allocate 16332619776 B: Cannot allocate memory
这个问题可能是因为为VM分配的内存过大(甚至超过的物理主机的内存大小)
Unable to load library 'virt': libvirt.so: cannot open shared object file: No such file or directory
linux 环境:ln -s /usr/lib/libvirt.so.0 /usr/lib/libvirt.so
windows 环境
将libvirt-0.dll改名为virt.dll
# virsh undefine vm1354695894990
error: Refusing to undefine while domain managed save image exists
http://www.redhat.com/archives/libvir-list/2011-July/msg01219.html
managedsave
解决办法:virsh undefine $domain --managed-save
在centos下面Define虚拟机时,确实没有/usr/bin/kvm,加软链接
error: Failed to define domain from xxx.xml
error: Cannot find QEMU binary /usr/bin/kvm: No such file or directory
ln -s /usr/libexec/qemu-kvm /usr/bin/kvm
解决办法:ln -s /usr/libexec/qemu-kvm /usr/bin/kvm
更多参考:
http://wiki.libvirt.org/page/Failed_to_connect_to_the_hypervisor
https://access.redhat.com/knowledge/docs/en-US/Red_Hat_Enterprise_Linux/6/html/6.3_Technical_Notes/libvirt.html
https://access.redhat.com/knowledge/docs/en-US/Red_Hat_Enterprise_Linux/6/html/Virtualization_Host_Configuration_and_Guest_Installation_Guide/App_TCP_Po
相关文章推荐
- 存储在session中的类要进行系列化
- 关于spark的一些简单认识。
- 版本控制——hg教程
- linux openldap同步配置
- concurrentHashMap原理分析
- SSH公钥登录访问(配置实验)
- lpad函数介绍
- Unity鼠标自由查看3D物体之直接旋转物体
- #2334:Simple prefix compression--关于string.length()
- oracle数据库解决查询值为null的情况
- freemarker全解教程
- Yii2 Component基类分析
- LogStash的Filter的使用
- 7 个去伪存真的 JavaScript 面试题
- 调用DEDE日期时间格式整理大全
- 控件随手指移动动画
- 黑马程序员——C语言之文件操作
- 桥接模式
- ZTE 继承与访问控制
- JavaScript基本数据类型及值类型和引用类型