How to configure systemd-oomd to be less aggressive?

I’m running Fedora 37 on my laptop and for the first time this week, my VMs on my laptop started crashing for some reason. Upon further investigation, it seems that when I run more than one VM, all of the VMs will eventually get OOM killed by systemd-oomd, despite the fact that I had over 12GB of free RAM (as reported by ‘free -m’).

I searched around and found some information about how systemd-oomd works (I admit I didn’t really understand it) as well as how to change ManagedOOMMemoryPressureLimit in /etc/systemd/system/user@service.service.d/override.conf. However, even after a reboot, the memory limit was still 50% for my slice.

I eventually disabled systemd-oomd (systemctl mask systemd-oomd) and that resolved the issue, but I was hoping that someone could explain to me how to increase the MemoryPressureLimit for my cgroup on my workstation. I was not able to figure that part out. I appreciate the purpose of sytemd-oomd, but if I can’t tune it to keep it from OOM killing VMs when there is ample memory available, then I won’t have a choice but to leave it disabled.


I would guess that you’d need to change the command for starting your VMs to something like systemd-run --scope --user --property=ManagedOOMPreference=omit /usr/bin/qemu-kvm .... But I’ve never tried it.

1 Like

I haven’t tested that either, but that’s not really a solution, especially when VMs are running from something like virt-manager.

I guess you could launch virt-manager with that systemd-run wrapper then and the VMs it spawns should inherit the same cgroup properties.

1 Like