Problem modifying ACL rights


Wishing to install MacOS in a VM and open it by virt-manager by this method:

I have a fault when I try to modify the ACL:

sudo setfacl -m u:libvirtd:rx /home/$USER
sudo setfacl -R -m u:libvirtd:rx /home/$USER/OSX-KVM/

setfacl: Option -m: Invalid argument near character 3

So far my research and various tests have not solved this enigma. HELP!

Does libvirtd user exist? What is the output of grep libvirtd /etc/passwd?

This is what the command tells me

$ grep libvirtd /etc/passwd

It seems that their is no libvirtd user. That’s why it doesn’t work.
When I try to start the MacOS VM with virt-manager, I also have that message

Error starting domain: Cannot access storage file ‘/home/myusername/OSX-KVM/mac_hdd_ng.img’ (as uid:107, gid:107): Permission not granted

Do you have an idea to solve this trouble ?

You do not need a libvirtd user.
You do need to add your user to the libvirt group sudo usermod -aG libvirt $(whoami)

You then need to make sure that permissions are correct for the folder and contents for that group.
You also should note that QEMU/KVM uses /var/lib/libvirt/images/ as the default location for VM images. You may be able to link the folder in your home directory over to the other location, but I have not played with MacOS to see what can be done.

Hi, did you solve the problem?
I am having the same problem and it is driving me nuts. I have tried every possible solution. I even simlinked the folder as Jeff suggested but nothing works.

What about bind mounting the location in your home directory.
My entry in /etc/fstab would look like this
/home/USER/VMs /var/lib/libvirt/images none bind 1 1
and the /home/USER/VMs/ directory would have ownership/permissions as

# ls -dlZ /home/USER/VMs/
drwx--x--x. 2 root root system_u:object_r:virt_image_t:s0 4096 Nov 20 12:45 /home/USER/VMs/

Works great for me using QEMU/KVM (libvirt) and VMM

Thanks for your reply. Should I change the permissions myself or it is done automatically when I set the link in fstab?
Also, how would you go about? I have a folder called OSX-KVM in Home.
I tried editing fstab with
/home/sberla/OSX-KVM /var/lib/libvirt/images none bind 1 1 but it broke my system. I also simlinked the target folder to images but no luck.
The istructions at the github page say to add permissions to libvirt-qemu user but I have no such user. I have kvm and qemu instead but attributing permissions to them does nothing

I found a way! I just git cloned in /var/lib/libvirt/images and it works great!

The user running the VMM virtual machine manager must be part of the libvirtd group as noted above. No other special permissions are needed.

Just mounting that directory will not work if you already have VMs defined.
You would need to first make sure the target directory has the proper permissions as I showed above. You also would need to have all VMs inactive (powered down).
sudo chmod 711 /home/sberla/OSX-KVM
sudo chown root:root /home/sberla/OSX-KVM

Then all the content of /var/lib/libvirt/images would need to be copied into /home/sberla/OSX_KVM retaining all existing permissions, which could be done with something like sudo rsync -av /var/lib/libvirt/images/ /home/sberla/OSX-KVM/.

Once everything has been copied then you could test mount it with sudo mount -o bind /home/sberla/OSX-KVM /var/lib/libvirt/images and try starting an existing VM or create a new VM. If that works then the mount in fstab should work.

To test the fstab entry simply run sudo mount -a

Each mount done should be followed by a unmount so the next step is clean.

Once you are sure the data is relocated and the mounting process will work, the final step would be to remove the original data from /var/lib/libvirt/images by making sure

  1. the data is in the new location and all defined VMs are presently inactive.
  2. it is ready to be mounted, but at present is not mounted. sudo umount /home/sberla/OSX-KVM. Verify that with the mount command to list all mounted file systems.
  3. sudo rm -rf /var/lib/libvirt/images/* to remove the old copies remaining.
  4. mount the new file system sudo mount -a

If you have done all the steps in the proper order your system should be fully functional with the VMs happy in their new storage location.

Remember, that for all of this except the testing of the VM in the new location that all VMs must be powered down and totally inactive.

While I was creating this you posted your success. Glad to be of help and glad that you were able to succeed. :+1: