libvirt错误总结

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是否一致。


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进程

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 vm1355991767186
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分配的内存过大(甚至超过的物理主机的内存大小)

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

更多参考:
 
<think>好的,用户遇到了“libvirt-bin没有安装候选”的错误,需要解决这个问题。首先,我需要回忆一下libvirt-bin包的情况。记得Ubuntu在某个版本之后可能将libvirt-bin更名为libvirt-daemon-system或者其他名称。可能用户使用的Ubuntu版本较新,导致旧包名不可用。 接下来,我应该检查用户系统的Ubuntu版本。不同的版本对应的软件源不同,包名可能有所变化。例如,在Ubuntu 18.04之后,libvirt-bin可能已经被替换。建议用户先更新软件包列表,确保源是最新的,有时候旧缓存可能导致找不到包。 然后,考虑替换包名。如果用户尝试安装libvirt-daemon-system,可能可以解决问题。另外,安装libvirt-clients和libvirt-daemon也可能需要,这些都是libvirt的相关组件。 另外,检查用户的软件源是否配置正确。如果某些仓库没有启用,可能会导致找不到候选版本。特别是universe仓库,因为libvirt通常位于其中。用户需要确保/etc/apt/sources.list中启用了universe组件。 如果这些步骤无效,可能需要添加第三方PPA,比如官方libvirt的PPA,但这通常不推荐,除非必要,因为可能带来兼容性问题。 最后,安装完成后验证libvirt服务是否运行,并检查用户是否在适当的组中,比如libvirt组,以便无需sudo权限使用相关命令。 总结步骤应该是:更新软件源、尝试新包名、检查仓库配置、添加必要仓库或PPA,最后验证安装。同时,提醒用户注意版本差异和潜在的系统变更影响。</think>### 解决"libvirt-bin没有安装候选"错误的方法 #### 1. 检查Ubuntu版本与包名变更 自Ubuntu 18.04(Bionic Beaver)起,$libvirt-bin$软件包已被$libvirt-daemon-system$替代[^1]。请通过以下命令确认系统版本: ```bash lsb_release -a ``` #### 2. 更新软件包列表 ```bash sudo apt update ``` #### 3. 安装替代软件包 根据系统版本选择安装命令: ```bash # 对于Ubuntu 16.04及更早版本 sudo apt install libvirt-bin # 对于Ubuntu 18.04及更新版本 sudo apt install libvirt-daemon-system libvirt-clients ``` #### 4. 验证软件源配置 确保/etc/apt/sources.list包含universe仓库: ```bash deb http://archive.ubuntu.com/ubuntu/ $(lsb_release -cs) main restricted universe multiverse ``` 执行更新后重试安装: ```bash sudo apt update && sudo apt install libvirt-daemon-system ``` #### 5. 添加官方PPA(可选) 对于特殊版本需求,可通过PPA安装: ```bash sudo add-apt-repository ppa:libvirt/libvirt sudo apt update sudo apt install libvirt-daemon-system ``` #### 6. 验证安装 ```bash systemctl status libvirtd virsh --version ```
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值