Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

My host OS is Ubuntu Server 11.04 (natty)

After following the instructions detailed by Ubuntu's help, I created one KVM image using

sudo ubuntu-vm-builder kvm hardy --libvirt qemu:///system

The image file was created as

-rw-r--r-- 1 root root 438M 2011-06-17 14:39 ubuntu-kvm/tmpK9hbU5.qcow2

The I can list it with virsh by sudo virsh -c qemu:///system "list --all"

Id   Name                 State
----------------------------------
  - ubuntu               shut off  

Buth when I call

sudo virsh -c qemu:///system "start ubuntu"

The error was thrown up:

error: Failed to start domain ubuntu
error: internal error process exited while connecting to monitor: kvm: -drive file=/home/myuser/vmopt/ubuntu-kvm/tmpK9hbU5.qcow2,if=none,id=drive-ide0-0-0,format=qcow2: could not open disk image /home/myuser/vmopt/ubuntu-kvm/tmpK9hbU5.qcow2: Permission denied

The user "myuser" had been added to group libvirt.

I've gone so far as to chmod the image file as well its directory to 777, but the error is still there.

share|improve this question

migrated from stackoverflow.com Jun 17 '11 at 9:14

This question came from our site for professional and enthusiast programmers.

add comment

2 Answers 2

KVM images are restricted by selinux. Putting them in /var/lib/libvirt/images should suffice.

http://libvirt.org/drvqemu.html#securityselinux goes into more detail.

share|improve this answer
    
Man!! This worked for me. Thanks a lot man. Apparently the $HOME directory of your account is protected wich is where virsh likes to install things at by default. After I installed my vms, I ran mv $HOME/vmfolder /var/lib/libvirt/images. Then I ran virsh edit vmname and changed the image file's location accordingly. –  Antwan W. A-Dubb Feb 23 '12 at 3:47
    
I also had to change the owner of one of my vms. It belonged to root which led to an access denied. sudo chown -R libvirt-qemu:kvm dbos/ubuntu-kvm/. You can run ls -l on/your/vm/dir/and/its/subdirs/ to check permissions at each level. Ensure none of them belong to the root group and user. –  Antwan W. A-Dubb Feb 23 '12 at 4:05
    
I've found that the easiest and safest way to create your vm's is to make sure you cd to this directory /var/lib/libvirt/images and run your install from there. That way you won't have to worry about the folder level permissions. They'll just default to the current user as opposed to root. –  Antwan W. A-Dubb Feb 23 '12 at 5:01
add comment

a easy solution would be to edit the /etc/libvirt/qemu.conf file and uncommenting the following lines:

User = "root"
group = "root"

Don't forget to restart libvirtd

share|improve this answer
    
That might let you run it, but what are the security implications? –  cpast Feb 25 '13 at 15:19
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.