libvirt qemu emulator permission denied

1.2k Views Asked by At

here is my xml looks like:

enter image description here

after running I got error like:

error: internal error: qemu unexpectedly closed the monitor: libvirt: error : cannot execute binary /home/shiyue/USWAP/uswap-dev/build/br2-uswap-vm/target/usr/bin/qemu-system-x86_64: Permission denied.

I try to view the current status of apparmor and all the profiles loaded as shown below: $sudo apparmor_status

9 profiles are in complain mode.
   libreoffice-oosplash
   libreoffice-soffice
   libvirtd
   libvirtd//null-/home/shiyue/USWAP/uswap-dev/build/br2-uswap-vm/target/usr/bin/qemu-system-x86_64.sh
   libvirtd//null-/home/shiyue/USWAP/uswap-dev/build/br2-uswap-vm/target/usr/bin/qemu-system-x86_64.sh//null-/home/shiyue/USWAP/uswap-dev/build/br2-uswap-vm/target/usr/bin/qemu-system-x86_64
   libvirtd//null-/home/shiyue/USWAP/uswap-dev/build/br2-uswap-vm/target/usr/bin/qemu-system-x86_64.sh//null-/usr/bin/dirname
   libvirtd//null-/home/shiyue/qemu-system-x86_64.sh
   libvirtd//null-/home/shiyue/qemu-system-x86_64.sh//null-/home/shiyue/USWAP/uswap-dev/build/br2-uswap-vm/target/usr/bin/qemu-system-x86_64
   libvirtd//null-/home/shiyue/qemu-system-x86_64.sh//null-/usr/bin/dirname

I followed those 2 instructions

https://askubuntu.com/questions/1159366/apparmor-permission-for-libvirt-qemu https://www.thegeekstuff.com/2014/03/apparmor-ubuntu/

still libvirt got denied, also tried stop apparmor service, still not work.

does anyone has experince on this

run a custom qumu uising libvirt

1

There are 1 best solutions below

0
Peter Krempa On

If you are attempting to run a custom qemu with the system-wide libvirtd/virtqemud it will attempt to run the qemu process under the qemu user.

This means that in addition to any apparmor rules you also need to ensure that the qemu user can access and execute the binary you've specified, which is in your home directory.

In other words, check if the basic unix permissions allow other users on your system to enter your homedir and execute binaries from where you built qemu.