virt-install error

Jatin Kumar picture Jatin Kumar · Jun 10, 2011 · Viewed 21.9k times · Source

I have setup kvm, libvirt on one of Dell poweredge1000m blades. I am using the following syntax for installing a virtual machine from an existing image (executing as 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

I am getting the following error.

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.

I have used exactly the same command with one of other desktop hosts and it works there. I can install a VM from virt-manager using an ISO image with virt-manager storing the disk image at default location.

It seems like a file permissions error to me as it is not working with /vms directory but is working with some other /home/vm directory.

Thanks for help in advance

Answer

clifflu picture clifflu · Nov 28, 2011

I got the same error message on a server, which has libvirt up for weeks. Setting libvirt to run as root (as mentioned in the link) didn't work for me. However, granting read & execute access to /var/lib/libvirt/images solved my problem.

chmod go+rx /var/lib/libvirt/images
chmod o-rwx /var/lib/libvirt/images/*