I have libvirt configured to run LXC by default.
I also have memory limits in place. Directly after starting the LXC
containers, they are correct; e.g.:
root@dns:~# free
total used free shared buff/cache available
Mem: 1048576 41660 1006784 48124 132 1006784
Swap: 0 0 0
After some time, I have noticed that they are no longer correct; in fact
they are wildly wrong:
root@dns:~# free
total used free shared buff/cache available
Mem: 9007199254740991 598372 9007199254108535 85652 34084 9007199254108535
Swap: 0 1692 -1692
I noticed that this seems to happen when something in systemd is
reconfigured, e.g. enabling a service. I saw this in the log:
Dec 01 09:02:41 tix systemd[1]: Reloading.
Dec 01 09:02:41 tix systemd[1]: /lib/systemd/system/virtlogd.socket:6: ListenStream= references a path below legacy directory /var/run/, updating /var/run/libvirt/virtlogd-sock → /run/libvirt/virtlogd-sock; please update the unit file accordingly.
Dec 01 09:02:41 tix systemd[1]: /lib/systemd/system/virtlogd-admin.socket:6: ListenStream= references a path below legacy directory /var/run/, updating /var/run/libvirt/virtlogd-admin-sock → /run/libvirt/virtlogd-admin-sock; please update the unit file accordingly.
Dec 01 09:02:41 tix systemd[1]: /lib/systemd/system/virtlockd.socket:6: ListenStream= references a path below legacy directory /var/run/, updating /var/run/libvirt/virtlockd-sock → /run/libvirt/virtlockd-sock; please update the unit file accordingly.
Dec 01 09:02:41 tix systemd[1]: /lib/systemd/system/virtlockd-admin.socket:6: ListenStream= references a path below legacy directory /var/run/, updating /var/run/libvirt/virtlockd-admin-sock → /run/libvirt/virtlockd-admin-sock; please update the unit file accordingly.
Dec 01 09:02:41 tix systemd[1]: /lib/systemd/system/dbus.socket:5: ListenStream= references a path below legacy directory /var/run/, updating /var/run/dbus/system_bus_socket → /run/dbus/system_bus_socket; please update the unit file accordingly.
Dec 01 09:02:41 tix systemd[1]: /lib/systemd/system/lxc.service:16: Standard output type syslog is obsolete, automatically updating to journal. Please update your unit file, and consider removing the setting altogether.
Dec 01 09:02:41 tix systemd[1]: /lib/systemd/system/lxc.service:17: Standard output type syslog is obsolete, automatically updating to journal. Please update your unit file, and consider removing the setting altogether.
Dec 01 09:02:41 tix systemd[1]: /lib/systemd/system/smartd.service:9: Standard output type syslog is obsolete, automatically updating to journal. Please update your unit file, and consider removing the setting altogether.
Dec 01 09:02:41 tix systemd[1]: /lib/systemd/system/apcupsd.service:13: PIDFile= references a path below legacy directory /var/run/, updating /var/run/apcupsd.pid → /run/apcupsd.pid; please update the unit file accordingly.
Dec 01 09:02:41 tix systemd[1]: machine-lxc\x2d30315\x2ddns.scope: Failed to set 'memory.limit_in_bytes' attribute on '/machine.slice/machine-lxc\x2d30315\x2ddns.scope' to '-1': Invalid argument
Note the last line:
Failed to set 'memory.limit_in_bytes' attribute ... to '-1'
Wht is it trying to do that? This seems to be the moment that the memory
settings in LXC is screwed up.