Looking Glass Permission Error

Hi guys,
I’m running a win10 VM on manjaro using libvirt and qemu with VFIO passthrough.
In order to use it on the same monitor I’m using looking-glass.
This entire setup worked fine, until earlier today.
Everytime I try to start the VM, I get the following error:

Error starting domain: internal error: qemu unexpectedly closed the monitor: 2022-03-18T19:58:30.087433Z qemu-system-x86_64: can't open backing store /dev/shm/looking-glass for guest RAM: Permission denied

Traceback (most recent call last):
  File "/usr/share/virt-manager/virtManager/asyncjob.py", line 72, in cb_wrapper
    callback(asyncjob, *args, **kwargs)
  File "/usr/share/virt-manager/virtManager/asyncjob.py", line 108, in tmpcb
    callback(*args, **kwargs)
  File "/usr/share/virt-manager/virtManager/object/libvirtobject.py", line 57, in newfn
    ret = fn(self, *args, **kwargs)
  File "/usr/share/virt-manager/virtManager/object/domain.py", line 1384, in startup
    self._backend.create()
  File "/usr/lib/python3.10/site-packages/libvirt.py", line 1353, in create
    raise libvirtError('virDomainCreate() failed')
libvirt.libvirtError: internal error: qemu unexpectedly closed the monitor: 2022-03-18T19:58:30.087433Z qemu-system-x86_64: can't open backing store /dev/shm/looking-glass for guest RAM: Permission denied


What did I try already?
All the things that come up in other forum topics with this issue (like this

I’ve checked the apparmor rules:

/etc/apparmor.d/abstractions/libvirt-qemu

dev/shm/looking-glass rw,

I also disabled apparmor completely, no dice.
I tried changing user and group to root in

/etc/libvirt/qemu.conf 

still to no avail. And to be honest not my preferred solution, as it worked fine without root and with apparmor

Any help would be appreciated!

Make sure to follow Installation — Looking Glass B5.0.1 documentation. If QEMU has issues with permissions, just delete /dev/shm/looking-glass and touch a new one with the proper owner/group/permissions (which is essentially whatever the systemd-tmpfiles facility does every time you boot the host).

I followed the documentation you linked, everything was already setup like it should be. For now I bruteforced by it giving it 666 permissions, which gets the VM working again, but I’d love to understand what happened here. My own user/group used to run the VM and looking-glass. I checked out /etc/libvirt/qemu.conf and its configured to use my user and group. this might be a stupid question, but how do I figure out which user:group is trying to access the shared memory device and to change it back?

you can find out which user runs qemu by running ps -ef | grep qemu-system-x86_64 | awk '{print $1}' | head -1 while the VM is running. Now run ls -la /dev/shm/looking-glass and see if that user has r+w permissions.

2 Likes

Thanks, that helped! Still no idea how the user got changed, but all is well that ends well.

2 Likes