QEMU 4.1.0 broke my VMs (realtime mlock)

Hey everyone,
So, I am trying to update from QEMU 3.1 to 4.1, however I have reached an issue with libvirt and this new QEMU version. I am currently using Ubuntu 19.04 (Pop!_OS)

The error happens do to a deprecated variable in QEMU which my version of libvirt is using.

Error starting domain: internal error: process exited while connecting to monitor: qemu4.1.0-system-x86_64: -realtime mlock=off: warning: '-realtime mlock=...' is deprecated, please use '-overcommit mem-lock=...' instead

Traceback (most recent call last):
  File "/usr/share/virt-manager/virtManager/asyncjob.py", line 75, in cb_wrapper
    callback(asyncjob, *args, **kwargs)
  File "/usr/share/virt-manager/virtManager/asyncjob.py", line 111, in tmpcb
    callback(*args, **kwargs)
  File "/usr/share/virt-manager/virtManager/libvirtobject.py", line 66, in newfn
    ret = fn(self, *args, **kwargs)
  File "/usr/share/virt-manager/virtManager/domain.py", line 1400, in startup
    self._backend.create()
  File "/usr/lib/python3/dist-packages/libvirt.py", line 1080, in create
    if ret == -1: raise libvirtError ('virDomainCreate() failed', dom=self)
libvirt.libvirtError: internal error: process exited while connecting to monitor: qemu4.1.0-system-x86_64: -realtime mlock=off: warning: '-realtime mlock=...' is deprecated, please use '-overcommit mem-lock=...' instead

I probably have to update libvirt, however I’m unsure what version I must get to get this to work. I’d really appreciate some help. Thanks!

Are you using hugepages? If so, can you confirm that running “cat /proc/meminfo” shows that your hugepages are successfully allocated?

HugePages_Total: 12
HugePages_Free: 12
HugePages_Rsvd: 0
HugePages_Surp: 0

I was having this exact same issue before, indicating that libvirt was using a deprecated variable. Turns out my hugepages configuration was wrong (all of the above 4 were 0) and setting the correct kernel parameters fixed this. Very strange that this would throw the “realtime mlock=…’ is deprecated” error in my case. Worthwhile to check regardless.

Hello! I am having the same problem.

cat /proc/meminfo shows all 0s for HugePages.

Can you tell us what the correct kernel parameters are to fix this?

Edit: Nevermind, my problem had to do with Arch and QEMU missing json files.