Comment 0 for bug 2073214

Revision history for this message
Tim Richardson (tim-richardson) wrote : hugespages causes permissions error

Today I upgraded from 22.04 to 24.04

I have a VM with 16GB of hugepages allocated to it.

This no longer works.

I can not defeat the virtual machine start up error (from virtual manager):

Error starting domain: internal error: QEMU unexpectedly closed the monitor (vm='ubuntu24.04'): 2024-07-16T04:54:51.443751Z qemu-system-x86_64: failed to resize memfd to 17179869184: 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 1402, in startup
    self._backend.create()
  File "/usr/lib/python3/dist-packages/libvirt.py", line 1379, in create
    raise libvirtError('virDomainCreate() failed')
libvirt.libvirtError: internal error: QEMU unexpectedly closed the monitor (vm='ubuntu24.04'): 2024-07-16T04:54:51.443751Z qemu-system-x86_64: failed to resize memfd to 17179869184: Permission denied

I have done this:

sudo aa-complain /etc/apparmor.d/usr.lib.libvirt.virt-aa-helper
sudo aa-complain /etc/apparmor.d/usr.sbin.libvirtd

While I did not have to take any such steps with 22.04, I have mounted

sudo mount -t hugetlbfs -o mode=1770,gid=kvm none /dev/hugepages

and these permissions are observed:

root@black:/etc/apparmor.d# ls -ld /dev/hugepages
drwxrwx--t 3 root kvm 0 Jul 16 14:47 /dev/hugepages

root@black:/etc/apparmor.d# id libvirt-qemu
uid=64055(libvirt-qemu) gid=109(kvm) groups=109(kvm),139(libvirt),64055(libvirt-qemu),1002(hugetlb)

I have edited /etc/libvirt/qemu.conf to uncomment the mount point of the hugepages, even though this was not necessary with 22.04

log entries don't add anything (for me):

2024-07-16T04:54:51.443751Z qemu-system-x86_64: failed to resize memfd to 17179869184: Permission denied
2024-07-16 04:54:51.477+0000: shutting down, reason=failed