我已在一台戴尔poweredge1000m刀片式服务器上安装了kvm和libvirt。我使用以下语法从现有映像安装虚拟机(以root身份执行)。
virt-install --name=vm_test --ram=1024 --arch=i686 --vcpus=1 --os-type=linux --import --disk path=/root/shared.qcow2,bus=virtio,format=qcow2 --graphics vnc,port=5901,listen=0.0.0.0,password=newone --noautoconsole --description --autostart我得到了以下错误。
Starting install...
ERROR internal error process exited while connecting to monitor: char device redirected to /dev/pts/1
open /dev/kvm: Permission denied
failed to initialize KVM: Operation not permitted
Domain installation does not appear to have been successful.
If it was, you can restart your domain by running:
virsh --connect qemu:///system start vm_test
otherwise, please restart your installation.我在另一台桌面主机上使用了完全相同的命令,它在那里工作。我可以使用ISO镜像从virt-manager安装VM,其中virt-manager将磁盘镜像存储在默认位置。
对我来说,这似乎是一个文件权限错误,因为它不适用于/vms目录,但适用于其他/home/vm目录。
提前感谢您的帮助
发布于 2015-01-28 14:14:18
我已经找到了我的问题的解决方案,就是这里。
真正的原因是/vms是一个NFS挂载,它的配置(no_root_squash + rw)要求通过根用户访问它。
默认情况下,libvirt使用libvirt-qemu:kvm的用户和组权限运行虚拟机,即使您使用sudo特权运行它,也会造成麻烦。因此,我们需要在/etc/libvirt/qemu.conf中将qemu进程的用户和组设置为根用户。
同样,正如其他人指出的那样,这个错误可能有多种其他原因,而libvirt抛出这样一个通用错误是令人遗憾的。
最不令人沮丧的解决方案是授予所有权限,禁用selinux并确保其运行。现在,一个接一个地撤销权限,测试它在每个步骤中的工作情况,并最终理解为什么要求您提供最终的权限集。
发布于 2011-11-28 14:35:21
我在一台服务器上得到了同样的错误信息,这台服务器的libvirt已经运行了数周。将libvirt设置为作为根用户运行(如链接中所述)对我不起作用。然而,授予对/var/lib/libvirt/images的读取和执行访问权限解决了我的问题。
chmod go+rx /var/lib/libvirt/images
chmod o-rwx /var/lib/libvirt/images/*发布于 2011-12-21 18:25:48
如果您遵循有关使用libvirt创建vm的所有说明,您可能仍然会遇到上面的错误消息。根本原因是AppArmor,它可以在最近的Ubuntu发行版中找到。如果安全性不是问题,最简单的方法是删除AppArmor。
Ubuntu的官方文档给出了很多关于禁用AppArmor的建议:
https://stackoverflow.com/questions/6307950
复制相似问题